Built-In Kernels
CPU Kernels
CPU kernel implementations.
- class shmpipeline.kernels.cpu.AddConstantCpuKernel(context)[source]
Bases:
CpuKernelAdd a scalar constant to the input payload.
Store the additive constant after validation.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Require a numeric constant and matching stream metadata.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.AffineTransformCpuKernel(context)[source]
Bases:
CpuKernelApply an affine transform y = A x + b to a vector input.
Cache auxiliary aliases used on every compute call.
- classmethod validate_config(config, shared_memory)[source]
Validate vector, matrix, offset, and output compatibility.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.FlattenCpuKernel(context)[source]
Bases:
CpuKernelFlatten any CPU array into a contiguous 1D vector.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Require the output vector to match the flattened input size.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.CopyCpuKernel(context)[source]
Bases:
CpuKernelCopy one CPU shared-memory payload into another.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Require matching input and output stream metadata.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.CpuKernel(context)[source]
Bases:
KernelBase class for CPU shared-memory kernels.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- class shmpipeline.kernels.cpu.CustomOperationCpuKernel(context)[source]
Bases:
CpuKernelFuse a restricted arithmetic expression into one CPU kernel.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- auxiliary_arity: int | None = None
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.ElementwiseAddCpuKernel(context)[source]
Bases:
CpuKernelCompute output = input + auxiliary elementwise.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.ElementwiseDivideCpuKernel(context)[source]
Bases:
CpuKernelCompute output = input / auxiliary elementwise.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.ElementwiseMultiplyCpuKernel(context)[source]
Bases:
CpuKernelCompute output = input * auxiliary elementwise.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.ElementwiseSubtractCpuKernel(context)[source]
Bases:
CpuKernelCompute output = input - auxiliary elementwise.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.LeakyIntegratorCpuKernel(context)[source]
Bases:
CpuKernelApply the control law u_k = leak * u_{k-1} + gain * e_k.
Store the leak, gain, and persistent controller state.
- classmethod validate_config(config, shared_memory)[source]
Require vector-compatible streams and numeric leak/gain.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.RaiseErrorCpuKernel(context)[source]
Bases:
CpuKernelRaise a configured error to exercise worker supervision paths.
Store validated kernel context and normalized parameters.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Require a non-empty error message.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.ScaleCpuKernel(context)[source]
Bases:
CpuKernelMultiply the input payload by a constant factor.
Store the scale factor after validation.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Require a numeric factor and matching stream metadata.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.ScaleOffsetCpuKernel(context)[source]
Bases:
CpuKernelApply output = gain * input - offset elementwise.
Store the configured scalar gain.
- classmethod validate_config(config, shared_memory)[source]
Require matching input, offset, and output shapes/dtypes.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.cpu.ShackHartmannCentroidCpuKernel(context)[source]
Bases:
CpuKernelCompute local centroids for a tiled Shack-Hartmann sensor image.
The output shape is (rows, cols, 2) where the last axis stores [delta_row, delta_col] relative to each tile center.
Store the subaperture tile size.
- classmethod validate_config(config, shared_memory)[source]
Require compatible image and centroid-output geometry.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
GPU Kernels
GPU kernel implementations.
- class shmpipeline.kernels.gpu.AddConstantGpuKernel(context)[source]
Bases:
GpuKernelAdd a scalar constant to the input payload.
Allocate the reusable output buffer directly on the target GPU.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.AffineTransformGpuKernel(context)[source]
Bases:
GpuKernelApply an affine transform y = A x + b to a vector input.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.CopyGpuKernel(context)[source]
Bases:
GpuKernelCopy one GPU shared-memory payload into another.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.CustomOperationGpuKernel(context)[source]
Bases:
GpuKernelFuse a restricted arithmetic expression into one GPU kernel.
Allocate the reusable output buffer directly on the target GPU.
- Parameters:
context (KernelContext)
- auxiliary_arity: int | None = None
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.ElementwiseAddGpuKernel(context)[source]
Bases:
GpuKernelCompute output = input + auxiliary elementwise.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.ElementwiseDivideGpuKernel(context)[source]
Bases:
GpuKernelCompute output = input / auxiliary elementwise.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.ElementwiseMultiplyGpuKernel(context)[source]
Bases:
GpuKernelCompute output = input * auxiliary elementwise.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.ElementwiseSubtractGpuKernel(context)[source]
Bases:
GpuKernelCompute output = input - auxiliary elementwise.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.FlattenGpuKernel(context)[source]
Bases:
GpuKernelFlatten any GPU array into a contiguous 1D vector.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.GpuKernel(context)[source]
Bases:
KernelBase class for GPU shared-memory kernels.
Allocate the reusable output buffer directly on the target GPU.
- class shmpipeline.kernels.gpu.LeakyIntegratorGpuKernel(context)[source]
Bases:
GpuKernelApply the control law u_k = leak * u_{k-1} + gain * e_k.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.RaiseErrorGpuKernel(context)[source]
Bases:
GpuKernelRaise a configured error to exercise worker supervision paths.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.ScaleGpuKernel(context)[source]
Bases:
GpuKernelMultiply the input payload by a constant factor.
Allocate the reusable output buffer directly on the target GPU.
- Parameters:
context (KernelContext)
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.ScaleOffsetGpuKernel(context)[source]
Bases:
GpuKernelApply output = gain * input - offset elementwise.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None
- class shmpipeline.kernels.gpu.ShackHartmannCentroidGpuKernel(context)[source]
Bases:
GpuKernelCompute local centroids for a tiled Shack-Hartmann sensor image.
Allocate the reusable output buffer directly on the target GPU.
- classmethod validate_config(config, shared_memory)[source]
Validate arity and storage constraints before build.
- Parameters:
config (KernelConfig)
shared_memory (Mapping[str, SharedMemoryConfig])
- Return type:
None