Skip to content

build: one definition of the arch-sensitive shim flags, and a multi-arch shim image - #153

Merged
dpsoft merged 2 commits into
mainfrom
feat/shim-multiarch
Sep 19, 2026
Merged

dpsoft merged 2 commits into
mainfrom
feat/shim-multiarch

Conversation

@dpsoft

@dpsoft dpsoft commented Sep 19, 2026

Copy link
Copy Markdown
Owner

With the USDT probes ported (#152), the shim image can go multi-arch. Doing that naively would have meant adding aarch64 branches to two more places — so this consolidates first.

Four copies became one

The same compile command existed in four places, each spelling out -mtls-dialect and targets/x86_64-linux for itself:

before
shim/Makefile CXXFLAGS -mtls-dialect=gnu
shim/Makefile CUDA_INC/CUDA_LIB targets/x86_64-linux
shim/Makefile nvidia-portable both, again
ci.yml × 2 both, again, inline

TLS_DIALECT and CUDA_TARGET are now derived once from uname and used everywhere. A third architecture is two lines in one ifeq rather than four edits that can silently disagree — and disagreement here is invisible until a shim is built with the wrong TLS dialect and fails to dlopen, which is exactly what #121 was.

CI stops inlining the portable build and calls make -C shim nvidia-portable with CONTAINER=docker (the runtime is the only thing that genuinely differs there). It also stops passing CUDA_INC, which is what let the job and the Makefile disagree about the target directory in the first place.

A check that could not fail

elfgate.sh greps for GLIBC_ABI_GNU2_TLS. That is an x86-64 marker — on aarch64 the string is never emitted, so the gate would have reported absent and meant nothing by it. A check that cannot fail, dressed as a check that passed, about the very property the gate exists to protect.

It now reports n/a (x86-64 marker; this object is AArch64). The numeric glibc floor carries the weight on ARM, and that check is genuinely arch-neutral: a TLS dialect that raised the requirement would show up in it.

The flip

Dockerfile.shim was already arch-parameterised (#151), so removing the if: matrix.arch == 'amd64' guards is all that remained. Both images now build on both arches in CI and publish real manifest lists.

Verified locally

The exact path CI now takes — make -C shim nvidia-portable — produces GLIBC_ABI_GNU2_TLS absent, glibc requires 2.34 (limit 2.34), one export, no libstdc++, no runpath, 14 USDT notes, -> portable. Shim suite exits 0; 36 packages pass.

Still not tested on ARM

The CUPTI integration, for want of an arm64 GPU node. That part is arch-independent C++ calling CUPTI APIs rather than anything register-level, but it has not been run, and the README says so rather than implying full support.

https://claude.ai/code/session_01P5889hA6CrX8ysnQkvv6im

…rch shim

The same compile command existed in four copies -- shim/Makefile's
CXXFLAGS, its nvidia-portable target, and twice inline in ci.yml -- each
spelling out -mtls-dialect and targets/x86_64-linux for itself. Adding
aarch64 inline would have made six. Divergence between copies is
invisible until a shim is built with the wrong TLS dialect and fails to
dlopen, which is precisely what #121 was.

TLS_DIALECT and CUDA_TARGET are now derived once from uname in
shim/Makefile and used everywhere. A third architecture is two lines in
one ifeq rather than four edits that can disagree. CI stops inlining the
portable build and calls the Makefile target, with CONTAINER=docker
because the runtime is the only thing that genuinely differs there; it
also stops passing CUDA_INC, which is what let the job and the Makefile
disagree about the target directory.

elfgate.sh now reports the GLIBC_ABI_GNU2_TLS marker as n/a on
non-x86-64 rather than "absent". That string is never emitted on aarch64,
so reporting absence there would be a check that cannot fail dressed as
a check that passed -- about the very property the gate exists to
protect. The numeric glibc floor carries the weight on ARM and is
genuinely arch-neutral.

With the probes ported (#152) the shim image builds and publishes on
both architectures, and both images get real manifest lists.

The CUPTI integration is still unexercised on ARM for want of an arm64
GPU node, and the README says so rather than implying full support.

Claude-Session: https://claude.ai/code/session_01P5889hA6CrX8ysnQkvv6im
Both arches failed the gate, which is the useful shape of failure: it
says the break is mine rather than the architecture's.

Calling make -C shim nvidia-portable instead of inlining the compile
moved the artifact. The Makefile writes it next to the sources in shim/;
the inline copy wrote it to the repo root, and the "Prove it loads" step
still looked there -- so dlopen reported a missing file rather than an
unloadable one. Running the make target locally did not catch it because
the step that consumes the artifact is the next one along.

Also fixes a collision the gate never reached: matrixing the job left
both arches uploading an artifact under one name, which
upload-artifact@v4 refuses. Per-arch now.

Claude-Session: https://claude.ai/code/session_01P5889hA6CrX8ysnQkvv6im
@dpsoft
dpsoft merged commit 5aa30b2 into main Sep 19, 2026
16 checks passed
@dpsoft
dpsoft deleted the feat/shim-multiarch branch September 19, 2026 23:02
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