Repository navigation
cuda: use MT2 FP8 attention on RTX PRO 4500 - #1731
Conversation
Testing request: RTX 5090 and RTX PRO 6000 Blackwell ownersCould someone with either card test this improvement independently? Please specify the PRO 6000 edition (Workstation, Max-Q or Server) and power limit. Use only PR #1731; do not combine it with the companion PR. A startup-only experimental override is now included:
Other architectures cannot be forced on. Model/shape, precision, KV, context and graph guards remain in place. For attention, wider windows are still selected only at 8192<=cached<65536; the override does not force every attention shape. The flags are read at startup, so restart the server between arms. Exporting the flag only in the benchmark client does nothing. Commands below assume Linux/Bash. 1. Isolated checkout and one buildgit clone --filter=blob:none --no-checkout https://github.com/ashhart/TensorFold.git tensorfold-pr1731-test
cd tensorfold-pr1731-test
git fetch origin pull/1731/head
git checkout --detach FETCH_HEAD
git rev-parse HEAD
zig build native -Dsm=120 -Dnvcc="$(command -v nvcc)" -Dversion=pr1731-test -j4Use Zig 0.17.0 and preferably the same CUDA 13.0 or 13.3 toolchain for all arms; record full versions. Reuse your qualified grammar/media library setup. Use the same 2. Server terminal: baseline, candidate, baseline againSet MODEL_DIR and DRAFTER_DIR to your existing checkpoint directories. Stop other GPU workloads during each measured arm. Start with 0, then repeat with 1, then 0 again. Set ARM respectively to unset TF_CUDA_TEST_MLP128 TF_CUDA_TEST_ATTN_MT2
MODEL_DIR=/path/to/Qwen3.8-27B-MLX-4bit
DRAFTER_DIR=/path/to/Qwen3.8-27B-DFlash2
ARM=baseline
TF_CUDA_TEST_ATTN_MT2=0 TENSORFOLD_MEMORY_RESERVE_GIB=0.5 HOME="$(mktemp -d)" ./zig-out/native/bin/tensorfold-native serve "$MODEL_DIR" --drafter "$DRAFTER_DIR" --name bench --host 127.0.0.1 --port 18080 --context 131072 --parallel 1 --kv-cache fp8 --prompt-precision int8 --vision --prompt-cache-gib 8 --max-tokens 2048 >"$ARM-server.log" 2>&1Confirm the log says 3. Client terminal: identical sequence for every armWait until ARM=baseline
RECEIPT=docs/receipts/rtx-pro-4500-attention-20261030
python3 tools/bench_openai.py http://127.0.0.1:18080 bench --tokens 256 --reps 5 --temperatures 0,1 --output "$ARM-short.json"
python3 "$RECEIPT/testing/replay_long.py" http://127.0.0.1:18080 "$RECEIPT/testing/fixture-8192.json" --model bench --repetitions 3 --output "$ARM-long8k.json"
python3 "$RECEIPT/testing/replay_long.py" http://127.0.0.1:18080 "$RECEIPT/testing/fixture-32768.json" --model bench --repetitions 3 --output "$ARM-long32k.json"The long replay runs both python3 - <<'CHECK'
import json
for size in ['8k', '32k']:
reference = None
for arm in ['baseline', 'candidate', 'baseline-repeat']:
samples = json.load(open(f'{arm}-long{size}.json'))['samples']
hashes = {(x['drafted'], x['repeat']): x['response']['tensorfold']['token_sha256'] for x in samples}
if reference is None:
reference = hashes
assert hashes == reference, (size, arm, 'token mismatch')
print('Long-fixture hashes match across all three arms.')
CHECKPlease attachGPU model/edition and power limit; driver, nvcc, Zig, OS and Git SHA; checkpoint revisions and unchanged serving settings; all nine benchmark JSON files and the three server logs. Include the short benchmark's This is a focused performance/exactness request, not a request to run an hours-long full suite. The PR remains draft: full backend contract SUMMARY qualification and the other documented release gates are still outstanding. No GPU run of this newly added override has been performed locally; pure override tests and targeted host checks passed. The original 4500 receipts remain pinned to their original measured commits. Please report failures without disabling hash checks or changing precision. |
|
Thanks @Maxrio9. +2.4% and +3.5% drafted at 8K and 32K with every token equal is a good result, and checking the MT2 tile row by row against |
|
Thanks. Taking your points in order:
Short decode. I took your second option rather than trying to show −0.38% is noise: MT2 is now selected only from 8,192 cached tokens up, one-row decode included ( Served list. Added a one-row, short-cache shape ( nvcc 13.0 SUMMARY (current main Both MT2 forms pass their live limit checks under 13.0 (242 and 239 registers, 36,992 static bytes, 128 threads, matching the records). The 213 problems are the same 168 missing static records and 45 live mismatches that untouched main reports under the same compiler (identical sorted lists, apart from the three new passing launches), so 13.0 doesn't make the global gate green for me; if CI uses a different entry point, tell me and I'll run it. Receipts are on the Scope: combined binary, graphical desktop active with a 4 GiB reserve (not headless); the contract is deterministic with no timing gates. |
|
CI update for the current head ( The one remaining red job is |
|
Thanks @Maxrio9: asks 2 to 4 are answered. |
|
@ashhart this is ready for your check. I merged main into the branch rather than rebasing (a rebase would need a force-push). On the previous head ( It is still a draft; I'll mark it ready for review on your word. It lands with #1730. |
b5d34f7 to
f820a50
Compare
|
Thanks @Maxrio9. Every ask is met: MT2 only from 8,192 cached tokens, the one-row short-cache shape in the served list, |
f820a50 to
ea72b0c
Compare
ashhart#1731's code as one commit onto main; its receipts stay on the contributor's branch.
ashhart#1731's code as one commit onto main; its receipts stay on the contributor's branch.
ea72b0c to
3fd29b2
Compare
ashhart#1731's code as one commit onto main; its receipts stay on the contributor's branch.
3fd29b2 to
90d6bd3
Compare
#1731's code as one commit onto main; its receipts stay on the contributor's branch.
|
Thank you @Maxrio9. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks @Maxrio9! This is in TensorFold 1.2.3, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.3 |
Update (nvcc 13.0, rebased on main
37a4a84a): this branch now carries only the source and tests (see the receipts branch for the evidence: nvcc 13.0 run). Full CUDA contract under nvcc 13.0.88: 511 kernels pass gates 1-4, 0 fail, 340/340 controls caught, 213 limit problems, identical to untouched main under the same compiler; the new launches pass their live limit checks. The earlier numbers below are from the 13.3 run on94b90c9d.The FP8 MT2 attention tile is selected only for SM120/82SM and its supported cached-token range. BF16/FP32 arithmetic and serving features stay unchanged; graph-cache identity records the tile choice. Fixes #1701. No GDN fusion; the MLP change remains separate in #1730.
Draft: numerical qualification completed; the global backend gate fails only on unchanged main limit-record gaps.
The full unfiltered CUDA integration run reports 465 kernels passing gates1–4, zero numerical failures, eight declared known findings;322/322 controls caught, zero missed;223 limit-record problems. A limits-only control with unmodified main production kernels/registry reproduces the identical168 missing static records and55 live mismatches. The three new launches (MLP128 and both MT2 forms) all pass their own live limit checks. Full backend qualification therefore remains red; the PR stays draft pending maintainer review of that unchanged baseline.
Complete numerical run and main-only limit diagnosis contains the exact SUMMARY, full/partial logs, source/binary/build hashes, baseline control and every failure. One combined integration binary contains the two independently benchmarked changes plus a disclosed five-file test-only fixture-lifetime fix; math/shapes/seeds/controls/bounds stay unchanged. This does not claim an unmodified-source, single-contribution-only or globally passing backend run.
Independent current-main94b90c9d native-binary override0/1/0 bracket on RTX PRO4500:
The fixture labels are8K/32K; exact rendered inputs are8,210/32,785 tokens, with128 output tokens. Prefix reuse and per-request cache counts are retained; these are decode measurements, not cold-prefill claims.
All matched tokens, vision PNG/JPEG/WebP, tools/schema/reasoning, cancellation/recovery, fallbacks and context checks pass. Short classic is +0.018%; short community is -0.379%. These are workload-specific results from one bracket, with no confidence interval. Earlier source01e25d3a brackets remain separate.
Raw current-main bracket, exact medians, hashes, fixtures, source patch and build identities. The public code branch retains its original01e25d3a ancestry; the receipt identifies the separately rebased94b90c9d test source and new binary.
Complete receipt and retained failures. Includes replacement registration, live/compiled launch records, host chip/shape/cache dispatch controls, four clean sanitizer runs, independent old-source overrides and completed60-request cold supplement. Newer host graph passes285/285 steps with108 fresh tests and cached remainder using a disclosed common test-fixture repair; original mock-fixture crashes reproduced on untouched main are retained. This is not an unmodified-source host pass or fullGPU qualification.
Desktop only: RTX PRO4500 Blackwell SM120/82SM,200W;5900X,31.24GiB physical RAM,24GiB test budget;driver615.78.08,Zig0.17.0,nvcc13.3.73. Native Zig/CUDA. Qwen3.8-27B affine4/group64 revision22d8d538154e0e5b6f8dcb1fcc74a60a0798104c and BF16 DFlash2 revision50307d4c4cde6860d4eee73e2547cd786fe8e8a4.131072context,vision/reasoning/tools/schema,FP8KV,int8prefill,8GiBhost cache,parallel1,upstream0.5GiB reserve. Explicit1.1.6 version label is recipe compatibility metadata, not release provenance. No physical5090/PRO6000 qualification; override testing instructions remain in the existing PR comment.