perf(BACKEND-ROCM): cooperate across Q8_K activation blocks - #2472
Conversation
Issue mudler#1876 needs a committed correctness and measurement contract before the ROCm kernel changes. This specification pins the byte oracle, both production routes, the same-binary lever, and the gfx1100 adoption gate. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
Pull request mudler#2270 owns the reviewed gate prompt, so this branch must not duplicate it. The gate now permits local validation against the immutable reviewed worktree. Publication remains ordered after a maintainer lands the prompt. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
Only gfx1100 has accepted measurement authority. A global unset default could therefore enable the cooperative arm on unvalidated devices. The specification now makes unset selection device-scoped and requires resolver-keyed policy tests before product code. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
The legacy ROCm quantizer serializes each 256-element activation block. Use one 256-thread block while preserving the Q8_K byte encoding. Keep the architecture-scoped unset policy on the legacy arm until the operator accepts the real-checkpoint performance gates. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
Host route counters proved selection before launch, so a legacy kernel could still satisfy the candidate route assertion. Record one arm-specific count inside the launched kernel and combine it with both production route checks. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
The accepted gfx1100 correctness, route, engine, and profiler gates justify the architecture-scoped default. Other architectures remain legacy, and strict controls retain same-binary diagnosis and rollback. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
Pull request mudler#2270 supplies the tracked TG200 prompt and current main's derived issue-ownership policy. This merge retains the fully reviewed gfx1100 Q8_K behavior and takes the frozen completed issue index byte-for-byte from current main. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
Pull request mudler#2270 supplies the tracked prompt prerequisite. Issue mudler#1876 remains open for gfx1200 and gfx1201 acceptance. The authenticated account cannot add the live `Row:` line. The spec's `## Owed` link supplies `BACKEND-ROCM` ownership. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
Current main adds the attention-window resolver and the GLM5 k-pool device seam. Its eighteen changed paths do not overlap the six reviewed Q8_K surfaces. The merge keeps every reviewed Q8_K blob, the specification ownership repair, and the tracked prompt byte-for-byte unchanged. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
Current main carries the connector tile repair across ten CPU and LTX2.5 paths. None overlaps the six reviewed Q8_K target-relative paths. The merge preserves every reviewed Q8_K blob and the tracked publication prompt byte-for-byte. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
Publication-time main adds the multimodal input pipeline without touching the six reviewed Q8_K paths. The merge preserves those blobs and the tracked TG200 prompt while retaining current main’s GLM and preflight changes. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: AGENT:gpt-5 [codex]
|
CI classification for reviewed head The three red jobs reproduce on target main and are not introduced by this six-path ROCm change.
The pull-request diff contains only the Q8_K specification, three documentation projections, All other executed PR jobs passed, including |
…ec header extraction main moved the four device half/bfloat16 conversions out of rocm_grouped_gemm.hip into vt/rocm/rocm_f16_codec.h when BACKEND-ROCM-EXL3 needed two of them for the trellis decode. This branch adds an include of vt/rocm/rocm_runtime.h at the same line, so the two additions collided textually while agreeing semantically. Resolved by keeping BOTH includes. The header declares the four helpers in namespace vt::rocm, which is the namespace this translation unit's code already sits in, so the 16 unqualified uses across the cooperative Q8_K work still resolve. The conflict was one line on each side and no other hunk in the file was contested: the merge otherwise takes main's Fmt==3 Q6_K small-private arm, Q6KSmallPrivateEnabled and its dispatch, and the IQ3_S spelling in the unsupported-dtype message, alongside this branch's Q8_K cooperative kernel and its witness counter. Not verified by compilation. This host has no hipcc, and no CI lane here builds a .hip translation unit, so this resolution is checked by symbol and namespace resolution and by confirming the file's brace balance is unchanged. The ROCm arm rests on the contributor's own gfx1100 evidence. FOLLOWING_AGENTS_PROTOCOL Following-Agents-Protocol: true AI-Assisted: true Assisted-by: claude-code:claude-opus-5 [Claude Code]
Row
BACKEND-ROCMBefore starting
## Owedbecause the authenticated account cannot add its liveRow:line..agents/specs/rocm-q8k-cooperative-quantizer.mdwas committed before product code. It owns the byte oracle, production routes, architecture policy, acceptance gate, evidence, and remaining work.src/vt/cuda/cuda_quant_dot.cu::QuantizeQ8KPreqKernelandLaunchQuantizeQ8K. The CPUQuantizeRowQ8_Kpath supplies an independent byte oracle.What changed
The ROCm Q8_K activation quantizer now cooperates across one 256-thread block instead of assigning one thread to each 256-element superblock. One shared launcher serves both dense and grouped production paths.
The encoder preserves all 292 bytes of
BlockQ8_K, including signed first-occurrence ties. Kernel-resident test witnesses prove which arm executed instead of relying only on host dispatch counters.Unset selection enables the cooperative arm only when the queue-device resolver returns
gfx1100. ExactVT_ROCM_Q8K_BLOCK=0keeps the permanent legacy arm, exact1forces the diagnostic candidate, and other values fail. Unset remains legacy forgfx1200,gfx1201, unknown architectures, and resolver failure.Evidence
0ee8722daac3199de6d395af099eff3d230c9fa5has tree31563a03b5a202a552fcd68c1fcce773295a962b. Fresh immutable review returned findingsNONEand verdictPASS.0, exact1, unset, and invalid values.0, bypassed grouped candidate execution, removed environment documentation, removed issue ownership, and injected an integration overlap. Each failed for its intended reason and restored byte-for-byte.769bf8eebae5390db7b6aec5b9ab8e84caa9bc4124f659d77b7240f4494ed245.docs/ROCM.md,docs/USAGE.md, anddocs/ENVIRONMENT.mddocument the architecture-scoped default and strict rollback control.Speed claims
/home/vikash/gpu.lockon an RX 7900 XTX. The candidate won 5/5 pairs: median decode rose from 30.943 to 40.316 tok/s, a 31.377% median paired improvement with one-sided sign-testp=0.03125.rocprofv3subtraction pairs per arm measured 129 quantizer calls per token. Median quantizer time fell from 7.8811 to 0.3426 ms/token, while total kernel time fell from 25.7287 to 18.1923 ms/token.docs/BENCHMARKS.mddoes not change.Honest gaps
gfx1200andgfx1201lack runtime acceptance. Their unset policy remains legacy, explicit1makes no support or speed claim there, and issue QuantizeQ8KK is thread-per-superblock: 95.5us/call against llama.cpp's 1.6us, and 41% of the ROCm decode gap #1876 remains open for that work.Addresses #1876.
FOLLOWING_AGENTS_PROTOCOL
Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:gpt-5 [codex]