Skip to main content

FusedOps

Struct FusedOps 

Source
pub struct FusedOps;
Expand description

Associated constants for the well-known fused-op ids. Rule code matches Op::Fused(FusedOps::SOFTMAX_LAST_DIM, _) — almost as ergonomic as today’s Op::SoftmaxLastDim. Steps 3-4 fill these in as each fused op migrates to the registry.

Implementations§

Source§

impl FusedOps

Source

pub const SOFTMAX_LAST_DIM: FusedOpId

SoftmaxLastDim — proof-of-concept migration target (step 3).

Source

pub const FUSED_LINEAR: FusedOpId

FusedLinear — first multi-input fused op migrated to the registry (step 4). Three inputs [a, b, bias], output (a @ b) + bias. The CUTLASS bias-epilogue integration in the baracuda-cutlass alpha.13 plan registers here.

Source

pub const RMS_NORM_LAST_DIM: FusedOpId

RmsNormLastDim — x / sqrt(mean(x²) + eps) along the last dim. Migrated in step 4 (continued). Single input + eps param.

Source

pub const LAYER_NORM_LAST_DIM: FusedOpId

LayerNormLastDim — (x - mean) / sqrt(var + eps) along the last dim (no affine). Single input + eps param.

Source

pub const ROPE: FusedOpId

Rope — rotary position embedding with caller-supplied cos/sin tables. Three inputs [x, cos, sin], parameterless (the seq/ head_dim shape parameters live in the input shapes).

Source

pub const CONV2D: FusedOpId

Conv2D — 2-D cross-correlation. Two or three inputs [x, weight] or [x, weight, bias]; carries stride / padding / groups in FusedOpParams::Conv2D.

Source

pub const SOFTMAX_LAST_DIM_BACKWARD: FusedOpId

SoftmaxLastDimBackward — fused backward helper for the SoftmaxLastDim forward. Two inputs [y, upstream], parameterless. Wired through BackwardKind::Fused from SOFTMAX_LAST_DIM’s entry.

Source

pub const LAYER_NORM_LAST_DIM_BACKWARD: FusedOpId

LayerNormLastDimBackward — fused backward helper for the LayerNormLastDim forward. Two inputs [x, upstream] + eps.

Source

pub const RMS_NORM_LAST_DIM_BACKWARD: FusedOpId

RmsNormLastDimBackward — fused backward helper for the RmsNormLastDim forward. Two inputs [x, upstream] + eps.

Source

pub const REDUCE_MAX_TO_BACKWARD: FusedOpId

ReduceMaxToBackward — fused backward helper for the Op::ReduceMaxTo primitive (routes upstream to argmax positions, fair-share on ties). Two inputs [x, upstream], parameterless. Note this is the backward of a primitive (Op::ReduceMaxTo), not of a fused forward — there’s no BackwardKind::Fused edge wired to this helper, autograd reaches it directly from Op::ReduceMaxTo’s arm.

Source

pub const CONV_TRANSPOSE2D: FusedOpId

ConvTranspose2D — fractionally-strided 2-D convolution. Two inputs [x, weight] (no bias); carries stride/padding/output_padding/dilation/groups in FusedOpParams::ConvTranspose2D.

Source

pub const FLASH_ATTN: FusedOpId

FlashAttn — multi-head attention with FlashAttention-shaped kernel hooks. 4-5 inputs (q, k, v, optional alibi).

Source

pub const PAGED_ATTN: FusedOpId

PagedAttn — paged-cache attention. 5-6 inputs.

Source

pub const QMATMUL: FusedOpId

QMatMul — quantized matmul C = A @ dequant(W_Q). Two inputs [a, w_q_bytes].

Source

pub const POWI_BACKWARD: FusedOpId

PowIBackward — fused backward helper for Op::PowI(n). grad_x = n · x^(n-1) · upstream. Two inputs [x, upstream], carries exp: i32 in FusedOpParams::PowIBackward. Replaces the autograd primitive decomposition (PowI(n-1) → MulScalar → Mul, 3 nodes) with a single launch of baracuda alpha.31’s unary_powi_backward_* kernel. Note this is the backward of a primitive (Op::PowI), not of a fused forward — autograd reaches it directly from Op::PowI’s arm rather than via a BackwardKind::Fused edge.

Source

pub const INPLACE_AFFINE: FusedOpId

In-place affine: x = mul·x + add. Single input (the mutated tensor), single launch into baracuda’s affine_inplace_* symbol on CUDA. Carries mul: f64, add: f64 in FusedOpParams::InplaceAffine. Marked destructive on input 0 via Op::destructive_input, so opt::derive_ordering pins it to run after every non-destructive reader. Phase 1 of the in-place ops infrastructure (docs/session-prompts/in-place-ops-infrastructure.md); dispatch + autograd integration deferred to Phases 3 + 4.

Source

pub const FUSED_SOFTMAX_CROSS_ENTROPY: FusedOpId

FusedSoftmaxCrossEntropy — fused softmax + NLL over class-indexed targets. Two inputs [logits, targets]; carries { reduction, ignore_index } in FusedOpParams::FusedSoftmaxCrossEntropy. The forward kernel avoids materializing the [..., V] softmax/log-softmax intermediates that the primitive composition does (fuel-core:: train::cross_entropy_with_logits). Backward via Decompose runs the primitive chain; the in-place Liger-style fused backward is a later session (needs in-place mutation infrastructure).

Source

pub const CAUSAL_CONV1D: FusedOpId

CausalConv1d — depthwise 1-D convolution + causal masking + optional fused SiLU. Three inputs [x, weight, bias] where x: [batch, channels, seq + kernel - 1], weight: [channels, 1, kernel], bias: [channels]. Carries use_silu: bool in FusedOpParams::CausalConv1d. The forward kernel matches baracuda’s causal_conv1d_*_run contract. BackwardKind::NotDifferentiable for v1 (Mamba inference path today is inference-only).

Source

pub const SELECTIVE_SCAN: FusedOpId

SelectiveScan — Mamba-1’s selective state-space scan (forward only). Five inputs [u, delta, a, b, c]; one output y: [batch, seqlen, dim]. Carries delta_softplus: bool in FusedOpParams::SelectiveScan. v1 drops the optional inputs (d_skip, z, delta_bias) and the last_state second output — both are mechanical follow-ups when a consumer needs them. BackwardKind::NotDifferentiable for v1.

Source

pub const SSD_CHUNK_SCAN: FusedOpId

SsdChunkScan — Mamba-2’s State-Space Duality chunked scan (forward only). Five inputs [x, dt, a, b, c]; one output y: [batch, seqlen, heads, head_dim]. Carries chunk_size: usize in FusedOpParams::SsdChunkScan (parallelism granularity for the GPU path; the CPU kernel runs sequential and any positive chunk_size dividing seqlen produces the same mathematical answer). BackwardKind::NotDifferentiable for v1.

Source

pub const NF4_MATMUL: FusedOpId

Nf4Matmul — bitsandbytes-style 4-bit NormalFloat quantized matrix multiply. Three inputs [activations, w_packed, absmax] where w_packed: [N, K/2] U8 and absmax: [N, K/block_size] F32. Output [..., M, N] matching activations’ dtype (F32/F16/BF16 in v1). Carries block_size: usize in FusedOpParams::Nf4Matmul. BackwardKind::NotDifferentiable (NF4 weights are frozen; the dequant-then-matmul fallback is the wrong path for the cases NF4 exists to optimize).

Source

pub const FLASH_ATTN_BACKWARD_Q: FusedOpId

FlashAttnBackwardQ — produces dQ from (q, k, v, do, [alibi]). See fuel_ir::dispatch::OpKind::FlashAttnBackwardQ. Three separate FusedOp ids (Q/K/V) is the v1 design — a single multi-output op would share the recompute pass across all three gradients but needs multi-output infrastructure that doesn’t exist yet. Reuses FusedOpParams::FlashAttnBackward.

Source

pub const FLASH_ATTN_BACKWARD_K: FusedOpId

FlashAttnBackwardK — produces dK. See Self::FLASH_ATTN_BACKWARD_Q.

Source

pub const FLASH_ATTN_BACKWARD_V: FusedOpId

FlashAttnBackwardV — produces dV. See Self::FLASH_ATTN_BACKWARD_Q.

Source

pub const AWQ_MATMUL: FusedOpId

AwqMatmul — AWQ (mit-han-lab) asymmetric int4 weight-only matmul. Four inputs [activations, weight, zeros, scales] (one more than NF4’s three — AWQ’s zero-point is a fourth operand, not baked into the dequant like NF4’s codebook) where weight: [N, K/8] U32, zeros: [N, zeros_w] U32, scales: [N, 8 * zeros_w] F16 — the baracuda kernel layout. Output [..., M, N] matching activations’ dtype (F32/F16/BF16 in v1). Carries { group_size, split_k_iters } in FusedOpParams::AwqMatmul. BackwardKind::Decompose (the weight is frozen; the activation gradient flows through the decompose). Unlike NF4 (a non-linear codebook with no primitive spelling), AWQ’s affine dequant decomposes cleanly into primitives — see the module doc on crate::registry::awq_matmul for the recipe.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V