Skip to content

build: backport the shared-pointer call-argument cast - #811

Closed
juliankang4 wants to merge 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-cuda-oxide-backport-the
Closed

juliankang4 wants to merge 1 commit into
midagedev:mainfrom
juliankang4:dgx-spark-cuda-oxide-backport-the

Conversation

@juliankang4

@juliankang4 juliankang4 commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator

shared 메모리 포인터를 Rust 함수에 넘길 때 생기는 컴파일 오류를 고친 cuda-oxide pin을 사용합니다.

Part of #495.

Before merge

AGENTS.md asks for a pin/87bc9518 tag on midagedev/cuda-oxide before the pin moves. My account can only read that repository, so I could not add it. The old commit is still reachable as the parent of 466ee160 on bloomery. A maintainer can add the tag with:

git tag pin/87bc9518 87bc951864b79f723b4da9c11fa229f5600aefcb
git push origin refs/tags/pin/87bc9518

What and why

Move the cuda-oxide source pin to midagedev/cuda-oxide#3 (merged as 466ee160) on midagedev/cuda-oxide:bloomery, backported from NVIDIA/cuda-rust 927d462e (#1598). The importer converts an address-space-only difference at the call boundary, so a shared raw pointer can reach a helper's generic-pointer parameter. It preserves the existing pointee, mutability and pointer-kind checks.

Keep all compiler patches on midagedev/cuda-oxide. The lockfile, notices, build instructions and upstream ledger use the same merged source pin. Ledger row 38 now lists the affected pins and the merged fix in one place, and the duplicate row 51 is gone.

The only Rust change here is comments in crates/gpu/src/flash_gqa_prefill.rs. They no longer say that a shared pointer cannot be passed to a helper function. Moving the q8 staging into a helper changes those kernels' PTX, so dequant_row! and zero_row! stay macros, and the comments give that reason.

Release notes: Under the hood: the cuda-oxide pin adapts shared-memory pointer arguments at ordinary device helper calls; generated PTX is unchanged.

Code shape

  • No second copy. The compiler reuses its existing pointer-normalization helper.
  • Model code holds only architecture facts. No model code changes.
  • Dead code is gone. No API or runtime path added.
  • No silent failure. Incompatible pointer types still reach the verifier unchanged.
  • Comments state what is true now.
  • No relaxed gate. Existing PTX and numerical pins stay in place.
  • cargo fmt and cargo clippy are clean on what I touched. Only comments changed in Rust; fmt and clippy were not run here.

Duplication found or removed: none.

What I ran

On a DGX Spark, installed cargo-oxide from https://github.com/midagedev/cuda-oxide.git at 466ee1605a65936df4a49ceb3b6870f5b911a60d into an empty CARGO_HOME, then built and ran:

export CARGO_HOME=$(mktemp -d)
export PATH="$CARGO_HOME/bin:$PATH"
cargo +nightly-2026-08-28 install --locked --git https://github.com/midagedev/cuda-oxide.git \
  --rev 466ee1605a65936df4a49ceb3b6870f5b911a60d --root "$CARGO_HOME" cargo-oxide
cargo oxide build --arch sm_121a -- -p bloomery-gpu-gates --features deepseek41 \
  --release --bin generate_ds41 --bin gate_e2e --bin gate_nvfp4
BLOOMERY_BOX_LOCAL=1 just gate-gpu-nvfp4
  • The empty Cargo home fetched 466ee160 from the maintainer repository, and the build succeeded.
  • Cargo.lock stayed unchanged during the build and gate checks.
  • gate-gpu-nvfp4: gpu-gate.sh: gate_nvfp4 ran 14 s (exit 0). The dense and routed numerical, bit-identity and refusal checks passed.

On that machine nvidia-smi reported:

| NVIDIA-SMI 595.84                 Driver Version: 595.84         CUDA Version: 13.3     |
|   0  NVIDIA GB10                    On  |   0000000F:01:00.0 Off |                  N/A |

No model file is needed; the gate uses synthetic tensors.

Not run here

The earlier DGX Spark comparison at source pins 87bc9518 and 10cdbef7 built the same binaries and found identical generate_ds41 and gate_e2e PTX tables and normalized entry digests. Those scans include ptxas resource columns, not driver JIT columns (--no-jit). This pin move reuses that comparison: 466ee160 differs from 10cdbef7 only in the examples workflow and documentation, including a helper doc comment.

The compiler backport's regression check builds the existing local and dependency helper examples at both source pins. Both fail with the callee-signature mismatch at 87bc9518; both build and pass their GPU data/barrier checks at 10cdbef7. The direct control and the existing pointer-normalization unit tests also pass.

I also tried moving the q8 staging into a helper function on the same compiler pin. The generate_ds41 scan then differed for two q8 entries: gqa_prefill_flash_q8 went from 252 to 249 registers and from 3706 to 3692 normalized PTX lines, and gqa_prefill_flash_256_q8 from 4132 to 4120 lines. That change is not in this PR, and I make no speed or bit-identity claim for it.

The gate and build above ran on Bloomery commit 6015f3db0. The final head differs from it only in Rust comments and the ledger, so I did not rerun them. Full contrib-check and the complete GPU suite were not run here.

Hardware

DGX Spark, NVIDIA GB10, aarch64 Linux. The pinned toolchain is nightly-2026-08-28 (rustc 1.100.0-nightly e457a7b0d). The nvidia-smi lines are above.

AI help

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

@github-actions github-actions Bot added documentation Improvements or additions to documentation gpu The card engine: crates/gpu*, crates/app needs-gpu Changes code a card must check, and carries no gate run on a card tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo 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: MUST_FIX: The PR leaves the required old-pin preservation tag pending.

Must fix

1. Publish the old compiler pin tag (kind B)

Cargo.toml:49 advances the fork revision. The base contract, AGENTS.md:221, requires a preservation tag before the fork branch moves. The PR's “Before merge” section says the author could not create pin/87bc9518 and leaves it for a maintainer. The old commit's branch reachability does not fulfill the tag requirement.

Cost: Preserve the rollback revision now, while the old commit is still reachable.

Fix: A maintainer must run these commands in a midagedev/cuda-oxide checkout before merging this PR:

git tag pin/87bc9518 87bc951864b79f723b4da9c11fa229f5600aefcb
git push https://github.com/midagedev/cuda-oxide.git refs/tags/pin/87bc9518

Non-blocking

⚠ Attach the PTX comparison output: Cargo.toml:49 changes the compiler for every kernel. Base AGENTS.md:223 requires identical generate_ds41 and gate_e2e PTX tables for a fork patch that must preserve codegen. The body reports an earlier 87bc9518 → 10cdbef7 comparison but supplies no scan commands or tables.
Paste the commands and identical --no-jit tables for the old and new pins, or the earlier logs plus the compiler source diff supporting reuse at 466ee160. This makes the claimed proof reviewable without repeating the build.

Checked

Duplicates: 0 new definitions; dryer reported 0 pairs.
Complexity: crapper reported no changed function crossing its thresholds; no function bodies changed.
Silent failure: 0 changed sites; Rust source outside doc comments is unchanged.
Tests: none added or changed; no mutation check applies. Compiler FAIL-first is reported in the body.
Gates: no numerical thresholds, test cases or lint levels changed.
Pins: all three patch entries and build instructions agree; nightly and architecture flags are unchanged. Existing backend and CLI guards reject stale installations.
Escape catalog: no C1–C4 patterns matched the diff.

Notes

No builds or GPU gates were run during this review. The compiler implementation and PTX comparison output are absent from the supplied trees.

Card check: gpu-evidence. This pull request changes crates/gpu/src/flash_gqa_prefill.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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation 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 tools Tools, recipes, CI and the toolchain: tools/, justfile, .github/, Cargo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant