Repository navigation
Closed
Labels
component: kernelsTasks involving the development of CUDA and Triton underlying operatorsfeatureplatform: cudaSpecific optimizations or bugs in NVIDIA graphics cards (such as FlashInfer, TMA optimizations)priority: highSevere congestion issues require the highest priority for resolution.sprint-0615
Description
Part of WS1 — Full Batch-Invariant Forward Chain (epic: #)
Why
Pointwise ops (activations, residual adds, scaling) and RoPE are usually assumed "safe" because they have no cross-element reduction — but that assumption needs to be verified, not trusted. A stray fused reduction, a dtype downcast at the wrong point, or a position-dependent RoPE precision issue can quietly reintroduce drift between the residual stream of batch=1 and batch=N.
Scope
Audit every elementwise op and RoPE on the forward path and confirm they are genuine pass-throughs with respect to batch configuration.
- Enumerate the pointwise ops in the standard-Transformer forward path (activation, residual add, scaling, bias add, mask fill, dtype casts) and confirm none performs a batch-shape-dependent reduction.
- Confirm RoPE produces identical rotated Q/K for a given position regardless of batch size, position in batch, or padding (cos/sin precompute and application order fixed; table-lookup vs inline documented if both exist).
- Verify position-id handling, including packed-sequence position reset (coordinate with [FEAT][kernels]: implement Fused Masking and Variable-Length Sequence Packing (Pack-and-Pad) #42).
- Flag any op that silently changes dtype or accumulation based on tensor shape.
- Validate the audited ops against the [WS1] Ground-truth harness + numerical contract for batch-invariant ops #108 harness across the standard sweep.
Out of scope
- Rewriting ops that already pass — this is an audit; failed ops must be fixed here or linked to a blocking fix issue before this issue closes.
- RMSNorm, matmul, attention, logprob (covered by their own issues).
- FP8.
Acceptance criteria
- A short written audit lists each elementwise op + RoPE and its invariance verdict (pass / needs-fix).
- RoPE output is bitwise-identical for a fixed position across all batch configs in the sweep.
- Any op found to reintroduce drift is fixed here or linked to a blocking fix issue with a minimal repro against the harness; this audit does not close while known drift remains unresolved.
- Audited ops pass the [WS1] Ground-truth harness + numerical contract for batch-invariant ops #108 shared test helper; CI includes minimal RoPE + elementwise invariance tests.
Notes
- Depends on [WS1] Ground-truth harness + numerical contract for batch-invariant ops #108.
- Mostly verification rather than new kernels — but the RoPE precision/order check is the one with real risk; treat it as the priority within this issue.
- Padding-related position drift can silently corrupt attention; pay special attention to position ids.
Planned PRs
- Enumerate forward-path pointwise ops + RoPE; write audit doc with pass/needs-fix verdicts
- RoPE batch-invariance tests (fixed position -> identical rotated Q/K)
- Position-id / padding consistency tests (incl. packed sequences; coordinate with [FEAT][kernels]: implement Fused Masking and Variable-Length Sequence Packing (Pack-and-Pad) #42)
- Fix or link blocking fix issues for any drift found
- Wire audited ops through the [WS1] Ground-truth harness + numerical contract for batch-invariant ops #108 harness; add CI coverage
Metadata
Metadata
Assignees
Labels
component: kernelsTasks involving the development of CUDA and Triton underlying operatorsfeatureplatform: cudaSpecific optimizations or bugs in NVIDIA graphics cards (such as FlashInfer, TMA optimizations)priority: highSevere congestion issues require the highest priority for resolution.sprint-0615
Activity