fhelium.ir._dialect
Permissive context and value helpers for multi-depth FHElium IR.
First-party operations and types live in distinct registered dialect modules. The context loads all registered first-party dialects while preserving unknown operations and types for mixed-level research and external extensions.
DIALECT_VERSION
constant View source
DIALECT_VERSION = '0.2'DIALECT_VERSION_ATTRIBUTE
constant View source
DIALECT_VERSION_ATTRIBUTE = 'fhelium.dialect_version'SCHEMA_VERSION
constant View source
SCHEMA_VERSION = '1'SCHEMA_VERSION_ATTRIBUTE
constant View source
SCHEMA_VERSION_ATTRIBUTE = 'fhelium.schema_version'EncryptedType
class View source
EncryptedType()Bases: OpenStateType
Encrypted value with partial scheme and representation state.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium.encrypted' | |
ROLE | ClassVar[ValueRole] | 'encrypted' |
FHElium
data View source
FHElium = Dialect('fhelium', [MaterialRefOp, ResourceRefOp, ConstantOp], [EncryptedType, MessageType, PlaintextType, MaterialType, ResourceType])MaterialRefOp
class View source
MaterialRefOp(result_type: Attribute | None=None, *, symbol: str | StringAttr | None=None, kind: str | StringAttr | None=None, attributes: Mapping[str, Attribute] | None=None)Bases: IRDLOperation
Reference an external Tensor by its entry in the material table.
Missing Tensor dimensions or state may remain unknown in a saved Program. The symbol names data; it does not select a resource class or a factory.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium.material.ref' | |
value | result_def() | |
symbol | opt_attr_def(StringAttr) | |
kind | opt_attr_def(StringAttr) | |
traits | traits_def(Pure()) |
MaterialType
class View source
MaterialType()Bases: OpenStateType
Symbolic reference type for graph-external material.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium.material' |
MessageType
class View source
MessageType()Bases: OpenStateType
Public value with optional frontend and tensor metadata.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium.message' | |
ROLE | ClassVar[ValueRole] | 'message' |
PlaintextType
class View source
PlaintextType()Bases: OpenStateType
Encoded plaintext with partial representation state.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium.plaintext' | |
ROLE | ClassVar[ValueRole] | 'plaintext' |
ResourceRefOp
class View source
ResourceRefOp(result_type: Attribute | None=None, *, symbol: str | StringAttr | None=None, kind: str | StringAttr | None=None, attributes: Mapping[str, Attribute] | None=None)Bases: IRDLOperation
Reference an execution resource supplied by Backend binding.
The operation returns the bound value without materializing or mutating it. An unused reference can be removed with its unused resource requirement.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium.resource.ref' | |
value | result_def() | |
symbol | opt_attr_def(StringAttr) | |
kind | opt_attr_def(StringAttr) | |
traits | traits_def(Pure()) |
ResourceType
class View source
ResourceType()Bases: OpenStateType
Symbolic reference type for graph-external execution resources.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | 'fhelium.resource' |
ValueRole
type alias View source
ValueRole = Literal['encrypted', 'message', 'plaintext', 'static']create_dialect_context
function View source
def create_dialect_context() -> XdslContext: ...Create an xDSL context containing every registered IR dialect.
Structural registration and preservation are independent of lowering readiness. Unknown application and vendor vocabulary remains legal and can coexist with operations from any registered abstraction level.
create_operation
function View source
def create_operation(context: XdslContext, name: str, *, operands: Sequence[SSAValue]=(), result_types: Sequence[Attribute]=(), attributes: Mapping[str, Attribute] | None=None, properties: Mapping[str, Attribute] | None=None, location: LocationAttr | None=None) -> Operation: ...Construct a registered or preserved unknown operation by textual name.
operation_name
function View source
def operation_name(operation: Operation) -> str: ...Return the textual name of a registered or unknown operation.
value_role
function View source
def value_role(value_or_type: SSAValue | Attribute) -> ValueRole | None: ...Return a registered value role, or None for non-value types.
value_type
function View source
def value_type(role: ValueRole, state: DictionaryAttr | Mapping[str, Attribute] | None=None) -> Attribute: ...Construct the preserved open core type for a known value role.