Skip to content

build: add a coverage target and CI job - #154

Merged
Zaneham merged 5 commits into
masterfrom
coverage-target
Aug 7, 2026
Merged

build: add a coverage target and CI job#154
Zaneham merged 5 commits into
masterfrom
coverage-target

Conversation

@Zaneham

@Zaneham Zaneham commented Aug 2, 2026

Copy link
Copy Markdown
Owner

Adds make coverage plus a CI job that posts the gcovr summary to the PR and uploads the HTML report. No threshold yet, since the baseline needed to exist first.

kath is instrumented alongside trunner because trv_elf, ttdf and ttriton reach the backend by shelling out to it. The build needs -U_FORTIFY_SOURCE and -w: at -O0 glibc warns on the former, and -Wformat-truncation loses the range info it uses to prove bounds at -O2. The normal build is untouched and stays the warnings gate.

The first run showed src/amdgpu/ra_ssa.c at 0% across 759 lines, so tests/tra_ssa.c follows. The SSA allocator is gated behind --ssa-ra and nothing had ever passed the flag. Seven tests now drive it end to end and check the two things an allocator must not get wrong: no virtual registers left behind, and nothing used past the count the kernel descriptor declares.

before after
ra_ssa.c 0% 93.3%
lines 70.4% 73.4%
functions 83.7% 85.2%
branches 54.7% 58.0%

Two bugs this turned up

--ssa-ra leaves virtual registers unallocated, and verify.c rejects the result:

  • Six fixtures fail: canonical.cu, notgpt.cu, stress.cu, cuda_features.cu, device_calls.cu, test_struct.cu. Smallest repro is device_calls.cu, two leaks on the final global_store_dword address pair.
  • Any --max-vgprs below 8 leaks on kernels the default allocator handles down to 2, so the spill path is affected as well.

Both are pinned as expected failures in tests/tra_ssa.c rather than skipped, so fixing the allocator trips this file and forces the lists to be updated. Neither is fixed here.

Separately, the nv > RS_MAX_VR guard at the top of ra_ssa() is dead: nv is clamped to RS_MAX_VR on the line above, so the too-many-vregs fallback is unreachable. Left alone, flagging it.

ra_ssa also joins cat_order in tmain.c so --cat can reach it; unlisted categories only run in the orphan pass, unlabelled and unfilterable.

make coverage builds kath and trunner instrumented into their own object
tree, runs the suite, and reports via gcovr. kath is instrumented too since
trv_elf, ttdf and ttriton reach the backend by shelling out to it.

Needs -U_FORTIFY_SOURCE (glibc warns at -O0) and -w (-O0 loses the range
info -Wformat-truncation needs, so the strict set fires on fine code). The
normal build stays the warnings gate.

CI reports only, no threshold, until the baseline settles.
Zaneham added 4 commits August 2, 2026 18:15
ra_ssa.c was at 0% -- it sits behind --ssa-ra and nothing passed the flag.
These drive it end to end and check what an allocator must not get wrong:
no virtual registers left behind, and nothing used past the count the kernel
descriptor declares. 0% to 93%, and the tree goes 70.7% to 73.7%.

Two real bugs fell out. Six fixtures (canonical, notgpt, stress,
cuda_features, device_calls, test_struct) leave vregs unallocated, and so
does any --max-vgprs below 8 on kernels the default allocator handles down
to 2. Smallest repro is device_calls.cu, two leaks on the final store's
address pair. Both are pinned as expected failures rather than skipped, so
fixing the allocator trips this file and forces the lists to be updated.

Also adds ra_ssa to cat_order so --cat reaches it. Unlisted categories only
run in the orphan pass, unlabelled and unfilterable.
@Zaneham

Zaneham commented Aug 7, 2026

Copy link
Copy Markdown
Owner Author

It goes without saying this doesn't count MOA or the SLATEC CI jobs

@Zaneham
Zaneham merged commit 2892a15 into master Aug 7, 2026
12 checks passed
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.

1 participant