Repository navigation
[Kernel] AllSpark W8A16: CUDA (5090/4090) + ROCm (RDNA4) - #3490
Conversation
Vendors the AllSpark Ampere W8A16 fused GEMM from vLLM #12931 and wires it into GPTQModel's TorchOpsJitExtension machinery. Kernel sources are copied verbatim except for the vLLM registration macro, which is replaced by a TORCH_LIBRARY binding in allspark_torch.cpp. Verified on an RTX 5090 (sm_120, CUDA 13.0, torch 2.14.1+cu132). Relative error against a dequantized reference at N=K=4096: 3.5e-4 (M=1), 3.4e-4 (M=16), 1.9e-4 (M=256), 0.0 (M=2048, cublas path). Two flags are required and are set in utils/allspark.py: -U__CUDA_NO_HALF_CONVERSIONS__ and friends, because torch's cpp_extension disables the implicit float->half casts this kernel relies on, plus -lcublas. Not wired into BACKEND yet; AllSparkLinear, backend registration and the Marlin comparison are still to come.
|
Second commit adds AllSparkLinear and exercises the packing path. Also checked against a real 8-bit checkpoint (Qwen2.5-0.5B, Two things worth knowing:
Not done yet: the loader still has to pick AllSparkLinear when the checkpoint |
Adds BACKEND.GPTQ_ALLSPARK, a GPTQQuantLinear subclass and a test that packs a weight the way an 8-bit checkpoint stores it, repacks it into N32K16 order and compares the GEMM against the dequantized reference. Two things surfaced while wiring it up: - the module has to hoist the extension load into post_init(), otherwise the first repack runs before torch.ops is populated. - an 8-bit group_size=-1 checkpoint stores qzeros=127 while the effective zero point is 128, which matches the kernel's symmetric assumption. Verified against the original fp16 weights: 0.93% error with 128 versus 3.6% with 127. Validated on a real 8-bit Qwen2.5-0.5B layer (gate_proj, K=896 N=4864): relative error 2.7e-4 (M=1), 2.7e-4 (M=16), 2.1e-4 (M=64), 0 (M=256).
63cdf19 to
a3c00e6
Compare
|
@Lumea-art Thanks for the pr! We have both 4090 and access to Ampere and GB10 to test this. I would recommend AllSpark as dedicated backend as For the second part of the question, I am not sure yet. I will run some tests on the draft pr before I can say for sure which direction we should go as in is dspark a runtime converted format or should be a full on disk format. I would lean to the runtime convert at the moment.
|
4090 numbers for the AllSpark vs Marlin microbenchmarkRan the PR's protocol on an RTX 4090 (sm_89, 72 MiB L2), commit Setup: K=4096, N=11008, fp16, random uint8 weights + per-column fp16 scales (45.1 MB of weight bytes). Marlin is
Hot cache (same protocol as the table above)
L2-flushed (weights read from GDDR6X)A 512 MiB random fp32 buffer is reduced before every timed call so the 45.1 MB matrix is evicted from the 72 MiB L2. GB/s is weight bytes / time, same convention as the PR.
What this says
Repeated on the second 4090; medians matched within noise. |
Adds the script behind the 4090 numbers on ModelCloud#3490 so anyone can rerun it on their own card. Reports hot (L2-resident), L2-flushed (device memory), and CUDA-graph timings for AllSpark vs Marlin at K=4096 N=11008, plus relative error against the dequantized reference. The flushed pass uses a random 512 MiB buffer, not a zero-filled one, so memory compression cannot leave the weights resident and turn the memory-roof measurement into another cache measurement.
|
Pushed the benchmark to this PR branch as Options: What it does: random uint8 weights + per-output-channel scales, K=4096 N=11008 by default, Marlin through Three modes, because the single "hot" number is easy to misread:
Re-run on the 4090 with the committed script (
ms, fp16. bf16 also runs; AllSpark's relative error goes from 4.1e-4 (fp16) to 3.2e-3 (bf16), which is output rounding rather than an arithmetic difference. One caveat for whoever runs this next: on a card with less L2 than the weight matrix, Benchmark code is currently in 2528e0a |
|
I will likely do a refractor on the backends, in separte PR, so that we longer have gptq_marlin and awq_marlin and just have single backend=marlin which auto routes to correct sub-marlin based on weight format. This should keep our backends list so much cleaner. Forgot the exact reason why this was not done before but will check again . Pending: #3491 |
Ports the AllSpark W8A16 kernel to RDNA4 wave32 WMMA:
* cp.async / ldmatrix / mma.sync -> global->register->LDS staging, plain
16B LDS reads in the repack's own fragment order, and
v_wmma_f32_16x16x16_{f16,bf16}_w32_gfx12
* prmt.b32 -> v_perm_b32 (AMD selector semantics re-derived on hardware)
* __CUDA_ARCH__ guards -> __HIP_DEVICE_COMPILE__ + __gfx1200__/__gfx1201__,
with a compile-time #error and a runtime sentinel so a silently empty
kernel cannot ship
* bf16 dequant: replace __float2bfloat16 (a NaN compare + select per value,
~200 extra ALU instructions per kernel body) with integer RNE plus one
v_perm_b32. gfx1200/1201 have no v_cvt_pk_bf16_* instruction. bf16 was
27% slower than fp16 in the L2-resident case; it is now at parity.
gptq_allspark now selects on ROCm (DEVICE.ROCM) and dispatches to the HIP
repack/GEMM; CUDA keeps the existing path unchanged. allspark_supported()
returns False under HIP because ROCm reports gfx1201 as compute capability
12.0, which would otherwise fall inside the Ampere..Blackwell window.
Numbers (R9700, gfx1201, 32 CU, K=4096 N=11008, weight bytes only):
fp16 M=8 hot 0.065 ms (691 GB/s) flushed 0.100 ms (450) graph 0.063 ms (712)
bf16 M=8 hot 0.067 ms (673 GB/s) flushed 0.101 ms (448) graph 0.065 ms (689)
device read baseline: 602-606 GB/s
scripts/benchmark_allspark_hip_w8a16.py reproduces the table (hot/flushed/
graph, random flush buffer, optional Triton comparison).
RDNA4 (gfx1200/gfx1201) port — landed on this branch, with gfx1201 numbersCommit Device: AMD Radeon AI PRO R9700, gfx1201, 32 CU, torch 2.16.0.dev+rocm10.1, hip 7.16. K=4096, N=11008, random uint8 codes + per-channel scales, 20 warmup + 100 timed calls, median, weight bytes only, ms.
Device read baseline on the same card: 602–606 GB/s (256 MiB random reduce), so flushed (~450 GB/s) is ~74% of achievable read bandwidth, and flushed is flat in M for both dtypes — weight-bandwidth-bound, as expected. bf16 is now at parity with fp16bf16 dequant was slower than fp16 in the L2-resident case. Same harness, same seed, M=8 hot:
Cause: a = u0 + 0x7FFFu + ((u0 >> 16) & 1u); // integer RNE
b = u1 + 0x7FFFu + ((u1 >> 16) & 1u);
o = perm_b32(a, b, 0x03020706u); // [a.b2, a.b3, b.b2, b.b3]That removes 16× ( Qualification in the same commit
Tests: 25 passed on gfx1201 ( ReproducingSame protocol as Not done
|
Adds an AWQ 8-bit path to the AllSpark HIP/RDNA4 W8A16 kernel. AWQ differs from GPTQ 8-bit by packing along N instead of K and by carrying an arbitrary per-group zero point on the K axis, so this required both a new repack and a grouped scale/zero read in the kernel. Kernel (gptqmodel_ext/allspark_hip): * GroupCnt/GroupSize are real now: scale/zero are read from a (GroupCnt, N32) block, with the row selected per k-tile inside the k-loop. GPTQ stays on the single per-channel row, so its code path is unchanged. * bf16 takes the zero point before the scale, in fp32. The old ordering did (code - 128) * scale - zero, which is wrong for AWQ (zero point is a code, not a bias-128 offset). fp16 subtracts the residual (zero - 128) after its existing bias-128 conversion. * Group selection is incremental instead of `k / (GroupSize / kKTile)`: RDNA has no integer divide instruction, and the per-k-tile divide cost ~12 us on gfx1201 at group_size 32. * unpack_kernel and the grouped scale padding handle groups; the M > 16 prefill fallback therefore works with zero points too. Bindings: * Add a c10::cuda::CUDAGuard to every entry point. Custom ops get no dispatcher device guard, so on a multi-GPU split the launcher ran on the current device with another device's pointers and produced NaN. This was reproduced on 4x gfx1201 and is covered by a test. Python: * AllSparkAwqLinear (backend `awq_allspark`), RDNA4 only, group sizes -1/16/32/64/128, fp16 and bf16. It packs through the shared AWQ packer so checkpoints stay byte-compatible, repacks into the WMMA fragment order once in post_init, and never keeps a dense weight. * allspark_hip_repack_awq() and optional b_qzeros/group_size plumbing; allspark_hip_repack() now returns (packed, scales, zeros_or_None). Validation (gfx1201): 72 passed. AWQ matches an fp64 oracle within one output ULP for both dtypes across all group sizes, at M=1/4/16, and with a non-128-aligned N. Module-level pack -> post_init -> forward reproduces the dense weight to 8-bit noise, and a full Llama-3.2-1B AWQ-8bit model is closer to the fp32 gold logits than the torch AWQ backend (1.86e-2 vs 2.10e-2). CUDA is untouched: the AWQ tests skip there and AllSparkLinear still passes.
AllSpark AWQ 8-bit on RDNA4 (gfx1201)AWQ-8 is now supported by the HIP AllSpark kernel: What was needed
Bug found and fixed during validation: every entry point now takes a Validation (gfx1201, 72 tests)
Throughput (K=4096, N=11008, 200 iters, device read baseline 607 GB/s, random weights)
Graph-replay: fp16 AWQ gs=−1 reaches 62.6 µs / 720 GB/s (M=4). Flushed (weights evicted): 99–105 µs / 430–455 GB/s across all AWQ configs. bf16 and fp16 are now within 7 % of each other at the same config (the earlier ~28 % bf16 deficit was the dequant ALU path, fixed in the previous commit). AWQ gs=−1 matches GPTQ; grouped AWQ pays 2–6 % at gs=128 and ~18 % at gs=32 for the extra per-tile scale/zero traffic. Reproduce with: CUDA is untouched: the AWQ tests skip off gfx1200/1201, and |
# Conflicts: # gptqmodel/utils/backend.py
Follows ModelCloud#3491 (marlin/machete/swordfish unification) for AllSpark. Backend * `BACKEND.GPTQ_ALLSPARK` and `BACKEND.AWQ_ALLSPARK` collapse into a single `BACKEND.ALLSPARK`. The checkpoint method/format picks `AllSparkLinear` (GPTQ) or `AllSparkAwqLinear` (AWQ); both declare `SUPPORTS_BACKENDS = [BACKEND.ALLSPARK]`. Old strings stay loadable via `_LEGACY_BACKEND_ALIASES`. AWQ * `group_size=-1` only. With one group over all of K the scale/zero are (1, N) and the kernel loads them once outside the k-loop. Grouped zeros forced a per-16-wide-k-tile reload: 2-6% slower at group_size=128 (~18% at 32) on gfx1201 with no accuracy benefit for the decode shapes this targets. * `SUPPORTS_GROUP_SIZE = [-1]`; `pack()` and `allspark_hip_repack_awq()` reject any other grouping with a clear error instead of silently mis-scaling. Kernel * Drop `GroupCnt`/`GroupSize` from the params struct, the grouped scale/zero bookkeeping and `pad_scale_grouped_kernel`. Removes the group branch and counter from the k-loop; GPTQ 8-bit codegen is unchanged. Verified on gfx1201 (4x R9700, torch 2.16 ROCm, hip 7.16): 40 passed for the HIP + AWQ suites, 46 passed / 4 skipped including the linear and JIT tests. CUDA (2x 4090): 10 passed, AWQ tests skip as intended.
Correction + rebase: AWQ is per-channel only, and one
|
| dtype | path | M=1 | M=4 | M=8 | M=16 |
|---|---|---|---|---|---|
| fp16 | GPTQ | 71.6 / 629 | 65.4 / 689 | 66.2 / 682 | 66.0 / 683 |
| fp16 | AWQ | 70.7 / 638 | 65.9 / 684 | 65.8 / 685 | 65.1 / 692 |
| bf16 | GPTQ | 74.7 / 603 | 66.7 / 676 | 67.8 / 665 | 67.4 / 669 |
| bf16 | AWQ | 74.7 / 604 | 65.7 / 686 | 65.7 / 687 | 66.0 / 683 |
| Triton bf16 | reference | 144.2 / 313 | 427.1 / 106 | 424.9 / 106 | 427.0 / 106 |
Graph replay at M=8: fp16 GPTQ 63.3 µs (712 GB/s), fp16 AWQ 63.3 (712), bf16 GPTQ 65.4 (690), bf16 AWQ 64.4 (700). Flushed is flat at 98–103 µs (440–460 GB/s) for every config, i.e. weight-bandwidth-bound.
Tests, gfx1201: test_allspark_hip.py + test_allspark_awq.py 40 passed; with test_allspark_linear.py + test_allspark_jit.py 46 passed / 4 skipped. 4090: 10 passed, AWQ suite skips as intended.
python scripts/benchmark_allspark_hip_w8a16.py --awq --triton --m 1 4 8 16 --iters 200
python -m pytest tests/test_allspark_hip.py tests/test_allspark_awq.py
Commit 421b66612 on feat/allspark-kernel.
|
@Lumea-art ROCm (RDNA4) kernels for AllSpark added. I will handle the validation of the Ampere/Rocm code and you can handle the rest (5090). |
ModelCloud#3491 collapsed the marlin backends into BACKEND.MARLIN, so scripts/benchmark_allspark_w8a16.py raised AttributeError before it timed anything. Legacy 'gptq_marlin' strings still normalize, the enum does not.
|
5090 side is done. Tests on the current tip (38047ef): The skips are HIP and AWQ on CUDA, as intended. End to end, on an 8-bit group_size=-1 Qwen2.5-0.5B checkpoint: One bug in the benchmark you pushed: scripts/benchmark_allspark_w8a16.py used Numbers from the committed script on this card, K=4096 N=11008 fp16, all from Which is: The flushed numbers are in the same place as your 4090 (1.09-1.12x), a little The number I would trust from a 5090 is the flushed one, about 1.1x, since that Numerics: 2.05e-4 for allspark against the dequantized reference, 6.5e-7 for Two caveats, both about this machine rather than the kernel:
I have not touched the ROCm path or the AWQ code. If you want anything else One separate thing, not for this PR: producing the AllSpark checkpoint needs |
@Lumea-art Great! Let's do that on a seprate PR. |
|
@Lumea-art Do you have the AllSpark compatible checkpoint that I can download to do e2e tests instead of synthetic testing?
|
|
No hosted copy right now - sorry,my egress to HF goes through a mirror that will not
act_group_aware=False is needed on current main; that is the issue split into What is inside, in case you check it before loading: That last line matters: 127 is not the real zero point. I checked both against Loaded here: 168 AllSparkLinear, and "The capital of France is" comes back as |
|
@Lumea-art Got it. I just trained the same 0.8B model and it was fast as you demonostrated. Right now I am fixing RDNA4 bf16 major e2e accuracy drift. Once that's done, this PR is good to go. |
|
Good to hear. I will stay out of the branch until your RDNA4 fix lands - One thing that might help with the drift: the bf16 baseline on CUDA. Same On CUDA the bf16 path costs 0.38% and does not drift. If RDNA4 lands well above Which 0.8B did you use? I will run the same model here so the perplexity Ping me when the fix is in and I will re-run the 5090 suite on the final tip |
RDNA4 (gfx1201): bf16 vs fp16 vs torch referenceNumbers below are from the current tip
Graph replay, M=8: fp16 GPTQ 62.7 µs (720 GB/s), bf16 GPTQ 64.8 (696), fp16 AWQ 62.8 (718), bf16 AWQ 64.2 (703). Flushed is flat at 98–102 µs (440–460 GB/s) in every configuration. bf16 now tracks fp16 to within ~3% on the GPTQ path and is at parity on AWQ. The M=1 GPTQ row (604 vs 636) is the only remaining gap. bf16 accuracy against the torch referenceKernel arithmetic, fp32 output vs an fp64 gold (excludes output rounding), across all four (K,N) shapes in the model:
Against End-to-end, Qwen2.5-0.5B 8-bit
Read that table carefully before calling the last row a kernel problem. Layer-level AllSpark bf16 and torch bf16 agree to 7e-8, so the spread is not arithmetic. The unquantized base model in bf16 is already 1.9e-1 from the fp16 base, and torch's 8-bit bf16 run sits at 2.2e-1; AllSpark is at 3.0e-1 on the same scale. bf16 at 8 mantissa bits over 24 layers, measured against an fp16 reference, is coarser than the quantization noise being measured. AllSpark fp16 and torch fp16 land within 2.4e-3 of each other, i.e. the kernel adds ~2.4e-4 on top of quantization noise, matching the microbenchmark.
What the bf16 fix was
Tests, gfx1201: No code change beyond what is already on the branch; the bf16 dequant fix has been in |
|
@Lumea-art RNDA4 bf16 fix is in. You are free to push whatever you need to complete on your end. RNDA4 numbers also look good. Almost full bw saturation at the tested shapes. |
|
Re-ran the 5090 suite on 38047ef - no code change on the branch since last One thing I checked while I was in there: on CUDA an AWQ checkpoint now gets a CUDA AWQ is the only gap I am aware of, and it is a follow-up rather than Nothing blocking from my side. Shout if you want anything re-run before the |
…nore rules The CUDA extension already had the whole zero-point path: `has_zp`, `B_zero`, and the repack already reordered it. Only the Python wrappers passed `None`, so CUDA AWQ could not be exercised at all. Wire it up: * `allspark_repack()` now takes an optional per-N zero buffer and returns a 3-tuple; `allspark_repack_awq()` unpacks the AWQ on-disk layout and feeds it. `allspark_gemm()` forwards `b_qzeros` and sets `has_zp`. * `AllSparkAwqLinear` now declares `SUPPORTS_DEVICES = [CUDA, ROCM]` and picks the extension by runtime instead of hardcoding HIP. The one device-specific detail is where the zero is applied: HIP subtracts it inside the fp32 dequant `(code - zero) * scale`, while CUDA subtracts it after its bias-128 conversion `((code - 128) - zero) * scale`. The CUDA repack therefore stores `zero_awq - 128`. Getting this backwards is silent (it just shifts every weight), so `test_awq_zero_point_convention_is_load_bearing` uses a raw-zero negative control: correct 2.6e-4..2.6e-3 relative, raw 6.7e-1..7.3e-1. Also add an AWQ mode to `scripts/benchmark_allspark_w8a16.py` so the CUDA and ROCm AWQ numbers come from the same script as the GPTQ ones. `.gitignore` gets a warning block: the hipify patterns silently drop a new hand-written `*_hip.*` file, so each one needs its own negation. Verified: 4090 CUDA 10/10 AWQ tests, 20/20 with the JIT+linear suites; RDNA4 ROCm 46 passed / 4 skipped.
|
AWQ W8A16,
Both runtimes use the shared The RDNA4 bf16 conversion uses integer round-to-nearest-even plus byte packing. CUDA keeps split-K partials and reduction in FP32. Current timings show close fp16/bf16 performance. PYTHONPATH=. python scripts/benchmark_allspark_w8a16.py --awq --m 1 8 16
PYTHONPATH=. python scripts/benchmark_allspark_w8a16.py --awq --dtype bfloat16 --m 1 8 16Hot/graph results include cache reuse; flushed GB/s counts weight reads only. The |
|
Correction to my earlier reply: CUDA AWQ is now supported through the shared |
|
@Lumea-art Please test the awq allspark kernel on your 5090 |
|
Thanks for the correction - you are right about the mechanism. The device On the AWQ kernel: I had already run it on sm_120 before your message, on Same pass/skip counts as your 4090 run; the skips are the RDNA4-only cases. End to end with a real AWQ 8-bit group_size=-1 checkpoint (Qwen2.5-0.5B): Perplexity on the same corpus as my GPTQ numbers (3577 tokens, 512-token If the zero were being applied with the wrong sign that would move by far more Benchmark of the AWQ path here, K=4096 N=11008 fp16: Laptop caveat unchanged: those three points are one short run, the hot column On the diff: I checked that the three-value return from allspark_repack has no utils/allspark.py:164 :170 accepts group_size == k while :174 then rejects anything that is not a Nothing else I would change, and nothing to push from me. |
|
Final review fixes pushed as
Backend/selector checks: 34 passed, 1 skipped. Ruff, package builds, installed-wheel source discovery and RDNA4 retains the Real Qwen2.5-0.5B generation is coherent on both devices in fp16/bf16, with 168 AllSpark layers. The local AWQ checkpoint is a lossless layout conversion of the real GPTQ weights. On the 4090, maximum normalized model-logit differences versus Torch are 1.46% fp16 and 3.68% bf16; model outputs are not claimed bit-identical. Updated timing tables show current fp16/bf16 parity. FP32 CUDA split scratch uses four bytes per partial instead of two; M=16 graph latency is about 19 µs on the 4090. No persistent dense-weight bytes remain. Ready for another review. Not merged. The contributor's 5090 results cover |
|
@Lumea-art Some corrections pushed. Run your tests one more time on 5090 before I merge |
|
Ran the full suite on f25fcfa. Same counts as your 4090 run. The skips are the RDNA4-only cases. End to end, two 8-bit group_size=-1 checkpoints of Qwen2.5-0.5B: Perplexity, 3577 tokens of English from the repo docs, 512-token windows: The GPTQ delta moved from +0.147% on e22efa8 to +0.062% here, which is what I Timing on this card, same script, one short run each: The GPTQ M=16 row is the known laptop artifact - the sweep drifts and that point Nothing blocking from my side. |
|
Merged - thanks. Follow-up opened as #3515 : a CUDA-graph regression test for The PR body has a short scope note on what the test does and does not catch - |
…ntization pipeline (#3532) * feat(kernel): scaffold AllSpark W8A16 JIT extension Vendors the AllSpark Ampere W8A16 fused GEMM from vLLM #12931 and wires it into GPTQModel's TorchOpsJitExtension machinery. Kernel sources are copied verbatim except for the vLLM registration macro, which is replaced by a TORCH_LIBRARY binding in allspark_torch.cpp. Verified on an RTX 5090 (sm_120, CUDA 13.0, torch 2.14.1+cu132). Relative error against a dequantized reference at N=K=4096: 3.5e-4 (M=1), 3.4e-4 (M=16), 1.9e-4 (M=256), 0.0 (M=2048, cublas path). Two flags are required and are set in utils/allspark.py: -U__CUDA_NO_HALF_CONVERSIONS__ and friends, because torch's cpp_extension disables the implicit float->half casts this kernel relies on, plus -lcublas. Not wired into BACKEND yet; AllSparkLinear, backend registration and the Marlin comparison are still to come. * feat(kernel): add AllSparkLinear (load-only) with GPTQ 8-bit repack Adds BACKEND.GPTQ_ALLSPARK, a GPTQQuantLinear subclass and a test that packs a weight the way an 8-bit checkpoint stores it, repacks it into N32K16 order and compares the GEMM against the dequantized reference. Two things surfaced while wiring it up: - the module has to hoist the extension load into post_init(), otherwise the first repack runs before torch.ops is populated. - an 8-bit group_size=-1 checkpoint stores qzeros=127 while the effective zero point is 128, which matches the kernel's symmetric assumption. Verified against the original fp16 weights: 0.93% error with 128 versus 3.6% with 127. Validated on a real 8-bit Qwen2.5-0.5B layer (gate_proj, K=896 N=4864): relative error 2.7e-4 (M=1), 2.7e-4 (M=16), 2.1e-4 (M=64), 0 (M=256). * bench(allspark): add reproducible W8A16 hot/flushed/graph benchmark Adds the script behind the 4090 numbers on #3490 so anyone can rerun it on their own card. Reports hot (L2-resident), L2-flushed (device memory), and CUDA-graph timings for AllSpark vs Marlin at K=4096 N=11008, plus relative error against the dequantized reference. The flushed pass uses a random 512 MiB buffer, not a zero-filled one, so memory compression cannot leave the weights resident and turn the memory-roof measurement into another cache measurement. * feat(allspark): add RDNA4 (gfx1200/gfx1201) HIP port for the W8A16 GEMM Ports the AllSpark W8A16 kernel to RDNA4 wave32 WMMA: * cp.async / ldmatrix / mma.sync -> global->register->LDS staging, plain 16B LDS reads in the repack's own fragment order, and v_wmma_f32_16x16x16_{f16,bf16}_w32_gfx12 * prmt.b32 -> v_perm_b32 (AMD selector semantics re-derived on hardware) * __CUDA_ARCH__ guards -> __HIP_DEVICE_COMPILE__ + __gfx1200__/__gfx1201__, with a compile-time #error and a runtime sentinel so a silently empty kernel cannot ship * bf16 dequant: replace __float2bfloat16 (a NaN compare + select per value, ~200 extra ALU instructions per kernel body) with integer RNE plus one v_perm_b32. gfx1200/1201 have no v_cvt_pk_bf16_* instruction. bf16 was 27% slower than fp16 in the L2-resident case; it is now at parity. gptq_allspark now selects on ROCm (DEVICE.ROCM) and dispatches to the HIP repack/GEMM; CUDA keeps the existing path unchanged. allspark_supported() returns False under HIP because ROCm reports gfx1201 as compute capability 12.0, which would otherwise fall inside the Ampere..Blackwell window. Numbers (R9700, gfx1201, 32 CU, K=4096 N=11008, weight bytes only): fp16 M=8 hot 0.065 ms (691 GB/s) flushed 0.100 ms (450) graph 0.063 ms (712) bf16 M=8 hot 0.067 ms (673 GB/s) flushed 0.101 ms (448) graph 0.065 ms (689) device read baseline: 602-606 GB/s scripts/benchmark_allspark_hip_w8a16.py reproduces the table (hot/flushed/ graph, random flush buffer, optional Triton comparison). * feat(allspark): AWQ 8-bit zero-point GEMM for RDNA4 Adds an AWQ 8-bit path to the AllSpark HIP/RDNA4 W8A16 kernel. AWQ differs from GPTQ 8-bit by packing along N instead of K and by carrying an arbitrary per-group zero point on the K axis, so this required both a new repack and a grouped scale/zero read in the kernel. Kernel (gptqmodel_ext/allspark_hip): * GroupCnt/GroupSize are real now: scale/zero are read from a (GroupCnt, N32) block, with the row selected per k-tile inside the k-loop. GPTQ stays on the single per-channel row, so its code path is unchanged. * bf16 takes the zero point before the scale, in fp32. The old ordering did (code - 128) * scale - zero, which is wrong for AWQ (zero point is a code, not a bias-128 offset). fp16 subtracts the residual (zero - 128) after its existing bias-128 conversion. * Group selection is incremental instead of `k / (GroupSize / kKTile)`: RDNA has no integer divide instruction, and the per-k-tile divide cost ~12 us on gfx1201 at group_size 32. * unpack_kernel and the grouped scale padding handle groups; the M > 16 prefill fallback therefore works with zero points too. Bindings: * Add a c10::cuda::CUDAGuard to every entry point. Custom ops get no dispatcher device guard, so on a multi-GPU split the launcher ran on the current device with another device's pointers and produced NaN. This was reproduced on 4x gfx1201 and is covered by a test. Python: * AllSparkAwqLinear (backend `awq_allspark`), RDNA4 only, group sizes -1/16/32/64/128, fp16 and bf16. It packs through the shared AWQ packer so checkpoints stay byte-compatible, repacks into the WMMA fragment order once in post_init, and never keeps a dense weight. * allspark_hip_repack_awq() and optional b_qzeros/group_size plumbing; allspark_hip_repack() now returns (packed, scales, zeros_or_None). Validation (gfx1201): 72 passed. AWQ matches an fp64 oracle within one output ULP for both dtypes across all group sizes, at M=1/4/16, and with a non-128-aligned N. Module-level pack -> post_init -> forward reproduces the dense weight to 8-bit noise, and a full Llama-3.2-1B AWQ-8bit model is closer to the fp32 gold logits than the torch AWQ backend (1.86e-2 vs 2.10e-2). CUDA is untouched: the AWQ tests skip there and AllSparkLinear still passes. * refactor(allspark): one `allspark` backend, AWQ per-channel only Follows #3491 (marlin/machete/swordfish unification) for AllSpark. Backend * `BACKEND.GPTQ_ALLSPARK` and `BACKEND.AWQ_ALLSPARK` collapse into a single `BACKEND.ALLSPARK`. The checkpoint method/format picks `AllSparkLinear` (GPTQ) or `AllSparkAwqLinear` (AWQ); both declare `SUPPORTS_BACKENDS = [BACKEND.ALLSPARK]`. Old strings stay loadable via `_LEGACY_BACKEND_ALIASES`. AWQ * `group_size=-1` only. With one group over all of K the scale/zero are (1, N) and the kernel loads them once outside the k-loop. Grouped zeros forced a per-16-wide-k-tile reload: 2-6% slower at group_size=128 (~18% at 32) on gfx1201 with no accuracy benefit for the decode shapes this targets. * `SUPPORTS_GROUP_SIZE = [-1]`; `pack()` and `allspark_hip_repack_awq()` reject any other grouping with a clear error instead of silently mis-scaling. Kernel * Drop `GroupCnt`/`GroupSize` from the params struct, the grouped scale/zero bookkeeping and `pad_scale_grouped_kernel`. Removes the group branch and counter from the k-loop; GPTQ 8-bit codegen is unchanged. Verified on gfx1201 (4x R9700, torch 2.16 ROCm, hip 7.16): 40 passed for the HIP + AWQ suites, 46 passed / 4 skipped including the linear and JIT tests. CUDA (2x 4090): 10 passed, AWQ tests skip as intended. * fix(allspark): benchmark script used the removed GPTQ_MARLIN enum #3491 collapsed the marlin backends into BACKEND.MARLIN, so scripts/benchmark_allspark_w8a16.py raised AttributeError before it timed anything. Legacy 'gptq_marlin' strings still normalize, the enum does not. * feat(allspark): qualify the AWQ 8-bit path on CUDA, warn about hip ignore rules The CUDA extension already had the whole zero-point path: `has_zp`, `B_zero`, and the repack already reordered it. Only the Python wrappers passed `None`, so CUDA AWQ could not be exercised at all. Wire it up: * `allspark_repack()` now takes an optional per-N zero buffer and returns a 3-tuple; `allspark_repack_awq()` unpacks the AWQ on-disk layout and feeds it. `allspark_gemm()` forwards `b_qzeros` and sets `has_zp`. * `AllSparkAwqLinear` now declares `SUPPORTS_DEVICES = [CUDA, ROCM]` and picks the extension by runtime instead of hardcoding HIP. The one device-specific detail is where the zero is applied: HIP subtracts it inside the fp32 dequant `(code - zero) * scale`, while CUDA subtracts it after its bias-128 conversion `((code - 128) - zero) * scale`. The CUDA repack therefore stores `zero_awq - 128`. Getting this backwards is silent (it just shifts every weight), so `test_awq_zero_point_convention_is_load_bearing` uses a raw-zero negative control: correct 2.6e-4..2.6e-3 relative, raw 6.7e-1..7.3e-1. Also add an AWQ mode to `scripts/benchmark_allspark_w8a16.py` so the CUDA and ROCm AWQ numbers come from the same script as the GPTQ ones. `.gitignore` gets a warning block: the hipify patterns silently drop a new hand-written `*_hip.*` file, so each one needs its own negation. Verified: 4090 CUDA 10/10 AWQ tests, 20/20 with the JIT+linear suites; RDNA4 ROCm 46 passed / 4 skipped. * fix(allspark): harden packaging, scratch lifetime and numerical validation * feat(arch): shared CUDA tuning-family classification + hw parity contract Add cuda_capability/cuda_arch/is_ada/tuning_family to gptqmodel.utils.arch so every launch-constant table can key on one vocabulary (ada, hopper, blackwell, cdna4, rdna4, rdna3, other) instead of ad-hoc capability checks. Add a hardware-free contract test that fails when a tuned pipeline has no entry for both RTX 4090 (ada) and RDNA4 (rdna4). * fix(arch): classify explicit sm_*/capability inputs on ROCm hosts tuning_family() returned arch_class() for every input whenever torch.version.hip was set, so a CUDA capability tuple or an sm_89 string was reported as "other" on a ROCm host. The NVIDIA branch was unreachable there. That made test_cuda_family_classification fail on gfx1201 and would have silently dropped any launch-table lookup that was handed explicit CUDA metadata. Only a gfx* string or a real device is resolved through arch_class(); an explicit sm_* string or (major, minor) tuple is portable metadata and classifies identically on CUDA and ROCm hosts. The sm_ parser is factored into _tuning_family_from_sm() and shared by both branches. * perf(paroquant): per-family, row-banded Triton GEMM launch table The fused ParoQuant GEMM hardcoded decode (4,128,32,warps=4,stages=2) and prefill (32,128,32,warps=8,stages=4) for every GPU. On wave32 gfx1201 the prefill num_warps=8 tile is especially wrong: four warps already cover 128 lanes, and eight measured 1.65x slower at K=4096/N=4096/M=16 (137.6 vs 83.2us). paroquant_gemm_launch_config(kind, device_or_arch, rows) now keys on gptqmodel.utils.arch.tuning_family. Families without a measured entry keep the historical pair, so Ada/Hopper/Blackwell and every unregistered target are unchanged. rdna4 uses three measured bands (<=8 rows, 9..64, >64) selected from the flattened row count; the wrappers pass input.shape[0]. Also fixes a latent correctness bug the wider BLOCK_K tiles exposed: the kernel loads one scale/zero group per K tile and broadcasts it across the tile, so a tile must never span more than one group. BLOCK_K is now clamped to group_size. Before the clamp, BLOCK_K=64 with group_size 32 produced 0.6-1.0 relative error. Measured on AMD Radeon AI PRO R9700 (gfx1201), FP16, 4-bit, group_size 128, median of 21 iterations after 5 warm-ups, 256 MiB L2 flush before each timed call, torch.cuda.synchronize around every call: M=1 K=14336 N=4096 181.30 vs 269.13 us (1.48x) M=4 K=4096 N=4096 77.72 vs 102.18 us (1.31x) M=16 K=14336 N=4096 206.87 vs 288.76 us (1.40x) M=64 K=14336 N=4096 222.37 vs 325.10 us (1.46x) M=128 K=5120 N=8192 186.06 vs 296.69 us (1.59x) M=1024 K=14336 N=4096 1680.99 vs 2893.65 us (1.72x) New-tile output is bit-identical to the old tile for group_size 32/64/128 and both FP16 and BF16 inputs. Against an independent FP64 Torch oracle: FP16 max relative error 5.0e-4 over K/N 512..4096 and M 1..128; BF16 stays at its pre-existing output-rounding floor (<=1.25 ULP versus the truth rounded once to BF16), which is the documented 5e-3 test tolerance, not kernel arithmetic. * feat(awq): portable Triton GEMV for the FORMAT.GEMV packed layout AWQ FORMAT.GEMV/GEMV_FAST/LLM_AWQ could only run through the native gptqmodel_ext/awq JIT extension, which hipcc cannot build (cuda_fp16.h, CUDA inline asm, 64-bit-only warp sync mask on wave32), so a GEMV-layout checkpoint raised NotImplementedError on ROCm. gptqmodel/quantization/awq/modules/triton/gemv.py now implements the same computation with plain Triton. It reads the GEMV packing directly: qweight [N, K/8] int32, nibble i of word w = input column w*8+i (plain order, NOT the FORMAT.GEMM [K, N/8] AWQ interleave) qzeros [N, ceil(groups/8)] int32 with the group axis padded to a word scales [N, padded_groups] FP16 BLOCK_K is clamped to group_size because the kernel broadcasts one scale/zero group across each K tile. Accumulation is FP32 and the output dtype is the input dtype. Weights stay packed; nothing dense is materialized. AwqGEMVTritonLinear (BACKEND.AWQ_GEMV_TRITON) reuses AwqGEMVLinear.pack, so the packed buffers are byte-identical to the native layout, and declares DEVICE.ROCM. SUPPORTS_FORMATS priority is 0, which is the documented 'supported but never AUTO-selected' marker: the AUTO order for FORMAT.GEMV is unchanged (CUDA keeps the native kernel, ROCm keeps the actionable refusal), and an explicit selection is now the supported ROCm placement. The loader rejection takes a backend argument and exempts only that explicit choice. Measured on AMD Radeon AI PRO R9700 (gfx1201), FP16, M==1, median of 21 iterations after 5 warm-ups, 256 MiB L2 flush before each timed call: K=2048 N=2048 48.3us vs 679.8us split (14.1x) K=4096 N=4096 93.2us vs 3164.1us (33.9x) K=5120 N=8192 152.6us vs 7730.3us (50.7x) K=14336 N=4096 229.3us vs 10771.2us (47.0x) K=4096 N=11008 164.5us vs 8284.2us (50.4x) 'split' is dequantize+matmul from the same packed buffers (cost floor). Against the shipped FORMAT.GEMM Triton GEMM at M==1 this kernel is 1.7x-2.4x faster. Oracle A/B (independent FP64 unpack, never the kernel's own math): FP16 max relative error 4.5e-4; BF16 is at its <=1.25 ULP output-rounding floor. Packed qweight/qzeros stay int32 and identical across repeated forwards. * docs: hardware tuning parity policy for RTX 4090 (Ada) and RDNA4 * feat(gguf): enable the fused Triton kernels on ROCm GGUFTritonKernel now declares DEVICE.ROCM and validate_once no longer hard-rejects ROCm; _cuda_device_capability already returned None there, so ROCm keeps the generic launch configs and never selects the NVIDIA SM80/SM89 specializations. Measured on gfx1201 (R9700, FP16, median of 21 iters after 5 warm-ups with a 256 MiB L2 flush): 5.0-13.1x faster than GGUFTorchLinear at M=1/16/128 for Q4_K/Q5_K/Q6_K, so AUTO (priority 45 > 15) now resolves to the Triton kernel on ROCm. tests/kernels/test_gguf_rocm_triton.py validates the kernels against the independent numpy GGUF block oracle (output dtype == input dtype, repeated forwards bit-identical, 1.25-ULP visible drift budget) and covers the generic-config selection on a ROCm host. * feat(rocm): actionable ROCm refusals for the CUDA-only backends Marlin, Machete, Swordfish, BitBLAS and W4A-NVFP4 stay unsupported on ROCm; this only makes the selection surface say so before it wastes time probing a CUDA extension: * Swordfish/Machete/BitBLAS validate_once() now reject a HIP host first (they previously reported 'runtime unavailable' or a bitblas install hint). * BaseQuantLinear._validate_shared() keeps the reason raised by validate_device() and, for a CUDA-only kernel on a HIP target, names the portable *Torch/*Triton alternative instead of a bare 'unsupported device'. AUTO is unchanged and still cannot reach them: the candidate list is filtered by SUPPORTS_DEVICES (none lists DEVICE.ROCM) before any validation runs. Tests assert both halves. * feat(triton): RTX 4090 (Ada, SM 8.9) tuned launch tables Add an explicit "ada" entry to every shared Triton launch table and route CUDA devices through gptqmodel.utils.arch.tuning_family so an SM 8.9 GPU actually reaches it. - gptq_gemv: GemvLaunch(max_block_k=256, block_n=8, num_warps=8). Measured on one 4090 vs the 512 default: 1.09x-1.18x hot and 1.10x-1.19x flushed on the large projections (4096x4096 through 5120x12288); neutral below that. - gptq_gemm: GemmLaunch(16,16,256,4,2) with a new trailing max_out_features field (default 0 keeps cdna4/rdna4 tuples byte-for-byte unchanged). Gate (small_m_max=16, max_in_features=2048, max_out_features=2048). Measured 1.09x-1.65x hot for K<=2048 & N<=1536 and 1.10x-1.41x flushed across K<=2048 & N<=2048 in FP16 and BF16; the 2048x2048 corner is hot neutral but flushed-positive. Losses outside the rectangle are gated off. - dequant: DequantLaunch(x_block=512, num_warps=1, num_stages=2); best mean against the per-shape best (hot 1.007x, flushed 1.017x). - qlinear/torch: the fused small-M GEMM now accepts (IS_ROCM or is_ada), and the arch token uses cuda_arch() instead of the ROCm-only gcnArchName. - arch: gemm_fused_dtypes/gate_limits dispatch through tuning_family (same values for cdna4/rdna4) and expose gemm_fused_max_out_features(). - awq scheduler: the 4090 profile guard was re-verified exact on this host (2x RTX 4090: name, (8,9), 128 SMs, 50_950_569_984 bytes); no constant changed. BF16 rules are deliberately absent because awq_gemm_triton rejects non-FP16 input/scales. - gguf_triton: SM89 fixed tiles for Q4_K/Q5_K/Q6_K, keyed by qtype, padded in_features, out_features and row band. Only exact measured shapes are wired (1.02x-1.15x, bit-identical to the autotuned launch); Q1_0 SM80/SM89 and every unmeasured shape keep the autotuned generic kernel. No persistent dequantized weight cache is introduced; every fused path still consumes the packed weights and bounded tiles only. * test(ada): Torch-oracle A/B coverage and benchmark for the SM 8.9 tables Independent oracles only: every expected value is rebuilt with Torch integer shifts and an FP64 accumulate/round; the kernels under test are never used to produce their own reference. New tests: - test_gptq_ada_gemv.py / test_gptq_ada_gemm.py: launch-table dispatch (runs with CUDA_VISIBLE_DEVICES=-1), gate/dtype assertions, and real-GPU oracle A/B across bits 2/4/8, FP16 and BF16, desc_act and bias variants, in and out of the fused gate. The GEMM file also pins that "ada" enables only the measured FP16/BF16 dtypes and that no dense weight is retained after one or repeated forwards. - test_gptq_ada_dequant.py: bits 2/4/8 in FP16/BF16 over four shapes against a CPU int-shift oracle, plus the module-level dequantize_weight path and a repeated-call storage check. - test_gguf_ada_fixed_launch.py: SM89 selector grid (measured shapes and row bands only; SM80/86/90/100, unpadded widths and unmeasured rows fall through) and a real-GPU bit-exact A/B of the fixed tile vs the autotuned launch. - test_awq_ada_plan.py: the 4090 four-field identity guard, FP16-only rules, exact-shape matching, and a real-device profile check. Updated: the ROCm GEMV/GEMM and dequant table tests now pin sm_89 to its Ada entry (the (8,9) tuple and the None default are covered too), and test_hw_parity_contract keeps the both-families assertion plus a GGUF Ada-only/autotuned-fallthrough check. scripts/benchmark_ada_kernels.py reproduces every shipped number: device proof (count/name/capability/SM/memory), GEMV vs the portable tile, small-M GEMM vs dequantize+matmul, dequant vs default, and GGUF fixed vs autotuned. Median after warmup, torch.cuda.synchronize around every launch, alternating 256 MiB L2 flush, hot and flushed medians reported separately. GEMV/GEMM rows report max abs/rel against an FP64 oracle (plus the once-rounded oracle) rather than against the sibling kernel, and each row records retained-weight bytes and any dense-weight candidate. --dry-run exits 0 without a GPU. * docs(rocm): RDNA4 matrix update; correct the AWQ GEMV decode-benchmark claim docs/rocm-rdna4.md now records the closed RDNA4 gaps: AWQ FORMAT.GEMV via BACKEND.AWQ_GEMV_TRITON, GGUF_TRITON on ROCm (AUTO, measured), the ParoQuant per-family launch table, the actionable refusals for Marlin/Machete/Swordfish/ BitBLAS/W4A-NVFP4, and why QQQ has no Triton port (CUDA inline PTX plus a distinct W4A8 packing/quant contract). The AWQ GEMV row and section were also wrong: the 1.7-2.4x "faster than FORMAT.GEMM at M==1" figure compared a raw kernel launch against a derived baseline. Re-measured module-against-module on gfx1201 (M==1, FP16, gs=128, median of 41 iterations after 20 warm-ups, 256 MiB L2 flush, CUDA events) the two shipped kernels are at parity: K N GEMV us GEMM us vs GEMM vs split 2048 2048 68.0 93.5 1.38x 6.6x 4096 4096 111.8 117.1 1.05x 19.1x 5120 8192 170.2 165.1 0.97x 30.7x 14336 4096 248.4 200.5 0.81x 29.3x 4096 11008 186.0 175.6 0.94x 30.1x So AWQ_GEMV_TRITON is documented as a ROCm portability/correctness path (the 6.6-30.7x win is over the dequantize+matmul floor it replaces), not a decode speedup over FORMAT.GEMM. The module docstring carries the same corrected table. tests/kernels/test_awq_rocm_triton.py gains an M==1 parity test: it transcodes the GEMV packed buffers into the FORMAT.GEMM layout independently (nibble interleave applied by hand, never by calling a kernel) and asserts both modules produce the same output within one FP16 ULP band, so the "parity" wording is pinned numerically even though timings cannot be asserted on a shared GPU. * perf(awq): measured RDNA4 (gfx1201) rules for the AWQ Triton GEMM scheduler The AWQ Triton plan table only covered the RTX 4090, and _builtin_plan returned None whenever identity[6] was set -- which is always true on ROCm -- so every RDNA4 shape fell through to the generic 32/32/32 split_k=8 tile, a wave64/CDNA shape that pays a split-K atomic-reduction pass on wave32. A HIP host reports a seven-field device_identity: the six CUDA fields plus the normalized gcnArchName appended last, with capability None. On the reference R9700 the tuple is ('cuda', 0, 'AMD Radeon AI PRO R9700', None, 32, 34208743424, 'gfx1201') _VERIFIED_RDNA4_PROFILE matches (name, gfx arch, compute units, total_memory) from indices 2/6/4/5 exactly, so a different gfx arch, board name, CU count or memory size cannot inherit the tiles. The CUDA 4090 branch is byte-for-byte unchanged and is reached only by six-field CUDA identities, so neither profile can match the other's device. Measured on gfx1201, 4-bit AWQ FORMAT.GEMM, group_size 128, FP16, mode=auto, median of 41 iterations after 20 warm-ups, 256 MiB L2 flush before every timed call and CUDA events around each launch; "generic" is the legacy_plan tile the device used before this table: (M, N, K, G) tile (BM, BN, BK, split, warps, stages) us generic speedup (32, 8192, 2048, 128) (32, 64, 64, 1, 4, 2) 89.3 348.8 3.90x (64, 8192, 2048, 128) (64, 64, 64, 1, 4, 2) 107.9 654.7 6.07x (64, 4096, 4096, 128) (32, 64, 64, 1, 4, 4) 105.9 366.8 3.46x (64, 2048, 8192, 128) (16, 64, 64, 1, 4, 2) 141.1 235.2 1.67x (127, 8192, 2048, 128) (64, 128, 64, 1, 4, 2) 121.9 1220.7 10.01x (128, 2048, 2048, 128) (32, 64, 64, 1, 4, 4) 78.0 339.6 4.35x (128, 8192, 2048, 128) (64, 128, 64, 1, 4, 2) 123.4 1228.7 9.96x (128, 4096, 4096, 128) (64, 128, 64, 1, 4, 4) 139.8 679.6 4.86x Every swept shape won, so none is left to the generic policy; split_k=1 won everywhere and num_warps=4 is 128 lanes on wave32. The table is FP16-only because awq_gemm_triton rejects non-FP16 input and scales, and _builtin_plan enforces the dtype triple. Independent FP64 Torch oracle (unpacks qweight/qzeros itself, never the kernel): max relative error 3.8e-04..4.6e-04 over the eight shapes, output dtype preserved, repeated forwards bit-identical, no dense dequantized cache (even through the real AwqGEMMTritonLinear forward). tests/kernels/test_awq_rdna4_plan.py passes with no GPU (23 passed, 2 skipped): the exact profile matches, wrong arch/name/CU/memory does not, non-FP16 returns None, unmeasured shapes fall through, the CUDA 4090 profile still matches only a CUDA-shaped identity, and cross-shaped lookalikes match neither. * feat(paroquant): measured RTX 4090 (Ada, SM 8.9) GEMM launch tile The ParoQuant fused GEMM table only had an rdna4 entry, so every other family fell through to the historical (4,128,32,4,2)/(32,128,32,8,4) tile. Sweep the documented 252-tile grid on a 4090 (4-bit, gs=128, FP16, 256 MiB L2 flush + torch.cuda.synchronize, median of 41 after 15 warm-ups) over (K,N) in {(2048,2048),(4096,4096),(5120,8192), (14336,4096),(4096,11008)}. Measured per-band winners, recorded explicitly as an "ada" row-banded entry (decode <=8 rows, prefill 9..64, prefill_large >64): decode (16, 64, 64, warps=4, stages=4) prefill (32, 64, 64, warps=8, stages=4) prefill_large (64, 64, 64, warps=8, stages=4) 1.16x-3.37x faster than the historical fallback across the swept matrix. FP64-oracle max rel error 4.3e-4 (worst shape 14336x4096@1024), dtype preserved. rdna4, the default tile and _RDNA4_MEDIUM_MAX_ROWS semantics are untouched; non-Ada families still get the default. * feat(awq): measured RTX 4090 (Ada, SM 8.9) portable Triton GEMV tile The portable AWQ GEMV table only had an rdna4 entry and launch_config() mapped every non-gfx string to the portable default, so CUDA never reached it. Route the table through tuning_family() (the shared vocabulary every other tuned Triton table uses) and add an "ada" entry. Swept block_n {32,64,128} x max_block_k {256,512,1024} x num_warps {2,4,8} x num_stages {1,2,3} on a 4090 for the FORMAT.GEMV packing (group_size 128 clamps block_k, so max_block_k is a no-op at that group), K,N in {(2048,2048),(4096,4096),(5120,8192),(14336,4096), (4096,11008),(896,128)}, M==1, FP16, 256 MiB L2 flush + torch.cuda.synchronize, median of 41 after 15 warm-ups. Chosen Ada tile: block_n=32, max_block_k=512, num_warps=8, num_stages=1. 1.01x-1.40x faster than the portable default hot and 1.01x-1.16x L2-flushed, never slower on any swept shape. block_n=128 always lost. FP64-oracle max rel error 3.4e-4. rdna4 and _DEFAULT_AWQ_GEMV_LAUNCH are untouched; unregistered families keep the portable default. * docs(awq): correct the Ada GEMV speedup claim to the measured range A longer interleaved A/B (120 hot/flushed iterations after 20 warm-ups) shows the 896x128 case is a launch-bound ~2% loss, not a tie. Record the per-shape numbers honestly, state 1.02x-1.40x hot / 1.00x-1.14x flushed on the five real projections, and pin the documented exception with a test so it cannot be silently relaxed. * bench(ada): paroquant and portable AWQ GEMV sections; measured range fix Add --sections paroquant,awq_gemv to scripts/benchmark_ada_kernels.py. Both drive the shipped tuned tile against the previous fallback through the same protocol (median after --warmup, torch.cuda.synchronize, 256 MiB L2 flush) and report an independent FP64 oracle error plus dtype preservation, so a future retune has a reproducible harness. Also correct the ParoQuant table comment to the measured 1.14x-3.29x hot range (it said 1.56x-3.40x from the tuning sweep's own reference). * test(hw-parity): enforce the AWQ GEMV table and both AWQ GEMM profiles The hardware-parity contract only covered the three shared GPTQ Triton tables plus dedicated ParoQuant/GGUF assertions, so the AWQ paths that now ship measured tiles could regress to a single-family table unnoticed. - Add paroquant_gemm and awq_gemv to TUNED_PIPELINES. Both now carry an "ada" and an "rdna4" entry, so the existing per-family assertion covers them with no new logic. - Pin the AWQ GEMM scheduler's exact device profiles. It keys rules on a device identity rather than a family token, so add a test that builds a six-field CUDA identity and a seven-field HIP identity from the shipped constants, asserts each resolves to its own measured rule, and asserts that a wrong gfx arch, board name, CU count, memory size, or non-FP16 dtype returns None. Hardware-free: 10 passed on both the CUDA and ROCm interpreters. * docs: record the profile-keyed AWQ GEMM and GGUF parity assertions --------- Co-authored-by: fanxi <fanxi@local> Co-authored-by: Lumea-art <[email protected]> Co-authored-by: codex <codex@local>
Adds the AllSpark W8A16 backend for GPTQ and AWQ checkpoints.
GPTQModel.load(..., backend=BACKEND.ALLSPARK)selects the quantization format and CUDA/RDNA4 implementation automatically.group_size=-1), fp16 and bf16. GPTQ requires symmetric quantization anddesc_act=False; AWQ supports affine zero points.Final review fixes in
f25fcfa8c: per-call CUDA scratch, FP32 split-K partials/reduction, CUDA/HIP input/device guards, HIP sentinel bounds, AWQ dtype moves, and package-source inclusion.The local AWQ end-to-end checkpoint is a lossless layout conversion of the real GPTQ checkpoint, not a fresh AWQ calibration. The contributor separately validated a real AWQ checkpoint and perplexity on the 5090 at
e22efa869; that device has not been rerun after the final CUDA fixes.Reproduce timing with random weights and a random eviction buffer:
Current fp16/bf16 timing tables. The 4090 uses GDDR6X; hot timings measure cache residency, and flushed timings include the event-based launch path.