Skip to main content

OpSpec

Enum OpSpec 

Source
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

Source

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.

Source

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.

Source

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.

Source

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.

Source

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).

Source

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").

Source

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.

Source

pub fn query( &self, db: &PerfDatabase, ctx: &RuntimeContext, ) -> Result<PerformanceResult, AicError>

Query this op with the given runtime. Returns the scaled latency from the underlying op’s query method.

Trait Implementations§

Source§

impl Clone for Op

Source§

fn clone(&self) -> Op

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Op

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Op

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Op

Source§

fn eq(&self, other: &Op) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Op

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Op

Auto Trait Implementations§

§

impl Freeze for Op

§

impl RefUnwindSafe for Op

§

impl Send for Op

§

impl Sync for Op

§

impl Unpin for Op

§

impl UnsafeUnpin for Op

§

impl UnwindSafe for Op

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more