DFlashLevers

Struct DFlashLevers 

Source
pub struct DFlashLevers {
Show 30 fields pub any_diagnostic_armed: bool, pub debug_dump: bool, pub debug_dump_full: bool, pub log_drafts: bool, pub block_dump: bool, pub block_dump_at_pos: usize, pub option_b_diag: bool, pub force_pattern: bool, pub force_noise_pattern: bool, pub force_no_ctx: bool, pub force_ctx_used: Option<usize>, pub precompute: bool, pub precompute_commit: bool, pub propose_warmup_n: usize, pub option_b: bool, pub option_b_no_ctx: bool, pub dflash2: bool, pub batch_propose_width: usize, pub draft_cap: Option<usize>, pub verify_trace: bool, pub precompute_dump: bool, pub ctx_parity_dump: bool, pub no_decode_append: bool, pub full_precompute: bool, pub ctxlen_probe: bool, pub dspark_markov: bool, pub conf_tau: f32, pub dspark_shift: Option<bool>, pub dspark_anchor_bias: bool, pub dspark_conf_trace: bool,
}
Expand description

Diagnostic and A/B levers for one loaded DFlash drafter.

Plain Copy data. Every field is a pure function of one ATLAS_* variable except Self::any_diagnostic_armed, which is a function of eleven of them.

Fields§

§any_diagnostic_armed: bool

Any of the eleven diagnostic variables is SET, at any value.

This is the CUDA-graph kill switch: a diagnostic that dumps or logs from inside the captured region would be captured with it and then replayed silently, so an armed diagnostic forces the eager path.

★ Presence, not truth — ATLAS_DFLASH_BLOCK_DUMP=0 suppresses graph capture while enabling no dump at all. That is the shipped behaviour (the chain this replaces tested std::env::var(..).is_err()), and it is pinned by a test rather than quietly fixed: the variables are operator-facing A/B switches, and a graph capture that appears only when a flag is spelled a particular way is a worse surprise than an over-eager kill switch.

One deliberate divergence from the is_err() chain this replaces: it tested std::env::var, which reports a NON-UTF-8 value as absent, so ATLAS_DFLASH_BLOCK_DUMP=<invalid utf-8> used to leave capture ON. This uses var_os, so such a value now suppresses capture — the same direction as every other spelling, and the same present idiom ModelLevers uses.

§debug_dump: bool

ATLAS_DFLASH_DEBUG_DUMP=1 — first 10 BF16 floats of each key intermediate, for element-wise comparison against a Python reference.

§debug_dump_full: bool

ATLAS_DFLASH_DEBUG_DUMP_FULL=1 — full tensors, not the first 10.

§log_drafts: bool

ATLAS_DFLASH_LOG_DRAFTS=1 — log the γ drafts each propose returns.

§block_dump: bool

ATLAS_DFLASH_BLOCK_DUMP=1 — per-layer .bin dumps of the block inputs and every layer’s output.

§block_dump_at_pos: usize

ATLAS_DFLASH_BLOCK_DUMP_AT_POS=<n> — arm the block dump only at decode position ≥ n, so the dump can be taken in the regime where absolute positions have diverged from ctx slot indices. Default 0 (dump at the first propose).

§option_b_diag: bool

ATLAS_DFLASH_OPTION_B_DIAG=1 — read back layer 0’s first cached K/V row from the paged drafter cache.

§force_pattern: bool

ATLAS_DFLASH_DEBUG_FORCE_PATTERN=1 — overwrite the captured target hidden with a deterministic pattern the PyTorch reference also makes.

§force_noise_pattern: bool

ATLAS_DFLASH_DEBUG_FORCE_NOISE_PATTERN=1 — same, for the noise rows.

§force_no_ctx: bool

ATLAS_DFLASH_DEBUG_CTX_OFF=1 — drop ctx conditioning entirely (eff_ctx = 0), the A/B for whether the drafter responds to ctx.

§force_ctx_used: Option<usize>

ATLAS_DFLASH_DEBUG_CTX_USED=<n> — pin eff_ctx to exactly n.

§precompute: bool

ATLAS_DFLASH_PRECOMPUTE=1 — run the ctx K/V precompute chain from forward_block (the production path runs it from propose).

§precompute_commit: bool

ATLAS_DFLASH_PRECOMPUTE_COMMIT=1 — let that diagnostic run write to the paged cache. Off by default because forward_block does not guarantee a valid block table.

§propose_warmup_n: usize

ATLAS_DFLASH_PROPOSE_WARMUP_N=<n> — eager warm-up passes before capture. Default 2: two passes warm the PTX→SASS cache, ramp GB10 clocks, and pull hot weight tiles into L2 before capture freezes the SASS variants the driver picked.

§option_b: bool

The Option-B paged drafter cache. Ships ON since the 54.5 record config (#649); ATLAS_DFLASH_OPTION_B=0 is the kill switch.

The POLARITY has already been flipped by accident once: a merge on 2026-08-30 turned != Some("0") into == Some("1"), and propose went 19.8 -> 618.7 ms (49.9 -> 5.5 tok/s) because the legacy path launches one dense_gemv per accumulated ctx row over a 262 MB fc weight. Nothing logged a change. Resolution goes through super::option_b_from so the predicate keeps its own tests.

Deliberately NOT an intra-doc link: option_b_from is pub(super), and rustdoc rejects a link from public documentation to a private item under this crate’s deny(warnings). Widening the function to pub to satisfy the link would export a predicate the module keeps internal on purpose — the wrong half of the trade.

§option_b_no_ctx: bool

ATLAS_DFLASH_OPTION_B_NO_CTX=1 — force ctx_count = 0 in the layer body so paged attention sees only the γ K/V written in-layer. If the accept rate is bad even here, the bug is in the cache write/read path rather than in precompute.

§dflash2: bool

The DFlash2 conv+selector path. Ships ON when the checkpoint carries the components; ATLAS_DFLASH2=0 disables.

§batch_propose_width: usize

ATLAS_DFLASH_BATCH_PROPOSE=<width> caps the cross-sequence batch. usize::MAX (unset) means “as wide as the scratch bands allow”; 1 or 0 restores the per-sequence loop. Numeric rather than boolean because bisecting the WIDTH against acceptance is what localises a banding bug — “correct at 2 bands, wrong at 4” found the lm_head tile bound, and an on/off flag cannot ask that question.

§draft_cap: Option<usize>

ATLAS_DFLASH_DRAFT_CAP=<n> — submit at most n drafts per propose. None means the head’s own γ.

§verify_trace: bool

ATLAS_DFLASH_VERIFY_TRACE=1 — log all γ drafts BEFORE the cap, so an echo at position 0 can be told from an echo on every noise row.

§precompute_dump: bool

ATLAS_DFLASH_PRECOMPUTE_DUMP=1 — one-shot dump of the fused ctx K/V GEMM inputs and outputs.

§ctx_parity_dump: bool

ATLAS_DFLASH_CTX_PARITY_DUMP=1 — one-shot dump of the accumulated ctx hidden rows for a PyTorch parity diff.

§no_decode_append: bool

ATLAS_DFLASH_DEBUG_NO_DECODE_APPEND=1 — skip the post-decode ctx append entirely.

§full_precompute: bool

ATLAS_DFLASH_DEBUG_FULL_PRECOMPUTE=1 — recompute the whole ctx prefix each step (committed = 0) instead of the incremental watermark path, for accept-rate parity A/B. O(ctx_len^2).

§ctxlen_probe: bool

ATLAS_DFLASH_CTXLEN_PROBE=1 — assert ctx_positions is strictly increasing, and log ctx_len against position every 16 steps. Both probes are host-side scans, so they stay behind one flag.

§dspark_markov: bool

The sequential Markov fixup. Ships ON when the drafter carries the head; ATLAS_DSPARK_MARKOV=0 degrades to the batched argmax path bit-for-bit.

§conf_tau: f32

ATLAS_DSPARK_CONF_TAU=<t> — sigmoid-space acceptance threshold for the confidence head. 0.0 (unset) disables the head entirely, matching the reference’s threshold <= 0.0 -> full block.

§dspark_shift: Option<bool>

ATLAS_DSPARK_SHIFT=1|0 forces the SpecForge shifted-row convention on or off; unset (None) defers to the drafter config.

§dspark_anchor_bias: bool

Row 0 carries the Markov anchor bias. Ships ON; ATLAS_DSPARK_ANCHOR_BIAS=0 exempts it. Confidence truncation reads this too — rows without the chain never write their confidence slot.

§dspark_conf_trace: bool

ATLAS_DSPARK_CONF_TRACE=1 — log the confidence logits and sigmoids.

Implementations§

Source§

impl DFlashLevers

Source

pub fn from_env() -> Self

Resolve from the environment. Called ONCE, when the head is built.

★ Do not call this from forward_block, propose, or anything they reach. Take self.levers from the head instead — that is why the field exists, and dflash_levers_are_resolved_once fails the build if a raw std::env::var reappears on those paths.

Source

pub fn defaults() -> Self

What a head resolves to with no ATLAS_* set: every diagnostic off, the anchor bias on, two warm-up passes. Tests construct this rather than mutating the process environment, which set_var makes unsafe and which would race every other test in the binary.

Source

pub fn block_dump_armed_at(&self, position: usize) -> bool

The block dump is armed for this decode position.

Three sites asked this question with two env reads each; it is one predicate over already-resolved data.

Trait Implementations§

Source§

impl Clone for DFlashLevers

Source§

fn clone(&self) -> DFlashLevers

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for DFlashLevers

Source§

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

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

impl Default for DFlashLevers

Source§

fn default() -> DFlashLevers

Returns the “default value” for a type. Read more
Source§

impl PartialEq for DFlashLevers

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for DFlashLevers

Source§

impl StructuralPartialEq for DFlashLevers

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<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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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

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

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

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