Skip to content

gpu: group native FP4 launcher arguments - #815

Merged
juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-def-fp4-launchers
Oct 25, 2026
Merged

juliankang4 merged 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-def-fp4-launchers

Conversation

@juliankang4

@juliankang4 juliankang4 commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

네이티브 FP4 호스트 launcher 두 개의 인수를 구조체로 묶어 clippy의 인수 개수 경고를 없앱니다. device 코드와 동작은 바꾸지 않습니다.

What and why

Kernels::swiglu and Kernels::product in crates/gpu/src/gemm/nvfp4mma.rs took nine and ten arguments (counting self). This groups each argument list into a struct, SwigluArgs and ProductArgs, placed next to the existing GateUpArgs. The functions now take four and three arguments, so the too_many_arguments lint no longer fires on either. The structs are pub(super) and carry the same borrowed buffers and scalar values the functions took before. stream and fault keep their place outside the struct, as in gate_up.

All four call sites are updated: three in crates/gpu/src/gemm/act32.rs (default SwiGLU, the activation rule, and the selected-slot call) and one in crates/gpu/src/gemm/gemm32.rs (the native product call). Each function destructures the struct on entry and the body below it is unchanged. Device code, kernel arguments, operation order, branches, grid sizes and error handling are untouched, and no launch, copy, sync or allocation is added.

Release notes: internal: native FP4 host launchers take an argument struct, which clears two too_many_arguments lint warnings.

Code shape

  • No second copy. SwigluArgs and ProductArgs follow the existing GateUpArgs in the same file; no shared logic is copied. No other type for the same purpose exists in crates/gpu/src.
  • Model code holds only architecture facts. No model file changed, and no common owner gained a per-model branch.
  • Dead code is gone. Nothing was made unused, and both new structs have production callers.
  • No silent failure. Every Result and ? is kept as before.
  • Comments state what is true now. No comments added or changed.
  • No relaxed gate. No band, tolerance, lint level or gate clause changed.
  • cargo fmt --all -- --check and cargo clippy pass on the touched crate for both targets below. Warning counts stay within the main ratchet: 3 against 3 for the default target, 3 against 7 for sm_121a. The remaining warnings are the existing type-complexity warnings in gate_kquant; neither launcher warns.

Duplication found or removed (path:line): none. The duplicate scan reported no candidates.

What I ran

The PR head is 753082611998edfebf1e4a7fea4c275b7c67a863, one commit on main 6de9e77d5139146c0a66c4cf02cc1850bec43b7c.

Same-head checks:

  • git diff --check upstream/main...HEAD passes.
  • The first 1,255 lines of nvfp4mma.rs, which hold the device code, are identical to main. After the argument struct is destructured, each function body matches main's.
  • On an NVIDIA GB10 (DGX Spark), cargo fmt --all -- --check passes, followed by the repository's all-target clippy for the default target and for sm_121a. Both finish without errors, and the lint check against the main ratchet passes (numbers above).
$ nvidia-smi
| NVIDIA-SMI 595.84                 Driver Version: 595.84         CUDA Version: 13.3     |
|   0  NVIDIA GB10                    On  |   0000000F:01:00.0 Off |                  N/A |
CUDA Version 13.3.1   (build container)
default lint warnings=3; main ratchet=3
sm_121a lint warnings=3; main ratchet=7

On an RTX 5090 machine I ran the two commands below on the commit before a formatting-only change to the product declaration (a line break and an optional trailing comma). The source otherwise has the same Rust tokens at the final head.

$ nvidia-smi
| NVIDIA-SMI 595.99.02              Driver Version: 595.99.02      CUDA Version: 13.2     |
|   0  NVIDIA GeForce RTX 5090        Off |   00000000:01:00.0 Off |                  N/A |
$ just check
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 30.64s
$ just gate-gpu-nvfp4
nvfp4 clause=routed_gate_up bits equal=3200/3200 PASS
nvfp4 clause=routed_down bits equal=12800/12800 PASS
gpu-gate.sh: gate_nvfp4 ran 1 s (exit 0)

The gate uses synthetic tensors, so no model is downloaded. It covers the NVFP4 selected-expert kernels. The native Gemm32Kernels launchers this PR edits sit outside it, so it says nothing about their runtime bit equality. The sm_121a clippy type check and the device-code and body comparison above cover them. I did not run a timed A/B, since the change adds no launch, copy, sync or allocation and does not claim a speed change. No new test was added.

Hardware

  • DGX Spark: NVIDIA GB10, driver 595.84, CUDA driver API 13.3, build container CUDA 13.3.1. Ran fmt and clippy.
  • RTX 5090 machine: NVIDIA GeForce RTX 5090, driver 595.99.02, CUDA driver API 13.2. Ran just check and just gate-gpu-nvfp4.

AI help

AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.

@github-actions github-actions Bot added gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 25, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: CLEAN: Argument grouping preserves all four call sites and both launcher bodies; no must-fix defect was found.

Non-blocking

⚠ Attach the move-class proof: crates/gpu/src/gemm/nvfp4mma.rs:1326. The PR provides source comparisons, but its reported NVFP4 gate bypasses these launchers. Attach identical base/head ptx-scan output with native FP4 enabled and unchanged host structural checks (graph node count, eager/replay equality and e2e set), as required by AGENTS.md's move/split/rename class. --no-jit suffices for the scan.

Checked

  • Duplicates: 2 argument types added, each used by its corresponding launcher; dryer reported 0 candidate pairs.
  • Complexity: crapper reported no changed function crossing its thresholds. Both executable launcher bodies match the base exactly after destructuring.
  • Silent failure: all 4 call sites preserve error propagation and fault forwarding; no fallback site added.
  • Tests and gates: no tests, pins, tolerances, cases or lint levels changed. Static comparison confirmed identical device source.
  • Performance: launch, copy, synchronization and allocation counts are unchanged. No numeric order changes.
  • Escape catalog: none of C1–C4 matches. No ledger lessons are in force.

Notes

The PR reports that its RTX 5090 gate predates the final formatting-only edit. No build or GPU gate was run during this static review.

Card check: gpu-evidence. This pull request changes crates/gpu/src/gemm/act32.rs, crates/gpu/src/gemm/gemm32.rs, crates/gpu/src/gemm/nvfp4mma.rs and carries a gate run on the author's card, which counts as verified.

🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)

@github-actions github-actions Bot added gpu-evidence Verified on the author's card: the pull request carries the gate run and its output and removed needs-gpu Changes code a card must check, and carries no gate run on a card labels Oct 25, 2026
@juliankang4

Copy link
Copy Markdown
Collaborator Author

The review is done and the contribution check passed, so I'm merging this.

@juliankang4
juliankang4 merged commit 8b395dc into midagedev:main Oct 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gpu The card engine: crates/gpu*, crates/app gpu-evidence Verified on the author's card: the pull request carries the gate run and its output

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant