You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CUDA C++ has the `__CUDA_ARCH__` macro for conditional compilation.
rust-cuda has a `CUDA_ARCH` environment variable that is similar, and
the `from_cuda_arch_env` method parses the environment variable's value
to produce a value of type `ComputeCapability`, which can be queried for
conditional compilation.
But `ComputeCapability` has a big problem. It's missing all the
capabilities after 80, including the 'a' and 'f' suffix ones. We could
just add them, but it implements `PartialOrd`/`Ord` and uses ordering to
determine feature availability. This was valid before the 'a' and 'f'
suffixes were added but is no longer, because some pairs of values are
incomparable. E.g. `100a` and `101a` -- each one has some features the
other doesn't, so neither is clearly larger than the other, and they're
also not equal.
So, what to do? Well, `CUDA_ARCH` was added in 2022. More recently,
another mechanism for conditional compilation was added:
`target_feature`, in #239. This does work with the 'a' and 'f' suffix
targets, and it's more Rust-y.
So this commit just removes `CUDA_ARCH` and `ComputeCapability`
(removing two more places where the default compilation target is
specified) and changes the only uses (in `cuda_std/src/atomic/mid.rs`)
to use `target_feature` instead. We don't have any tests exercising
conditional compilation, alas, but I did some manual checking locally to
verify that it works the same.
0 commit comments