8000 CUDA: mix virt/real CUDA archs for GGML_NATIVE=OFF (#13135) · ggml-org/llama.cpp@141a908 · GitHub
[go: up one dir, main page]

Skip to content

Commit 141a908

Browse files
CUDA: mix virt/real CUDA archs for GGML_NATIVE=OFF (#13135)
1 parent 32916a4 commit 141a908

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

ggml/src/ggml-cuda/CMakeLists.txt

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,30 @@ if (CUDAToolkit_FOUND)
1212
# 61 == Pascal, __dp4a instruction (per-byte integer dot product)
1313
# 70 == V100, FP16 tensor cores
1414
# 75 == Turing, int8 tensor cores
15+
# 80 == Ampere, asynchronous data loading, faster tensor core instructions
16+
# 86 == RTX 3000, needs CUDA v11.1
17+
# 89 == RTX 4000, needs CUDA v11.8
18+
#
19+
# XX-virtual == compile CUDA code as PTX, do JIT compilation to binary code on first run
20+
# XX-real == compile CUDA code as device code for this specific architecture
21+
# no suffix == compile as both PTX and device code
22+
#
23+
# The default behavior for a non-native is to build virtual architectures as needed to cover all features needed
24+
# for best performance and to also build real architectures for the most commonly used GPUs.
1525
if (GGML_NATIVE AND CUDAToolkit_VERSION VERSION_GREATER_EQUAL "11.6" AND CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
1626
set(CMAKE_CUDA_ARCHITECTURES "native")
1727
elseif(GGML_CUDA_F16 OR GGML_CUDA_DMMV_F16)
18-
set(CMAKE_CUDA_ARCHITECTURES "60;61;70;75;80")
28+
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "11.8")
29+
set(CMAKE_CUDA_ARCHITECTURES "60-virtual;61-virtual;70-virtual;75-virtual;80-virtual;86-real;89-real")
30+
else()
31+
set(CMAKE_CUDA_ARCHITECTURES "60-virtual;61-virtual;70-virtual;75-virtual;80-virtual;86-real")
32+
endif()
1933
else()
20-
set(CMAKE_CUDA_ARCHITECTURES "50;61;70;75;80")
34+
if (CUDAToolkit_VERSION VERSION_GREATER_EQUAL "11.8")
35+
set(CMAKE_CUDA_ARCHITECTURES "50-virtual;61-virtual;70-virtual;75-virtual;80-virtual;86-real;89-real")
36+
else()
37+
set(CMAKE_CUDA_ARCHITECTURES "50-virtual;61-virtual;70-virtual;75-virtual;80-virtual;86-real")
38+
endif()
2139
endif()
2240
endif()
2341
message(STATUS "Using CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}")

0 commit comments

Comments
 (0)
0