Repository navigation
[CUDA] Expose compilation targets via cuda.get_arch_list - #4761
Conversation
| endif() | ||
| endforeach() | ||
| list(JOIN MLX_CUDA_COMPILATION_TARGETS ";" MLX_CUDA_COMPILATION_TARGETS) | ||
| configure_file(cuda_build_info.h.in cuda_build_info.h @ONLY) |
There was a problem hiding this comment.
configure_file complicates build a lot, for simple case like this I prefer using target_compile_definitions to add a define directly.
| // Compute capability as size_t (to match Metal's variant type) | ||
| dev.info["compute_capability_major"] = static_cast<size_t>(prop.major); | ||
| dev.info["compute_capability_minor"] = static_cast<size_t>(prop.minor); | ||
| dev.info["cuda_compilation_targets"] = cu::compilation_targets; |
There was a problem hiding this comment.
This is no really a device info, it is independent of device. I think we can mirror the torch.cuda.get_arch_list API with mx.cuda.get_arch_list.
61481cf to
496c115
Compare
|
Updated to use an explicit API instead of putting into device_info. |
496c115 to
543ce63
Compare
|
@zcbenz fwiw, the nit refinement seems to be yielding a lot of compiler warnings on MSVC - it does appear to work, but might be something to follow up on. |
|
Could it be related to MSVC version? I think I didn't see the warning locally or in CI. |
|
I believe your CI is using Ninja not the VS generator. I believe Ninja is truncating the list silently so it doesn't trigger the warning and only reports the first target in the list. |
|
We should then revert the changes on the macros 🤦 , thanks for looking into this! |
This change exposes the set of CUDA compilation targets via device info so clients can determine if the build supports the discovered GPU's compute capability. This does not filter out unsupported devices to avoid ID reordering challenges if multiple devices are present, where only some are supported.
Clients can implement the compatibility logic outlined in https://docs.nvidia.com/cuda/cuda-programming-guide/01-introduction/cuda-platform.html#binary-compatibility and https://docs.nvidia.com/cuda/cuda-programming-guide/01-introduction/cuda-platform.html#ptx-compatibility to skip over unsupported devices.
Hypothetical example on a Blackwell GPU when compiled with
MLX_CUDA_ARCHITECTURES=75-real;80-real;120a-real;120-virtual