pub struct OperationContract { /* private fields */ }Expand description
Stable semantic contract for one operation before backend lowering.
Generated operation registries own these descriptors. The builder-style
const methods are public so generated code remains ordinary inspectable
Rust rather than a private binary table.
Implementations§
Source§impl OperationContract
impl OperationContract
Sourcepub const MAX_VALUES: usize = 8
pub const MAX_VALUES: usize = 8
Maximum number of fixed logical inputs or outputs.
Sourcepub const MAX_ATTRIBUTES: usize = 16
pub const MAX_ATTRIBUTES: usize = 16
Maximum number of semantic attributes.
Sourcepub const fn new(
name: &'static str,
hash: u64,
input_kinds: &'static [OpValueKind],
output_kinds: &'static [OpValueKind],
) -> Self
pub const fn new( name: &'static str, hash: u64, input_kinds: &'static [OpValueKind], output_kinds: &'static [OpValueKind], ) -> Self
Construct the fixed-arity portion of an operation contract.
Sourcepub const fn variadic_inputs(self, kind: OpValueKind, minimum: usize) -> Self
pub const fn variadic_inputs(self, kind: OpValueKind, minimum: usize) -> Self
Declare a homogeneous variadic input tail and its minimum length.
Sourcepub const fn variadic_outputs(self, kind: OpValueKind, minimum: usize) -> Self
pub const fn variadic_outputs(self, kind: OpValueKind, minimum: usize) -> Self
Declare a homogeneous variadic output tail and its minimum length.
Sourcepub const fn aligned_variadic_aliases(self) -> Self
pub const fn aligned_variadic_aliases(self) -> Self
Declare that each variadic output aliases and mutates the variadic input at the same tail position.
Sourcepub const fn attributes(self, attributes: &'static [OpAttributeSpec]) -> Self
pub const fn attributes(self, attributes: &'static [OpAttributeSpec]) -> Self
Declare the ordered non-value input signature.
Sourcepub const fn with_differentiation(self, value: OpDifferentiation) -> Self
pub const fn with_differentiation(self, value: OpDifferentiation) -> Self
Declare reverse-differentiation behavior.
Sourcepub const fn with_shape_rule(self, value: OpShapeRule) -> Self
pub const fn with_shape_rule(self, value: OpShapeRule) -> Self
Declare the schema’s uniform shape rule.
Sourcepub const fn with_dtype_rule(self, value: OpDTypeRule) -> Self
pub const fn with_dtype_rule(self, value: OpDTypeRule) -> Self
Declare the schema’s uniform dtype rule.
Sourcepub const fn with_lowering(self, value: OpLowering) -> Self
pub const fn with_lowering(self, value: OpLowering) -> Self
Declare the backend-neutral lowering family.
Sourcepub const fn with_fusion_class(self, value: OpFusionClass) -> Self
pub const fn with_fusion_class(self, value: OpFusionClass) -> Self
Declare the schema’s fusion taxonomy class.
Sourcepub const fn mutated_inputs(self, mask: u8) -> Self
pub const fn mutated_inputs(self, mask: u8) -> Self
Declare the fixed-input mutation bit mask.
Sourcepub const fn optional_inputs(self, mask: u8) -> Self
pub const fn optional_inputs(self, mask: u8) -> Self
Declare the fixed-input optionality bit mask.
Sourcepub const fn alias(self, output: usize, input: u8) -> Self
pub const fn alias(self, output: usize, input: u8) -> Self
Declare that one output aliases a fixed input’s storage.
Aliasing does not imply mutation. A pass-through output is a fresh SSA
value over the same bytes; an in-place write additionally declares the
input in Self::mutated_inputs.
Sourcepub const fn with_control_flow(self, value: OpControlFlow) -> Self
pub const fn with_control_flow(self, value: OpControlFlow) -> Self
Declare semantic control flow.
Sourcepub const fn differentiation(self) -> OpDifferentiation
pub const fn differentiation(self) -> OpDifferentiation
Return the declared differentiation behavior.
Sourcepub const fn shape_rule(self) -> OpShapeRule
pub const fn shape_rule(self) -> OpShapeRule
Return the uniform shape rule.
Sourcepub const fn dtype_rule(self) -> OpDTypeRule
pub const fn dtype_rule(self) -> OpDTypeRule
Return the uniform dtype rule.
Sourcepub const fn attribute_specs(self) -> &'static [OpAttributeSpec]
pub const fn attribute_specs(self) -> &'static [OpAttributeSpec]
Return the ordered non-value attribute signature.
Sourcepub const fn lowering(self) -> OpLowering
pub const fn lowering(self) -> OpLowering
Return the declared lowering family.
Sourcepub const fn fusion_class(self) -> OpFusionClass
pub const fn fusion_class(self) -> OpFusionClass
Return the schema-declared fusion taxonomy class.
Sourcepub const fn control_flow(self) -> OpControlFlow
pub const fn control_flow(self) -> OpControlFlow
Return the declared control-flow class.