Repository navigation
gpu-gemma4a: the audio Conformer tower and its mainline gate - #375
Conversation
There was a problem hiding this comment.
Verdict: MUST_FIX: the new audio builder fixture breaks the supported macOS t0 check.
Must fix
1. Skip the Linux audio fixture on unsupported hosts
tools/check-emb2.sh:233 calls self.fail when sha256sum is absent. On macOS without that utility, the fixture fails and check-emb2.sh exits nonzero. tools/contrib-check.sh:173–176 includes it in the any-OS t0 tier. Existing fixtures skip missing Linux utilities. Installing the checksum utility alone still leaves audio.sh dependent on Bash 4's mapfile and GNU mv -Tn.
Fixing the guard avoids imposing Linux tool prerequisites on t0 contributors. Replace lines 233–234:
if sys.platform != "linux" or not shutil.which("sha256sum"):
self.skipTest("audio builder fixture requires Linux and sha256sum")Non-blocking
⚠ Validate existing RMSNorm callers: crates/gpu/src/elem.rs:1023 changes an existing kernel's fault behavior and adds a fault argument. Existing callers include hybrid.rs:447. Attach current-head owning-gate results for those callers and a PTX comparison accounting for the changed entry. The audio-family gate alone does not exercise those paths.
Optimization headroom
- G, Per-launch and per-sync fixed cost: crates/gpu-gemma4a/src/arch/gemma4a/mod.rs:346, skip the output-clamp launch when both bounds are the defaults,
[-f32::MAX, f32::MAX]. The unary kernel preserves non-finite inputs, so this operation is identity. Each affected GEMM saves one launch and 8 bytes of buffer reads/writes per output element [derived].
Checked
Duplicates: diagnostics report zero qualifying dryer pairs; gpu-gates was excluded from that scan.
Complexity: diagnostics flag new run (56), load (37), gate main (24), and two hardware tests (38 each).
Silent failure: clamp preserves non-finite values; the changed RMSNorm raises F32Product on an overflowing sum of squares.
Tests: static inspection confirms assertions for clamps, rounding and arithmetic faults. Removing the RMS finite guard defeats the overflow assertion. Embedded Python and the inline replacement parse; both suggested lines are added by the diff.
Gates: device tests were not executed during validation. The PR reports FAIL-first results.
Escape catalog: no C1–C4 pattern matched the cited paths.
Notes
The supplied device-gate run names 365312fb and lacks the required nvidia-smi output. CI runs t0 on Ubuntu, so it does not cover the macOS failure above.
Card check: needs-gpu. This pull request changes crates/gpu-gates/Cargo.toml, crates/gpu-gates/src/bin/gate_gemma4a.rs, crates/gpu/src/elem.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)
Filed outside this PR: #376
| if not shutil.which("sha256sum"): | ||
| self.fail("sha256sum is required for the audio builder fixture") |
There was a problem hiding this comment.
The any-OS t0 tier must skip this Linux fixture on non-Linux hosts and when sha256sum is missing.
| if not shutil.which("sha256sum"): | |
| self.fail("sha256sum is required for the audio builder fixture") | |
| if sys.platform != "linux" or not shutil.which("sha256sum"): | |
| self.skipTest("audio builder fixture requires Linux and sha256sum") |
52c3a17 to
de8f644
Compare
|
This addresses the change request in review 5553888281 and its inline suggestion. The fixes are in 1. Linux audio-builder fixture in any-OS t0Commit The before/after fixture ran on Linux with platform and utility discovery mocked. On tested head The rebase preserved the contribution's binary patch exactly. The branch is now one commit on 2. Shared RMSNorm callers and PTX comparisonCommit
The first hybrid attempt lacked its greedy reference TSV. The same missing-file failure occurred on main. After generating the CPU references and the 33-prompt CUDA greedy TSV with the repository's recipes, the full hybrid gate returned rc 0. The description includes the ik source commit, build configuration, model digests and reference-manifest SHA256 values.
The scanner printed 3. Default output-clamp launch trialThe suggested skip was tried on 4. Card evidence and tested revisionThe description now names the tested head and base separately from the rebased head. It includes the recorded NVIDIA GB10 and driver 595.84 lines, CUDA 13.3.1, the model files and their digests, commands and recipe exit codes. The audio gate on The GB10 compilation check passed on AI helpAI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다. |
There was a problem hiding this comment.
Verdict: CLEAN: No must-fix finding remains after validation.
Non-blocking
⚠ Complete the gate evidence: crates/gpu-gates/src/bin/gate_gemma4a.rs:58. The PR reports runs on c8b204de and provides no FAIL-first transcript for the new gate clauses, including numeric comparisons and overflow refusal.
Attach failing mutations and passing output, then rerun just gate-gpu-gemma4a and the affected shared-kernel gates on de8f644. This supplies the validation evidence required for the added tower and changed shared kernels.
Optimization headroom
- E. Less work: crates/gpu-gemma4a/src/arch/gemma4a/mod.rs:216. The chunk encoding path projects fixed positions through fixed weights in every block. Replace each block's relative-position matrix with its derived projection at load, preserving BF16 rounding and clamps through the existing kernels. This removes 12 GEMMs and 24 pointwise/clamp launches per chunk: 36/n launches per soft token for n output tokens [derived].
Checked
Both cited lines are additions in the full diff. The gate contains numeric comparisons and malformed-input/overflow assertions. The loader fixes the tower at twelve blocks; each relative projection calls one GEMM and two pointwise kernels. Position inputs are independent of chunk length. Neither item meets the must-fix classification; the optimization remains advisory. The escape catalog and ledger do not alter either item. Validation was static; no GPU tests were run.
Card check: gpu-evidence. This pull request changes crates/gpu-gates/Cargo.toml, crates/gpu-gates/src/bin/gate_gemma4a.rs, crates/gpu/src/elem.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)
|
The review is done and the contribution check passed, so I'm merging this. |
Part of #59 (plan and PR order in #190), E10: the Gemma4 audio Conformer tower of EmbeddingGemma 2 on the GPU, checked against mainline llama.cpp. It takes the mel input prepared by E9 (#331) and returns soft embedding rows. E11 will connect it to the embedding seat. Nothing in the server calls this tower yet.
What and why
Release notes: Added: the GPU audio tower and its reference gate for EmbeddingGemma 2.
This adds
bloomery-gpu-gemma4aandgate_gemma4a. The gate compares each tower stage with mainline llama.cpp at6868a52cb337450658006ad2f9281c2eb63f1666, using its GPU output and CPU twin. Audio decoding, resampling, delimiter tokens and pooling with the text encoder stay in E11.The tower uses two stride-2 convolutions, twelve Conformer blocks and the output projections. Each chunk takes 1 to 2999 mel frames and produces token-major F32 soft rows, with no state between chunks. GEMM and RMSNorm use the existing shared kernels. The new kernels implement convolution, channel normalization, GLU, causal depthwise convolution and local attention; the crate does not depend on
gpu-vision.BF16 matrices widen exactly to F32 and GEMM inputs round to BF16. Convolution operands follow mainline's F16 im2col rule. The GGUF's
conv_normandnorm_convnames are swapped as in the reference; missing K gain and soft embedding gain mean unit gain, and a missing bias means zero. A present tensor with the wrong shape is an error.Non-finite input, weights, clamps and results are named errors. Normalization, attention softcap and GLU raise the existing fault word before an overflow can become a plausible finite output. The caller owns that word; it is not charged to the tower again.
The measured reserve is 1,347,032,320 bytes: 1,222,510,336 for weights and 124,521,984 for scratch. The gate holds it to the existing
Beside.imagereserve. This PR adds no reserve tag and changes no serving plan.Code shape
src/arch/gemma4a/.max(0.01, 2.5 * CPU-twin distance).Duplication found or removed: none.
Comparison with the reference
These results were measured on head
c8b204de28f6e3af3dd6ffba99ef6b74b410805b, base402f9abc6e3062ae0de0cc2ac3a86a2cf09c8c90, on DGX Spark. The current head is240829386cb95182b22b33927108003aa4fe9cfb, based onc14c46115ae487b3472e6c8ce80d2d109fd599bb. The rebase retained an identical contribution patch; only upstream's draft-path resolution incrates/refset/src/arch/draft.rschanged. The results below are retained measurements, not new runs on the rebased head.The oracle is mainline llama.cpp at
6868a52cb337450658006ad2f9281c2eb63f1666, with the BF16 projector identified below. Each row compares the final soft rows with the GPU dump; the bands use that run's CPU twin.On DGX Spark (GB10, sm_121), all six audio cases are inside both bands, clean/tapped outputs are bit-identical, and the gate prints
gemma4a tower PASS.The largest relative L2 is
4.375617328e-2, for silence. This is a numerical comparison within the stated bands, not a throughput or bit-identical-to-mainline claim.What I ran
All rows here ran on
c8b204deand base402f9abcwithBLOOMERY_BOX_LOCAL=1,BLOOMERY_ARCH=sm_121and the reference sets identified below. Each rc is the recipe's own exit code, not the surrounding collector's status.just gate-gpu-gemma4agemma4a tower PASSBLOOMERY_MODEL=deepseek2 just gate-gpu-p4PASSED: elem kernels within their bandsBLOOMERY_MODEL=deepseek2 just gate-gpu-headPASSED: gate_head_gpuBLOOMERY_MODEL=deepseek2 just gate-gpu-hybridgate_hybrid: PASS, at bothn_l=32andn_l=0BLOOMERY_MODEL=gemma-embedding2 just gate-gpu-gemma-embedding2-e2ebash tools/check-emb2.shOK (skipped=1); the Linux audio-builder fixture ranbash tools/ptx-compare.sh 402f9abc6e3062ae0de0cc2ac3a86a2cf09c8c90 gate_e2erms_normchanged among 271 shared entriesThe shared RMSNorm comparison has no added or removed entry; the other 270 entries are unchanged. Its instruction count changes from 182 to 208, while JIT registers remain 34, static shared memory remains 32 bytes, local memory remains zero and static blocks per SM remain 6. This replaces the earlier description that all shared kernels were identical.
The audio fixture now skips on non-Linux hosts or without
sha256sum. A Linux-hosted fixture with mocked platform and utility discovery checked Darwin with and without the utility, and Linux without it: all three skip before invoking the builder. This is not a native macOS execution.Not run on the rebased head: full t0, exact-head GPU compilation, Clippy and the changed upstream draft-path tests. No completed result for those checks is claimed here. The full t1 and
just affectedsuite have not been run in this round.Reference provenance and reproduction
The files came from pinned Hugging Face revisions:
DeepSeek-V2-Lite-Chat.Q3_K_M.ggufmradermacher/DeepSeek-V2-Lite-Chat-GGUF@9ee9f1f8f39f673e1022e176d586aef4228f630d642abebcf2f1efdb7a204759425865a1552b3120a9f6d3d82eb1adb8271d43fdembeddinggemma-2-Q8_0.ggufggml-org/embeddinggemma-2-GGUF@bfcd298762cc34d0357ece5ebdd31791a3a374d82188ac1deca4b77dffefd603c2776a9d76d9d74ec01841392982ebb840b09135mmproj-embeddinggemma-2-BF16.ggufd2033b3cd0223cfb2e7a2b50dc80a664c78c816d375f5b017ec3ef80ee0bc766The V2 oracle was built from an unmodified
ikawrakow/ik_llama.cppcheckout atcea2d61ffdac38ee2958ba88d120fa07cb67703a, treedf84c06ae0212212d847877e6faf2c4244fbde3e. Its manifests declarebuild cea2d61f,arch deepseek2and completion1155 0. These V2 readers do not impose a separate family build pin.The ik build used CUDA architecture
121a,GGML_NATIVE=OFF,-march=armv8.2-a+dotprod+fp16,GGML_IQK_MUL_MAT=ONandGGML_IQK_FLASH_ATTENTION=ON. Build tools were CMake 3.31.6 and Ninja 1.11.1.4 from isolated ARM64 wheels. The generateddump_refbinary has SHA256110ade6ca99c48d3dae1e44e20c690d0c6e5acc89f6068d1d9cf8e502dd7b4b3; itslibllama.sohas SHA25698a0c2e0f595c180a6ddbd2e3977747e10012c05740e17a16a51cff785a658cf.EmbeddingGemma uses the clean mainline llama.cpp pin above. The current tooling rebuilt
dump_emb2.cppwithset_writer.hagainst it; the generated binary has SHA2566b16ed637cca8cb350b075cc7d3181010f337ecb5a3463c75d0774641d6e5919.The repository's writers produced the shared-caller reference files. Hashes below identify the manifest bytes and the greedy TSV, not a digest of every payload file.
BLOOMERY_DATAref-tokenizer-gemma4/MANIFEST.tsv4dff7c27cc535fe41b21ee34790f174c93cea35c8e0ca37a557bc04b4947cff4ref/MANIFEST.tsv144795fd865a9252385bd8b7278673f1c62e40bb1bd50eaa9a82d546e8cfe749ref_cuda_v2/MANIFEST.tsv2b224eac0aa94f9fe1536dd825ab6e99496d4ca2758e5af4be82bf3eab76ddc0ref_gemma_embedding2_text/MANIFEST.tsve63331c64a4e8879ad603bad106414d19ac98aced8c885887ed9cff69f7184faref_gemma_embedding2_text.cpu/MANIFEST.tsvd7f20aefa78ceff92f8847b7f1cd31b2218b2aba0fb5824c163299f9fee6743dref_gemma_embedding2_tower/MANIFEST.tsvf9e6506ac2bffee336d625a9f40ee05b218e18c82a6dc61d80349c480705254bref_gemma_embedding2_tower.cpu/MANIFEST.tsv1ff33734ddbb65910954d2b25aa5da0b85715cde73bb593c7f15f189c8e5d0faref_gemma_embedding2_server/MANIFEST.tsv3bc2c99b07233b81eb167102c45e38bd59f07af76b1c425b0cbe1bfce66dc1f7ref_gemma_embedding2_server.cpu/MANIFEST.tsv031c1af78e1228f849ef0dc36e89034c207ef7c27e003626b11a4c2386305d87ref_gemma_embedding2_video/MANIFEST.tsvb0fdb94cc033321db55222f23d02212b57733792390c3437a16fc56f7c34bd72ref_gemma_embedding2_video.cpu/MANIFEST.tsv39b20c9f0766b9177a3cf8595440822ecb284c40a0aa2f35bb957e25a302292dgreedy-ik-cuda-32.tsv056837b21e617e687a5bc892690b8a15fa9cd1b5aec998ef5e770e9428b1536cSet
IKto the pinned ik checkout,LCPPto the pinned mainline checkout, andBLOOMERY_DATAto the reference output directory. The model paths below are those recorded in the manifests.What I ran into
None of this blocks the PR.
The first hybrid attempt lacked
greedy-ik-cuda-32.tsv; main failed for the same missing file. Generating the CPU references and CUDA greedy file with the upstream recipes resolved it, and the complete hybrid recipe then returned rc 0. The first ik builds also failed because the default ARM target did not define DOTPROD; the explicit supported CPU flags above built without source patches.I also tried skipping output-clamp launches with default bounds. Four alternating rounds per arm on
c8b204demeasured a duration change of-0.083245%[derived], below the experiment's 2.0% retention threshold. The trial was discarded; no speed change is included.Hardware (if the change is for a machine)
DGX Spark, NVIDIA GB10, Linux aarch64, driver 595.84, CUDA 13.3.1 development container. Device gates used
sm_121; the shared PTX scanner usedsm_86with GB10 JIT resource columns. The recorded idlenvidia-smilines were:AI help
AI 코딩 에이전트가 코드를 작성한 후 설명을 썼고, 테스트를 마쳤습니다. diff 리뷰와 PR 초안 리뷰는 제가 직접 했습니다.