pub enum OpSpec {
Show 35 variants
Gemm(GemmOp),
Embedding(EmbeddingOp),
Elementwise(ElementwiseOp),
ContextAttention(ContextAttentionOp),
GenerationAttention(GenerationAttentionOp),
EncoderAttention(EncoderAttentionOp),
ContextMla(ContextMlaOp),
GenerationMla(GenerationMlaOp),
MlaModuleContext(MlaModuleOp),
MlaModuleGeneration(MlaModuleOp),
MlaBmm(MlaBmmOp),
Moe(MoeOp),
MoeDispatch(MoEDispatchOp),
CustomAllReduce(CustomAllReduceOp),
Nccl(NcclOp),
P2P(P2POp),
Vision(VisionEncoderOp),
DsaContext(DsaModuleOp),
DsaGeneration(DsaModuleOp),
MsaContext(MsaModuleOp),
MsaGeneration(MsaModuleOp),
Dsv4Context(Dsv4ModuleOp),
Dsv4Generation(Dsv4ModuleOp),
Mhc(MhcModuleOp),
Mamba2(Mamba2Op),
Gdn(GdnOp),
WideEpContextMla(WideEpContextMlaOp),
WideEpGenerationMla(WideEpGenerationMlaOp),
Overlap(OverlapOp),
Fallback(FallbackOp),
Dsv4MegaMoe(Dsv4MegaMoeOp),
Kda(KdaOp),
FpmForward(FpmForwardOp),
MoeAllToAll(MoeAllToAllOp),
MoeExpertCompute(MoeExpertComputeOp),
}Expand description
Public name for the serializable op. Aliases the crate’s [Op] enum so
the “OpSpec” surface exists without duplicating the definition.
Typed operator. One variant per Python operations family.
Module-level ops with separate context/generation queries become distinct variants so dispatch is unambiguous.
Serializes as the wire-format op for crate::perfmodel::engine::spec::EngineSpec
(re-exported there as OpSpec). All config-time fields are plain
serializable data, so the enum and its recursive Overlap/Fallback
children round-trip through bincode.
Op::Vision is part of the shared session path and derives serde with
the rest, but it is never emitted into a compiled EngineSpec:
compile_engine decomposes the vision encoder into its child
Gemm/EncoderAttention/Elementwise ops instead.
Production specs therefore never contain a Vision variant.
Variants§
Gemm(GemmOp)
Embedding(EmbeddingOp)
Elementwise(ElementwiseOp)
ContextAttention(ContextAttentionOp)
GenerationAttention(GenerationAttentionOp)
EncoderAttention(EncoderAttentionOp)
ContextMla(ContextMlaOp)
GenerationMla(GenerationMlaOp)
MlaModuleContext(MlaModuleOp)
MlaModuleGeneration(MlaModuleOp)
MlaBmm(MlaBmmOp)
Moe(MoeOp)
MoeDispatch(MoEDispatchOp)
CustomAllReduce(CustomAllReduceOp)
Nccl(NcclOp)
P2P(P2POp)
Vision(VisionEncoderOp)
DsaContext(DsaModuleOp)
DsaGeneration(DsaModuleOp)
MsaContext(MsaModuleOp)
MiniMax Sparse Attention (MSA) context module — no silicon data; answers only under HYBRID/EMPIRICAL via cross-op DSA util transfer.
MsaGeneration(MsaModuleOp)
MSA generation module (s = total KV length).
Dsv4Context(Dsv4ModuleOp)
Dsv4Generation(Dsv4ModuleOp)
Mhc(MhcModuleOp)
Mamba2(Mamba2Op)
Gdn(GdnOp)
WideEpContextMla(WideEpContextMlaOp)
SGLang WideEP context MLA — replaces ContextMlaOp in the
WideEPDeepSeekModel variant. SGLang-only perf data.
WideEpGenerationMla(WideEpGenerationMlaOp)
SGLang WideEP generation MLA — replaces GenerationMlaOp in the
WideEPDeepSeekModel variant.
Overlap(OverlapOp)
Two op groups that execute in parallel on different CUDA streams.
Mirrors Python aiconfigurator.sdk.operations.overlap.OverlapOp:
latency = max(sum(group_a), sum(group_b)).
Fallback(FallbackOp)
Try a primary op; on perf-DB miss, fall back to summing a list of
granular ops. Mirrors Python
aiconfigurator.sdk.operations.overlap.FallbackOp: supports the
transitional state where some systems have module-level profiling
data and others still ship per-kernel granular data.
Dsv4MegaMoe(Dsv4MegaMoeOp)
SGLang DeepSeek-V4 MegaMoE routed module (Python
DeepSeekV4MegaMoEModule): one variant for both phases — the op’s
is_context field selects the phase inside the unified table.
Measured-SILICON-only; see operators/dsv4.rs::Dsv4MegaMoeOp.
APPENDED after Fallback on purpose: bincode enum indices are
positional, so appending does not shift existing variants and
ENGINE_SPEC_SCHEMA_VERSION stays unchanged. Do NOT insert new
variants mid-enum.
Kda(KdaOp)
Kimi Delta Attention (KDA) kernel for Kimi-K3 linear_attention
layers — Python KDAKernel (a GDNKernel subclass with a distinct
kda_perf table, an fp32-state SOL byte model, a “verify” phase and
a draft_tokens field). APPENDED at the end (see the bincode note on
Dsv4MegaMoe); the new serialized variant bumped
ENGINE_SPEC_SCHEMA_VERSION to 5 (renumbered to 6 at its merge).
FpmForward(FpmForwardOp)
Whole-model forward pass (Python forward_model="fpm"): with the FPM
rewrite each phase op list is exactly one of these, answering from the
collected fpm_forward_perf cells instead of a granular composition.
NOT related to the crate::fpm (ForwardPassPerfModel) module.
APPENDED at the end (see the bincode note on Dsv4MegaMoe); claimed
ENGINE_SPEC_SCHEMA_VERSION 5 concurrently with #1460/#1435 and was
renumbered to 9 across the intervening wire-format landings.
MoeAllToAll(MoeAllToAllOp)
Unified large-EP MoE all-to-all comm phase (Python
operations.moe_comm.MoEAllToAll) — one variant serves every backend
and every phase; the op’s phase / comm_backend fields select the
slice. Measured-SILICON-only; see operators/moe_a2a.rs.
APPENDED after FpmForward — same positional-index rule as above.
MoeExpertCompute(MoeExpertComputeOp)
Unified large-EP MoE expert compute (Python
operations.moe_comm.MoEExpertCompute) — one variant for both inference phases;
the op’s inference_phase field selects the slice.
Measured-SILICON-only; see operators/moe_expert_compute.rs.
Implementations§
Source§impl Op
impl Op
Sourcepub fn weight_bytes(&self) -> f64
pub fn weight_bytes(&self) -> f64
Constant per-op weight bytes (PR-6): the engine-side replacement for
Python’s Operation.get_weights math. Structural, not data-driven —
computed from op fields alone, never from perf tables. Ops with no
resident weights (attention/MLA kernels — their weights live on the
adjacent GEMMs — comm ops, dispatch, elementwise, MSA, the mamba
KERNEL ops) are 0.0, exactly like their Python _weights = 0.0.
FpmForward carries its snapshot verbatim (Python returns
_weight_bytes WITHOUT the scale_factor multiply); every non-zero
family multiplies its own scale_factor inside its weight_bytes.
Sourcepub fn name(&self) -> &str
pub fn name(&self) -> &str
Stable op name (Python op._name). Used by session code to filter
(e.g. context-attention exclusion in mix-step composition) and for
debugging.
Sourcepub fn set_name(&mut self, name: String)
pub fn set_name(&mut self, name: String)
Rename the op (Python’s post-construction op._name = ... rewiring:
hybrid layer-type prefixes rename block ops after the shared builder
returns them). Every variant carries name.
Sourcepub fn seq_split(&self) -> u32
pub fn seq_split(&self) -> u32
CP sequence-shard factor for the token-major families that carry one;
1 for every other variant (their constructors’ CP audit gate refuses
seq_split > 1, so 1 is exact, not a guess). Backs the Python-side
Operation._seq_split default read.
Sourcepub fn is_context_attention(&self) -> bool
pub fn is_context_attention(&self) -> bool
True if this op’s name matches Python’s mix-step filter for the
context-attention bucket. Python uses literal string equality on
"context_attention" — that’s the LLAMA / MOE attention op name.
Models with module-level attention (e.g. Kimi’s
context_mla_module) have names that don’t match this filter, so
they’re treated as non-attention in the mix-step composition
(matching Python’s intent: the module already represents the full
fused attention+projection work and shouldn’t be re-decomposed).
Sourcepub fn is_generation_attention(&self) -> bool
pub fn is_generation_attention(&self) -> bool
True if this op’s name matches Python’s mix-step filter for the
generation-attention bucket ("generation_attention").
Sourcepub fn is_logits_gemm(&self) -> bool
pub fn is_logits_gemm(&self) -> bool
Identifies the logits projection GEMM by name. Python special-cases
logits_gemm in _run_context_phase to use x=batch_size instead
of x=batch_size * effective_isl.