fhelium.backend.rns.operations
Native implementations of logical RNS operations.
NativeMontgomeryAccumulateImplementation
class View source
NativeMontgomeryAccumulateImplementation(name: str = 'native-montgomery-accumulate', supports_in_place: bool = False, operation_types: tuple[type[Operation], ...] = (rns.AddMontgomeryLazyOp,))Bases: _TensorOperandImplementation
Accumulate equal-layout Montgomery bundles modulo twice each prime.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'native-montgomery-accumulate' |
supports_in_place | bool | False |
operation_types | tuple[type[Operation], ...] | (rns.AddMontgomeryLazyOp,) |
execute
method
def execute(invocation: OperationInvocation, values: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...NativeMontgomeryMultiplyImplementation
class View source
NativeMontgomeryMultiplyImplementation(name: str = 'native-montgomery-multiply', supports_in_place: bool = False, operation_types: tuple[type[Operation], ...] = (rns.MontgomeryMultiplyOp,))Bases: _TensorOperandImplementation
Multiply two logical NTT/Montgomery polynomial bundles.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'native-montgomery-multiply' |
supports_in_place | bool | False |
operation_types | tuple[type[Operation], ...] | (rns.MontgomeryMultiplyOp,) |
execute
method
def execute(invocation: OperationInvocation, values: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...NativeMontgomeryWeightedSumImplementation
class View source
NativeMontgomeryWeightedSumImplementation(name: str = 'native-montgomery-weighted-sum', supports_in_place: bool = False, operation_types: tuple[type[Operation], ...] = (rns.MontgomeryWeightedSumOp, rns.MontgomeryWeightedSumsOp))Bases: _TensorOperandImplementation
Compute one or more
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'native-montgomery-weighted-sum' |
supports_in_place | bool | False |
operation_types | tuple[type[Operation], ...] | (rns.MontgomeryWeightedSumOp, rns.MontgomeryWeightedSumsOp) |
execute
method
def execute(invocation: OperationInvocation, values: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...NativePlaintextArithmeticImplementation
class View source
NativePlaintextArithmeticImplementation(name: str = 'native-plaintext-arithmetic', supports_in_place: bool = True, operation_types: tuple[type[Operation], ...] = (rns.AddPlaintextOp, rns.MultiplyPlaintextOp))Bases: _TensorOperandImplementation
Execute prepared plaintext addition and multiplication.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'native-plaintext-arithmetic' |
supports_in_place | bool | True |
operation_types | tuple[type[Operation], ...] | (rns.AddPlaintextOp, rns.MultiplyPlaintextOp) |
execute
method
def execute(invocation: OperationInvocation, values: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...NativeRnsLinearImplementation
class View source
NativeRnsLinearImplementation(name: str = 'native-rns-linear', supports_in_place: bool = True, operation_types: tuple[type[Operation], ...] = (rns.AddStandardOp, rns.SubtractStandardOp, rns.NegateStandardOp))Bases: _TensorOperandImplementation
Execute standard-range RNS add, subtract, and negate operations.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'native-rns-linear' |
supports_in_place | bool | True |
operation_types | tuple[type[Operation], ...] | (rns.AddStandardOp, rns.SubtractStandardOp, rns.NegateStandardOp) |
execute
method
def execute(invocation: OperationInvocation, values: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...NativeRnsStructureImplementation
class View source
NativeRnsStructureImplementation(name: str = 'native-rns-structure', supports_in_place: bool = False, operation_types: tuple[type[Operation], ...] = (rns.ExtractComponentOp, rns.PackTwoComponentsOp, rns.PackThreeComponentsOp))Bases: _TensorOperandImplementation
Extract and assemble logical RNS component bundles.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'native-rns-structure' |
supports_in_place | bool | False |
operation_types | tuple[type[Operation], ...] | (rns.ExtractComponentOp, rns.PackTwoComponentsOp, rns.PackThreeComponentsOp) |
execute
method
def execute(invocation: OperationInvocation, values: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...NativeRnsTransitionImplementation
class View source
NativeRnsTransitionImplementation(name: str = 'native-rns-transition', supports_in_place: bool = True, operation_types: tuple[type[Operation], ...] = (rns.StandardToMontgomeryOp, rns.MontgomeryToStandardOp, rns.RestrictDepthOp, rns.ReinterpretScaleOp))Bases: _TensorOperandImplementation
Execute residue conversion, depth restriction, and scale metadata ops.
Attributes
| Name | Type | Default/value |
|---|---|---|
name | str | 'native-rns-transition' |
supports_in_place | bool | True |
operation_types | tuple[type[Operation], ...] | (rns.StandardToMontgomeryOp, rns.MontgomeryToStandardOp, rns.RestrictDepthOp, rns.ReinterpretScaleOp) |
execute
method
def execute(invocation: OperationInvocation, values: tuple[torch.Tensor, ...], resources: tuple[BoundResource, ...], *, in_place: bool) -> tuple[torch.Tensor, ...]: ...