Add compile-time 256-bit vector guard for pre-Blackwell (#19794)

This commit is contained in:
xingsy97
2026-03-20 18:25:12 +08:00
committed by GitHub
parent 2dd9196079
commit f41832795e
4 changed files with 15 additions and 16 deletions

View File

@@ -73,8 +73,10 @@ struct alignas(sizeof(T) * N) AlignedStorage {
template <typename T, std::size_t N>
struct AlignedVector {
private:
/// NOTE: N must be a power of two and sizeof(T) * N <= 32 bytes (256 bits)
static_assert((N > 0 && (N & (N - 1)) == 0) && sizeof(T) * N <= 32, "CUDA only supports at most 256-bit vector op");
static_assert(
(N > 0 && (N & (N - 1)) == 0) && sizeof(T) * N <= kMaxVecBytes,
"CUDA vector size exceeds arch limit: max 16 bytes on pre-Blackwell/AMD, "
"32 bytes on Blackwell or greater");
using element_t = typename details::sized_int<T>;
using storage_t = AlignedStorage<element_t, N>;