Module arch_preflight

Module arch_preflight 

Source
Expand description

Refuse to load kernels the GPU cannot run, BEFORE the driver does it badly.

Atlas compiles one SM architecture per build, and the driver’s answer to a mismatch is CUDA_ERROR_NO_BINARY_FOR_GPU (or CUDA_ERROR_UNSUPPORTED_PTX_VERSION) raised inside cuModuleLoadData — an error that names neither the arch in the binary nor the card in the box. An operator who boots the published gb10 image on an H100 gets that, and nothing to act on.

So this runs first: two cuDeviceGetAttribute calls, the pure rule from atlas_core::arch, and a message that names both sides. The rule itself lives in atlas-core because --check-kernels reports it too.

The capability query is addressed BY ORDINAL (cuDeviceGet), not by “the calling thread’s current context” (cuCtxGetDevice). That is not a style preference — see device_compute_capability_of. cuDeviceGetAttribute and cuCtxGetDevice were already declared for the SM-count query; cuDeviceGet is the one addition, alongside them.

Functions§

check_arch
The verdict, without touching a GPU: Ok(line to log) or the mismatch.
check_sm_count
Does the running device have the SM count this build’s kernels were sized for? None when it agrees, Some(warning) when it does not.
device_compute_capability
(major, minor) compute capability of the calling context’s device.
device_compute_capability_of
(major, minor) compute capability of GPU ordinal, with NO current context required on the calling thread.
device_sm_count_of
Streaming multiprocessors on GPU ordinal, with NO current context required — addressed the same way, and for the same reason, as device_compute_capability_of.
preflight_arch
Which architecture string a resolved target’s preflight must judge.
preflight_device_arch
Fail fast if this binary’s kernels cannot run on GPU ordinal.