| |
| |
| |
| |
|
|
| #ifndef FSL_TYPES |
| #define FSL_TYPES |
|
|
| include "mlir/IR/AttrTypeBase.td" |
| include "mlir/IR/BuiltinTypeInterfaces.td" |
|
|
| |
| |
| |
|
|
| def FSL_StateVectorType : TypeDef<"FSL", "StateVector"> { |
| let mnemonic = "statevector"; |
| let parameters = (ins |
| "int64_t":$dim |
| ); |
| let summary = "SSM state vector (continuous evolution)"; |
| let description = [{ |
| Represents the continuous state of a state-space model. |
|
|
| The dimension is fixed at construction (from YAML d_state). |
| State vectors evolve via the Mamba step recurrence: |
| s_{t+1} = A * s_t + B * u_t |
|
|
| State vectors are consumed by MambaStepOp and cannot be |
| cloned or reused without explicit copy. |
| }]; |
| } |
|
|
| |
| |
| |
|
|
| def FSL_TokenVectorType : TypeDef<"FSL", "TokenVector"> { |
| let mnemonic = "tokenvector"; |
| let parameters = (ins |
| "int64_t":$dim |
| ); |
| let summary = "Input token vector (discrete input)"; |
| let description = [{ |
| Represents a discrete input token to the Mamba layer. |
|
|
| The dimension is fixed at construction (from YAML d_model). |
| Tokens are processed through depthwise convolution and |
| selectivity gating before entering the SSM. |
| }]; |
| } |
|
|
| |
| |
| |
|
|
| def FSL_SSMMatricesType : TypeDef<"FSL", "SSMMatrices"> { |
| let mnemonic = "ssmmatrices"; |
| let parameters = (ins |
| "int64_t":$state_dim, |
| "int64_t":$model_dim, |
| "int64_t":$conv_width, |
| "int64_t":$rank |
| ); |
| let summary = "Pre-allocated SSM parameter storage"; |
| let description = [{ |
| Stores the learnable parameters for the selective Mamba step: |
| - A_log: [n] log-space diagonal matrix |
| - B: [n x m] input matrix (or low-rank factors) |
| - W_conv: [m x d_c] depthwise conv kernel |
| - V, U: [m x m] gating projections (for selectivity) |
| |
| This type bundles all parameters to enable efficient |
| memory management and hardware-specific layout optimization. |
| }]; |
| } |
|
|
| |
| |
| |
|
|
| def FSL_FSMStateType : TypeDef<"FSL", "FSMState"> { |
| let mnemonic = "fsmstate"; |
| let parameters = (ins |
| "StringAttr":$label |
| ); |
| let summary = "Finite state machine state identifier"; |
| let description = [{ |
| Identifies a discrete state in the FSL finite state machine. |
|
|
| FSM states trigger different actions (e.g., mamba_step, |
| output_projection) and transitions are guarded by conditions |
| on the continuous SSM state. |
| |
| Example FSM from YAML: |
| S0_IDLE: scan_complete β S1_EMIT |
| S1_EMIT: output_complete β S0_IDLE |
| }]; |
| } |
|
|
| |
| |
| |
|
|
| def FSL_FSMTransitionType : TypeDef<"FSL", "FSMTransition"> { |
| let mnemonic = "fsmtransition"; |
| let parameters = (ins |
| "FSL_FSMStateType":$from_state, |
| "FSL_FSMStateType":$to_state, |
| "StringAttr":$condition |
| ); |
| let summary = "Finite state machine transition"; |
| let description = [{ |
| Defines a transition from one FSM state to another, |
| guarded by a boolean condition on the SSM state. |
|
|
| The condition is evaluated as a function of the SSM state: |
| condition(s) = ||s||_2 > theta (threshold-based) |
| condition(s) = classifier(s) (learned) |
| }]; |
| } |
|
|
| #endif // FSL_TYPES |
|
|