Skip to content

build(BACKEND-ROCM): route -Wall -Wextra -Werror to the HIP compile language and clear the 19 diagnostics it raises - #2846

Merged
mudler merged 5 commits into
mainfrom
row/BACKEND-ROCM-HIP-WERROR
Sep 3, 2026
Merged

build(BACKEND-ROCM): route -Wall -Wextra -Werror to the HIP compile language and clear the 19 diagnostics it raises#2846
mudler merged 5 commits into
mainfrom
row/BACKEND-ROCM-HIP-WERROR

Conversation

@localai-org-maint-bot

@localai-org-maint-bot localai-org-maint-bot commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Row

BACKEND-ROCM — one row per PR. Spec: .agents/specs/rocm-hip-werror.md.

Before starting

What changed

vllm_cpp_set_warnings gains a $<$<COMPILE_LANGUAGE:HIP>:-Wall -Wextra ${_vllm_cpp_werror}> arm beside the CXX, OBJCXX and CUDA arms it already had, and the 19 diagnostics that arm raises are cleared at their source. Sixteen are dead code and are deleted; the other three are a (void) on three hipError_t results the runtime discards on purpose, the parentheses C++ already applies to one decode predicate, and one explicit unsigned cast. No kernel computes anything different.

${_vllm_cpp_werror} rather than the literal -Werror the OBJCXX line uses, so a HIP build under a sanitizer lane keeps the diagnostics visible and non-fatal for the same reason the CXX arm does.

The count, which the issue asks for first

Measured on strix:gpu0 (gfx1151, ROCm/HIP 7.2.53211), rc job 60f7861d, two arms, each a fresh configure into a fresh build directory, each compiling all 23 HIP objects:

Arm HIP flags raw warning lines unique file:line:col:flag
A as-committed 6 3
B -Wall -Wextra, no -Werror 46 19

Zero of the 19 are in a ROCm or system header. Asked of the build system rather than the cmake source: on arm A a HIP compile line carries -Wall 0 times and -Werror 0 times; on arm B, -Wall once and -Werror still 0 times. By class: -Wunused-function 10, -Wunused-value 3, -Wunused-const-variable 2, -Wlogical-op-parentheses 2, -Wunused-parameter 1, -Wsign-compare 1.

19 is small, so this pull request adds the flag and clears them rather than reporting the size and stopping.

The ten unused-function reports are real dead code, not a HIP host-pass artefact

__device__ functions are not emitted in the host pass, so "clang reports a used __device__ helper as unused" is the obvious hypothesis. The line numbers refute it. Each of rocm_gdn_conv.hip, rocm_gdn_fused.hip and rocm_gdn_postconv.hip declares three Ld and three St overloads on consecutive lines — float, __half, __hip_bfloat16 — and in all three files exactly one Ld line and one St line is reported, and it is always the __half one. The neighbours are silent because kernels instantiate them. A pass artefact would report all six. After deletion, grep -c __half returns 0 in all three files. The other four warned symbols appear in their file exactly once, at their own definition.

Evidence

rc job c74c0cdf-804f-4666-a155-00fa0f59b963 on strix:gpu0. Four arms, each a fresh configure into a fresh build directory, ninja -k 0 over the same 23 HIP objects.

Arm Tree -Werror on a HIP compile line ninja rc objects distinct errors Result
RED flag added, nothing cleared 1 1 14/23 15 BUILD_FAILED
GREEN this branch 1 0 23/23 0 BUILD_OK
MUT this branch + a bare hipError_t 1 1 ≥1 BUILD_FAILED
CTRL base tree + the SAME bare hipError_t 0 0 23/23 0 BUILD_OK

The mutation is the exact construct #2713 is about, applied identically to both trees. On this branch it reads error: ignoring return value of type 'hipError_t' declared with 'nodiscard' attribute [-Werror,-Wunused-value]. On the base tree the same line reads warning: and the build goes green. The control is the part that matters: without it a red MUT proves only that the build broke, not that the new flag broke it.

RED reports 15 rather than 19 because the four missing ones — rocm_paged_attn.hip:30, :335, :448, :451 — are end-of-translation-unit diagnostics in the single unit that hard-fails earlier on -Wlogical-op-parentheses, and clang stops before emitting them. GREEN is what shows all 19 were cleared.

The arms were archived from commits later reworded to repair an Assisted-by value. The trees are byte-identical (da7b2417… RED, 38d96fce… GREEN), verified with git rev-parse <sha>^{tree} on both the pre- and post-reword commits, so the result binds to the commits on this branch.

After merging origin/main

main moved under this branch, so the measurement above was re-checked rather than assumed still valid. git diff --name-only ca07f6e94 origin/main shows main touched none of the eleven files this branch edits. The only headers it changed are include/vllm/multimodal/{audio_processor,dots3_note_processor}.h, and grep -rl "vllm/multimodal" src/vt/ returns nothing — no vt translation unit reaches them — so the preprocessed input to all 23 HIP units is byte-unchanged by the merge. Re-read on the merged tree: 23 HIP translation units, the HIP genex present once, enable_language(HIP) still at CMakeLists.txt:404, vllm_cpp_set_warnings(vllm) still at :1484.

Two rebuilds are queued on strix:gpu0 behind other sessions' leases, and neither result is in this body:

Speed claims

  • This PR makes NO speed claim.
  • the operator ran the numbers under ${GPU_LOCK}.

Honest gaps

  • CI cannot rerun this gate. No CI lane has a HIP toolchain, so the flag is enforced only where somebody builds the ROCm backend. Deletion of the genex is a regression nothing here detects. Recorded in the spec under ## Owed; not repaired, because the derived checker that would catch it needs an exception list for C and ASM, and a list is the transcription this file's own rules warn about.
  • One architecture, one ROCm release. gfx1151 and ROCm 7.2.5 only. -Wall -Wextra output is target-independent for these six classes, but that is reasoning, not a measurement, and no second gfx target was built.
  • No kernel was executed. Every arm is a compile. The claim that no repair changes what a kernel computes rests on per-site reading — deletions of code with zero call sites, a parenthesisation matching C++'s existing precedence, and a cast on a value mindiv returns positive by construction — not on a numeric gate.
  • The job's own "red classes" tally line printed nothing: its regex expects [-Wflag] and the -Werror spelling is [-Werror,-Wflag]. The per-error list above it is complete and is what the table reports; the tally was not relied on.

Closes #2713

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]

…before the repair

#2713 asks for the number first, because a large one makes the flag a build
break rather than a detector. Two arms on strix:gpu0 give 3 diagnostics under
clang defaults and 19 under -Wall -Wextra, all 19 in project code and none in a
ROCm header. The spec records the arms, the per-class disposition, and the
evidence that the ten unused-function reports are real dead code rather than a
HIP host-pass artefact.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]
…P compile language

enable_language(HIP) makes .hip a distinct COMPILE_LANGUAGE, and the 23 HIP
sources land on the same `vllm` target the CXX genex covers. The function had no
HIP branch, so those translation units were the only project code whose
diagnostics could not fail a build.

This commit adds the flag and nothing else, so the 19 diagnostics it raises are
a red result that a reader can reproduce at this exact commit. The next commit
clears them.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]
…r arm raises

The previous commit armed -Wall -Wextra -Werror on the HIP compile language.
This commit clears what it found, so the ROCm backend builds green under the
flag that now guards it.

Sixteen of the nineteen are dead code and are deleted: the __half Ld/St overload
pair in each of the three GDN files, which no kernel instantiates while the
float and __hip_bfloat16 overloads beside them do; DotFp8Row, LoadRow8Bf16,
StoreRow8Bf16 and one GridFor, each mentioned in its file exactly once at its own
definition; the kBlock and kDecEpl constants in the paged-attention unit; and the
`tokens` parameter that RopeFromCacheK never reads, because the kernel derives
its own token index from the flat index.

The other three change no computation. graph_dedup_runtime.h now casts to void
the three hipError_t results the runtime discards on purpose, which is the exact
class #2713 was filed about. The decode GQA4 predicate gains the parentheses C++
already applied, since && binds tighter than ||. The skinny-GEMM warp guard casts
its int bound to unsigned, matching the two casts below it; mindiv returns a
positive count by construction.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]
…e control

The spec stated the gate; this records what it returned. RED fails on 15 errors,
GREEN builds all 23 objects clean, and the mutation the issue names fails on this
branch while the identical mutation on the base tree still only warns.

The control arm is the part worth keeping: without it, a red MUT proves only that
the build broke, not that the new flag is what broke it.

RED reports 15 rather than 19 because the four end-of-translation-unit
diagnostics live in the one unit that hard-fails earlier, and clang stops before
emitting them. The note records that, and records that the job's class-tally line
printed nothing because its regex does not match the -Werror spelling.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]
… branch

main moved 900-odd commits since this branch was cut, and the HIP warning arm
has to hold against what landed there rather than against the tree it was
measured on. The merge message is authored because a --no-edit merge lands
trailer-less and reds the trailer walk.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]
@mudler
mudler merged commit 6f6caa7 into main Sep 3, 2026
3 of 17 checks passed
mudler added a commit that referenced this pull request Sep 3, 2026
… on HIP

#2846 landed, so main carries the HIP -Wall -Wextra -Werror genex. This branch
rewrites LtWorkspace, and that rewrite has never been compiled under the flag.
Merging first turns a pairwise risk no gate here can see (#2848) into a
sequential one the ordinary ROCm build covers.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: AGENT:claude-opus-5-1m [claude-code]
@mudler
mudler deleted the row/BACKEND-ROCM-HIP-WERROR branch September 3, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

-Werror never reaches HIP translation units, so a bare hipError_t warns instead of failing the build

2 participants