pub(crate) fn detect_sm_for_device(device_id: u32) -> Option<String>Expand description
Returns the GPU compute capability as a smXY string for the given CUDA
device, or None if detection fails for any reason.
The format is the same one ORT uses in its engine plan basenames (e.g.
_sm120.engine), so the return value can be plugged directly into the
SM-filtered enumerators in super::trt_cache.
This function is a thin wrapper around nvidia-smi. It is intended to be
called once per worker at TRT prewarm time and the result cached; do not
call it on every request.
Failure-mode contract:
nvidia-smibinary missing or unexecutable →None- subprocess exits non-zero →
None - stdout cannot be parsed as
"X.Y"→None
All failure cases are non-panicking. The caller is expected to log a
WARN and proceed with None semantics (no SM filter applied).