← Back to Pull requests

Ifu dev 20260828 v2.19 #721

Closed
unknown closed this pull request without merging on Oct 02, 2026 03:50 UTC
View on GitHub
unknown unknown commented on Aug 28, 2026 21:01 UTC
Author

Description

Upstream changes from v2.18 to v2.19:

- NVFP4: row-scaled (per-token) backward for GroupedLinear, row-scaled transpose quantization in backward, arch-gated RHT path, stochastic-rounding fixes
- FP8 block scaling reaches the te.ops/fusible path; enabled for fusible ops and the GroupedLinear module
- Hybrid quantization: mixed-recipe support
- MXFP8 additions: 2D quantization, swizzled-scale fast path for cast-only, EP dispatch with unfused MXFP8, single-group grouped-MLP
- torch.compile: new TensorProto mechanism, traceable attention-backend selection (no graph breaks), UnfusedDotProductAttention + declarative packed
QKV/KV support
- Attention: FP8 + THD, THD with hierarchical context parallelism, D=256 cuDNN fused-attn backward on Blackwell, host-sync-free padding-mask build, and
return_max_logit from JAX fused attn
- New fused kernel: fused Q up-proj GEMM/RoPE/Quant, fused ScaledActivation for MoE (lower CPU overhead)
- Optimizer: newton_schulz_tp (Muon-style) step function
- Platform/infra: Rubin arch enablement, NVRTC runtime CUDA-header resolution, migration to NVIDIA/nccl-extensions

ROCm compatibility changes:

- Fused attention under activation recompute: forced non-reentrant checkpointing on ROCm in DotProductAttention; the ROCm FusedAttnFunc leaks its recompute subgraph
into the outer graph under reentrant recompute, double-calling the QKV LayerNormLinear backward, which the new v2.19 saved-tensor machinery (restore_from_func_ctx
nulls ctx.tensor_objects) turns from silent gradient double-counting into a crash
- FP8 block-scaling split accumulator in te.ops: modified the fusible BasicLinear/GroupedLinear fprop GEMMs to honor recipe.fp8_gemm_fprop.use_split_accumulator
instead of the hard-coded module default; ROCm's blockwise GEMM asserts a split accumulator, and this mirrors the (unguarded) module/ path
- NVFP4 row-scaled columnwise output: skipped the RHT columnwise/both-directions quantize tests on ROCm; row-scaled NVFP4 columnwise amax is unsupported on ROCm (guarded NVTE_ERROR in quantize.cuh)
- JAX fused-attn return_max_logit: threaded the flag through the backend-selection probe so the existing ROCm No_Backend skip fires; return_max_logit maps to
No_Backend on ROCm, which previously surfaced as an Unsupported backend= ValueError instead of a skip

Correctness follow-ups (issues currently masked by a workaround):

- Hybrid quantization on ROCm: HybridQuantizedTensor / CustomRecipe Float8Blockwise forward is not bitwise-identical to Float8BlockScaling; root cause is the hybrid GEMM-operand dispatch not routing to the ROCm blockwise GEMM path; currently two FSDP2 parity subtests are xfail-guarded on ROCm; enable proper hybrid-tensor operand/transpose selection so the two-format hybrid recipes match their vanilla equivalent
- CustomRecipe split-accumulator plumbing: CustomRecipe carries no fp8_gemm_fprop/fp8_gemm_dgrad/fp8_gemm_wgrad, so module/linear.py silently falls back to
use_split_accumulator=False; on ROCm the blockwise GEMM requires split accumulation; give CustomRecipe the MMParams fields (or force split-accum for blockwise
operands on ROCm) so custom/hybrid recipes get correct accumulation without relying on the base recipe's hardcoded True
- NVFP4 amax reduction on ROCm: multi-rank with_amax_reduction=True drives RCCL allreduce_coalesced on NVFP4 amax tensors to wrong values, giving scale_inv = max/0 =
inf then NaN loss (already xfail-guarded in test_fused_adam_regression); fix the RCCL amax-coalesced path so NVFP4 FSDP2 training is numerically stable

  • CPU activation offload + HIP-graph gradient corruption on ROCm: test_cpu_offloading.py::test_numerics with use_cuda_graphs=True + retain_pinned_cpu_buffers=True + transformer_layer returns a garbage-scale parameter gradient (abs ~70656, rel 1.0, ~97% mismatch), independent of quantization recipe (fails for bf16 too). The offload/reload copies into the retained pinned CPU buffer are synchronized with cross-stream events that aren't correctly ordered under HIP graph replay, so replay reads a stale buffer. Latent pre-existing bug, v2.18 compared parameter values (unchanged in one fwd/bwd); the v2.19 test rewrite added an exact param-grad check that exposed it. Non-graph offload is correct and stays asserted. Currently xfail-guarded on ROCm (IS_HIP_EXTENSION and use_cuda_graphs); fix the HIP-graph cross-stream ordering in cpu_offload.py (which today carries no ROCm guards).
  • Feature enablement follow-ups (unsupported features worked around this IFU):

    - NVFP4 row-scaled (RHT) columnwise output: the transpose/columnwise RHT path errors on ROCm and its exact-quantize tests are skipped; implement columnwise RHT so return_transpose=True is supported.
    - JAX fused-attn max-logit: return_max_logit=True selects NVTE_No_Backend on ROCm and the JAX probe/tests were adapted to reflect that; add max-logit support to the
    CK/AOTriton fused-attn backends and re-enable the JAX max-logit configs.
    - Activation recompute (reentrant): ROCm FusedAttnFunc leaks its recompute subgraph into the outer autograd graph under reentrant checkpointing, so we forced
    non-reentrant on ROCm as a workaround; fix the saved-tensor/ctx handling so reentrant use_reentrant=True checkpointing works and the workaround can be removed

  • torch.compile traceability of get_attention_backend on ROCm: test_torch_compile.py::test_get_attention_backend_traceable fails with InternalTorchDynamoError: NotImplementedError. get_attention_backend compares a FusedAttnBackend value returned across the @torch.compiler.assume_constant_result boundary using FusedAttnBackend's custom Python __eq__; dynamo can't install a CLOSURE_MATCH guard on the __eq__ of a constant-folded operand (GuardSource.CONSTANT). The IntEnum, its __eq__/__ne__/__hash__, and the comparison are verbatim upstream: only the enum members differ on ROCm (AOTriton/CK) — so this is an upstream traceability issue surfacing on the ROCm torch build; eager selection is correct. Currently xfail-guarded on ROCm; candidate fixes are comparing via int(...) at the call sites or dropping the custom __eq__ (needs in-container torch.compile verification and a check of the pybind-enum interop the override was added for).
  • Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)

  • Bug fix (non-breaking change which fixes an issue)

  • New feature (non-breaking change which adds functionality)

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

  • Infra/Build change

  • Code refactoring
  • Changes

    Please list the changes introduced in this PR:

  • Change A

  • Change B
  • Checklist:

  • I have read and followed the contributing guidelines

  • The functionality is complete

  • I have commented my code, particularly in hard-to-understand areas

  • I have made corresponding changes to the documentation

  • My changes generate no new warnings

  • I have added tests that prove my fix is effective or that my feature works

  • New and existing unit tests pass locally with my changes
  • Diff: 650 lines (+487 / -163) across 8 files Reviewer: matthiasdiener Review duration: 49369m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.52 · 650 lines diff across 8 files
    0.52
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.388
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #721"
    general weight: 0.35
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 52% (MEDIUM) · Higher = larger blast radius
    52%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.5% · Safe to merge
    20.5%