ptx_arch_runs_on_device

Function ptx_arch_runs_on_device 

Source
pub fn ptx_arch_runs_on_device(
    compiled_arch: &str,
    device_cc: (u32, u32),
) -> Result<(), ArchMismatch>
Expand description

Can PTX compiled for compiled_arch run on a device of device_cc?

ORACLE: NVIDIA CUDA C++ Programming Guide, “Application Compatibility” → PTX Compatibility, plus NVIDIA’s CUDA 12.9 announcement of family-specific features (developer.nvidia.com/blog/nvidia-blackwell-and-nvidia-cuda-12-9- introduce-family-specific-architecture-features/, re-read 2026-09-05): compute_100f “is compatible with all CC 10.x devices (sm_100, sm_103)”, while the a suffix “is not forward-compatible with any future GPU architecture”. Exactly three rules:

  1. plain sm_XY runs on any device with CC >= X.Y (JIT forward-compat);
  2. sm_XYa runs ONLY on CC == X.Y;
  3. sm_XYf runs on the same major family with CC >= X.Y.

A compiled_arch that is not an NVIDIA SM arch (gfx1151, metal3.1) returns Ok(()): a CUDA compute capability says nothing about it, and inventing a verdict would fail every AMD and Apple build. Callers that need to know use parse_sm_arch, whose None is the marker.