Class DecodeForwardProfile
java.lang.Object
smile.llm.engine.DecodeForwardProfile
Optional decode-forward phase timers (attn / DeltaNet / MLP / NCCL).
Enable with SMILE_DECODE_PROFILE=1. Each TP rank accumulates on its
worker thread; Qwen merges the max across ranks
into DecodeStepTiming (NCCL barriers make wall times a reasonable
proxy for GPU work between all-reduces).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classPer-thread / per-rank nanosecond accumulators. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddDeltaConv(long ns) DeltaNet: causal conv1d update / prefill.static voidaddDeltaGate(long ns) DeltaNet: beta/sigmoid + softplus gateg.static voidaddDeltaOut(long ns) DeltaNet: RMSNorm-gated + out projection.static voidaddDeltaProj(long ns) DeltaNet: input projections (qkv/z/b/a).static voidaddDeltaRecurrent(long ns) DeltaNet: recurrent gated-delta rule (native or Java).static voidaddEmbed(long ns) Adds embedding time on the current TP worker thread.static voidaddFullAttn(long ns) Adds full-attention mixer time (excluding the trailing all-reduce).static voidaddLinearAttn(long ns) Adds DeltaNet / linear-attention mixer time (excluding all-reduce).static voidaddLmHead(long ns) Adds final norm + lm_head time.static voidaddMlp(long ns) Adds MLP time (excluding the trailing all-reduce).static voidaddNccl(long ns) Adds NCCL / TP all-reduce wall time.static booleanenabled()Returns whether detailed decode phase timing is enabled.Returns the current thread's accumulators and resets them for the next forward.
-
Method Details
-
enabled
public static boolean enabled()Returns whether detailed decode phase timing is enabled.- Returns:
truewhen detailed decode phase timing is enabled.
-
addEmbed
public static void addEmbed(long ns) Adds embedding time on the current TP worker thread.- Parameters:
ns- elapsed nanoseconds to add.
-
addFullAttn
public static void addFullAttn(long ns) Adds full-attention mixer time (excluding the trailing all-reduce).- Parameters:
ns- elapsed nanoseconds to add.
-
addLinearAttn
public static void addLinearAttn(long ns) Adds DeltaNet / linear-attention mixer time (excluding all-reduce).- Parameters:
ns- elapsed nanoseconds to add.
-
addMlp
public static void addMlp(long ns) Adds MLP time (excluding the trailing all-reduce).- Parameters:
ns- elapsed nanoseconds to add.
-
addNccl
public static void addNccl(long ns) Adds NCCL / TP all-reduce wall time.- Parameters:
ns- elapsed nanoseconds to add.
-
addLmHead
public static void addLmHead(long ns) Adds final norm + lm_head time.- Parameters:
ns- elapsed nanoseconds to add.
-
addDeltaProj
public static void addDeltaProj(long ns) DeltaNet: input projections (qkv/z/b/a).- Parameters:
ns- elapsed nanoseconds to add.
-
addDeltaConv
public static void addDeltaConv(long ns) DeltaNet: causal conv1d update / prefill.- Parameters:
ns- elapsed nanoseconds to add.
-
addDeltaGate
public static void addDeltaGate(long ns) DeltaNet: beta/sigmoid + softplus gateg.- Parameters:
ns- elapsed nanoseconds to add.
-
addDeltaRecurrent
public static void addDeltaRecurrent(long ns) DeltaNet: recurrent gated-delta rule (native or Java).- Parameters:
ns- elapsed nanoseconds to add.
-
addDeltaOut
public static void addDeltaOut(long ns) DeltaNet: RMSNorm-gated + out projection.- Parameters:
ns- elapsed nanoseconds to add.
-
snapshotAndReset
Returns the current thread's accumulators and resets them for the next forward. Call from the TP worker afterforwardreturns.- Returns:
- snapshot of accumulators, or
nullwhen profiling is off.
-