Repository navigation
fix(finalizer): accept CUDA cubin ELF format versions - #622
nihalpasham merged 1 commit into
Conversation
Signed-off-by: nik <[email protected]>
0f15c47 to
348bd74
Compare
|
LGTM. Follow-up from closing #388 / #389 : CUDA 11.x/12.x toolchains really do write the toolkit version into Verified locally:
Merging; closes #621. |
|
So this is actually stricter than "accept any nonzero": version 1 is always accepted, and the CUDA 12 encodings (120 through 129) are only accepted when the CUDA ABI byte is 7. That's technically the version allowlist #621 said to avoid. I'm fine with it here, because this range can't rot the way an open-ended list would: the CUDA 12 series ended at 12.9, and CUDA 13 went back to writing 1, so it's a closed set of historical values. Re-checked everything against the new head:
|
Closes #621.
Summary
cuda-artifact-finalizerrejected genuine CUDA 12.8 nvJitLink output becauseit required the CUDA ELF header's
e_versionto equal generic ELFEV_CURRENT. CUDA uses this field as a nonzero cubin binary-format version;the installed toolkit emits
0x80. This accepts nonzero CUDA format versionswhile keeping the validator fail-closed for zero, truncation, malformed tables,
and invalid payload ranges.
What changed
Treat e_version as CUDA's format version
is_valid_cubinrule frome_version == 1toe_version != 0.forward-compatible with CUDA's use of this field for its cubin format
version, while all surrounding CUDA ELF identity and structural checks still
apply.
Preserve validation boundaries and cover real output
EM_CUDAmachine, header-size, extended-count, header-table, file-backedsegment/section, payload-bound, and meaningful-content checks unchanged.
1and CUDA version0x80are accepted while zero is rejected.table-bound coverage.
installed-toolkit acceptance responsibility explicit without hardcoding
0x80as an evergreen toolkit invariant.both continue to use this one shared validator.
Known separate limitations
artifact through the CUDA Driver.
finalizer routing, or multi-artifact behavior.
available and that patch targeted a validator removed from
cuda-host.This branch targets the current shared finalizer validator and includes a
reproducible CUDA 12.8 nvJitLink sample whose
readelf -houtput reportse_version = 0x80.cuobjdumpaccepts it and decodes the same header field as toolkit version12.8.
an allow-list of releases known when this code was written. CUDA Driver
loading remains the compatibility authority; zero is retained as the
structurally invalid sentinel.
discoverable libNVVM, nvJitLink, and libdevice.
Testing
bead880c:cargo test -p cuda-artifact-finalizer validation::tests::accepts_nonzero_cuda_toolkit_versions_and_rejects_zero -- --exact --nocapturefailed specifically when the otherwise-valid fixture's
e_versionchangedfrom
1to0x80.bead880c:cargo test -p cuda-artifact-finalizer live_tests::live_pipeline_accepts_toolkit_cubins_and_emits_ptx_for_both_fma_policies -- --exact --ignored --nocapturefailed when
link_ltoirreturnedInvalidCubin.ptxas V12.8.93) forsm_86.The 1,648-byte cubin had SHA-256
adc1bab82a3988bb8083a4d33251a3e7403b5644ff2a509f9d27f9a7b1920c98;readelf -hreported ELF64, little-endian, executable, NVIDIA CUDAarchitecture, and header
Version: 0x80./usr/local/cuda/bin/cuobjdump -elfaccepted the retained binary andreported
64bit elf: type=2, abi=7, sm=86, toolkit=128.libnvJitLink.so.12.8.93SHA-2560369e6867d44b800437de4e146d72c65afc6c75adf677a15c2ecd8e6a7ac135f;libnvvm.so.4.0.0SHA-256dfb07dc65ffb0f7a16bc82ee1f87d7f4634b908d30aa8103d1e28afb1fe6589e;libdevice.10.bcSHA-25625498d6e3c64782833ff15a5f56665ff09e5d21177163148a1cf008c61733449.cargo test -p cuda-artifact-finalizer --all-targets— 13 passed, 1 ignored.cargo clippy -p cuda-artifact-finalizer --all-targets -- -D warnings—passed.
cargo fmt --all -- --check— passed.git diff --check— passed.Checklist
main, or its dependency is explicit.mainand passes on this branch.