Repository navigation
gpu: refuse misaligned vector views at launch - #520
Conversation
There was a problem hiding this comment.
Verdict: CLEAN: The launchers reject misaligned vector planes before enqueueing, and the shared validator preserves SSD's alignment requirements.
Non-blocking
⚠ Show FAIL-first output: crates/gpu/src/mxfp4.rs:846. The PR reports passing alignment regressions but no failing run before the fix. Run the new NVFP4 regression on the base and attach its failing assertion, then the head's passing output, as CONTRIBUTING.md requires for a new gate.
⚠ Supply dispatch timing evidence: crates/gpu/src/tensor.rs:15. The valid path gains one alignment check per NVFP4 launch, three per MXFP4 gate/up/down pair, and one or two per IQ row launch. The reported identical PTX covers device code; AGENTS.md also requires a same-lease base/head A/B for dispatch changes. Attach the existing runner's output before this becomes the timing baseline.
Checked
Duplicates: 5 new functions checked; no duplicate owner found. Dryer reported 0 pairs. The shared validator replaces SSD's alignment loop.
Complexity: IqKernels::enqueue_rows 29 → 37 adds format-specific refusal branches; MxExpertKernels::enqueue_gate_up 19 → 21 and enqueue_down 18 → 19 add refusal paths. The shared validator owns the alignment decision.
Silent failure: 8 mandatory-vector conversion sites followed; all 10 quantized vector planes have matching host checks. The empty IQ3_S match arm still reaches its named unsupported-format error. No new failure defaults.
Tests: static mutation checks only. Removing the checks at mxfp4.rs:788, mxfp4_sel.rs:850/851/922, iq.rs:1512/1515/1516/1519, or mamba2_ssd.rs:605/606/607 makes the corresponding new test's error assertion fail. gate-gpu-lib includes all four ignored tests. CUDA tests were not rerun here.
Gates: no numeric bands moved or cases removed. The unsafe-block pin rises from 1958 to 1960 with a dated reason for the two test constructions.
Performance: the four device-code sections are byte-identical to the base. No valid-path allocation, launch, copy, synchronization, or reduction-order change was added.
Escape catalog: no C1–C4 pattern matched.
Notes
The PR names the RTX 5090 and driver, both commits, and synthetic inputs, but omits the nvidia-smi output and full functional gate output. gpu.json records evidence=false under the required evidence list.
Card check: needs-gpu. This pull request changes crates/gpu/src/iq.rs, crates/gpu/src/mamba2_ssd.rs, crates/gpu/src/mxfp4.rs … and carries no gate run on a card (CONTRIBUTING's evidence list); a maintainer adds gpu-verified after one.
🔨 Shingler, bloomery's review bot: approves a clean pull request and requests changes on a must-fix (how it works)
|
The review is done and the contribution check passed, so I'm merging this. |
벡터 정렬이 맞지 않는 양자화 텐서를 커널 실행 전에 이름이 있는 오류로 거부합니다.
Fixes #518
What and why
A u32 tensor window can start four bytes into its parent allocation, while the NVFP4 kernel needs its code plane aligned to 16 bytes. The launcher now checks that requirement before enqueueing, so an unavailable device vector view cannot leave the output unchanged behind an
Okresult.The same validator checks MXFP4 route gate/up and down planes and IQ row planes, including IQ4_XS metadata. It takes the alignment from the CUDA vector type. SSD's existing alignment checks use this helper too. Q8_0 keeps its scalar fallback for unaligned activations. Kernel bodies and valid-input arithmetic are unchanged.
Release notes: Added: Named launch errors for misaligned NVFP4, MXFP4 and IQ vector planes.
Code shape
cargo fmtis clean.cargo clippywas not run here.Duplication removed:
crates/gpu/src/mamba2_ssd.rs, the vector base-alignment loop inrefuse.What I ran
Tested head:
5f83676053bd6a6be018113a7fc3435e502c56a8. Base:146c13027d5311ee804f7094730b0a6f009f617f. These checks use synthetic tensors and need no model file.tools/check-unsafe.shThe hardware table covers each IQ vector format, both IQ4_XS planes, MXFP4 gate/up and down, and SSD conv/output/state. The NVFP4 case rejects a 1 x 32 window at byte offset 4 with aligned 1 x 4 scales, K=256 and one activation column, and keeps its output sentinel on refusal.
For the functional gates, use the local GPU lock directory and set
BLOOMERY_DATAto the directory containingref-synth:gate_nvfp4gate_iqgate_mamba2_ssdThe PTX scanner uses its fixed
sm_86target and JITs on the RTX 5090. The functional tests above usesm_120.What I ran into
gate_dspark_expertswas not run because the test machine has neither the DSpark checkpoint nor thedsref code64_n32_w3reference set. This does not block this input-validation fix: the MXFP4 launcher hardware test exercises refusals and aligned execution, and the device code is unchanged.Hardware
NVIDIA GeForce RTX 5090, driver 595.99.02, compute capability 12.0. The functional builds target
sm_120.AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.