Skip to content

cuda: clear error for sm_6x and older (Pascal) instead of an NVRTC compile failure - #28

Merged
Vasyl-Trefilov merged 1 commit into
RustingStudio:mainfrom
yugt:sm61-clear-error
Nov 11, 2026
Merged

Vasyl-Trefilov merged 1 commit into
RustingStudio:mainfrom
yugt:sm61-clear-error

Conversation

@yugt

@yugt yugt commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #27, as agreed there.

What it does

On a card older than Volta the CUDA backend now stops before compiling anything:

Error: CUDA init

Caused by:
    NVIDIA GeForce GTX 1080 Ti is sm_61: the CUDA backend requires sm_70 or newer (Volta, Turing, Ampere and later); Pascal and older cards have no tensor cores and are not supported

Before, the same command printed cuda device 0: NVIDIA GeForce GTX 1080 Ti, sm_61 (Volta, m8n8k4) and failed in NVRTC with identifier "__nanosleep" is undefined.

  • min_arch_error(name, cc) in src/cuda/mod.rs, called in Gpu::new right after compute_capability().
  • The error carries the CUDA init context, like a missing driver or a missing NVRTC. So without --backend, backend::open goes on to Vulkan and, when that fails too (on this card it does, missing shaderFloat16), prints both reasons. The tests skip the CUDA backend on such a card instead of failing. Say if you would rather have it fatal.
  • device_log no longer labels cc < 7.0 as Volta. Gpu::new does not reach it for such a card any more, so this is only a guard.

No change for sm_70 and newer.

Tested

  • GTX 1080 Ti (sm_61, driver 580.95.05, NVRTC 12.6): bench --backend cuda gives the error above; bench without --backend gives no GPU backend loads: CUDA: CUDA init: NVIDIA GeForce GTX 1080 Ti is sm_61: ...; Vulkan: Vulkan init: no usable Vulkan device 0 (0 usable; NVIDIA GeForce GTX 1080 Ti: missing shaderFloat16); cargo test --test kernels skips both backends (26 passed).
  • V100 16 GB (sm_70, NVRTC 12.6): bench with --backend cuda, without --backend, and with --backend vulkan run as before.
  • The 9 unit tests on min_arch_error, arch_support_error and device_log pass on both hosts (3 are new).
  • Not run: the full suite on this branch. On the V100, --test kernels has the 4 Vulkan f16 failures of main that docs: RTX 2080 Ti, Quadro RTX 6000, V100, A40, RTX A6000, RTX 4500 Ada and A100 40 GB results; GTX 1080 Ti does not run #27 fixes; nothing else fails there.

🤖 Generated with Claude Code

https://claude.ai/code/session_014eNPMupWL2tifApEBfcCgi

On a GTX 1080 Ti (sm_61) `--backend cuda` printed `sm_61 (Volta, m8n8k4)` and then failed inside NVRTC with
`identifier "__nanosleep" is undefined`. `Gpu::new` now returns a "CUDA init" error that names the card and the
sm_70 minimum before anything is compiled, so `backend::open` goes on to Vulkan and reports both errors, and the
tests skip the backend. `device_log` no longer labels a pre-Volta arch as Volta.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014eNPMupWL2tifApEBfcCgi
@Vasyl-Trefilov

Copy link
Copy Markdown
Member

Looks good, and I agree with keeping it non-fatal — the CUDA init context makes the auto path try Vulkan and lets the tests skip. Two small things: maybe drop the "no tensor cores" justification and just say sm_70+ is required, and update the 1080 Ti note in #27/SUPPORTED_GPUS so it says it's rejected at init instead of failing in NVRTC. Unit tests pass here (27/27). Mergeable from my side.

@Vasyl-Trefilov
Vasyl-Trefilov merged commit 9dd6340 into RustingStudio:main Nov 11, 2026
2 checks passed
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.

2 participants