Experimental Pascal/Volta build: admit sm_70, and the device check honours it (#236)
-DSTRATA_EXPERIMENTAL_SM60=ON now names Volta (sm_70) beside Pascal (sm_60) and is a declared option; below sm_60 is refused even then. The runtime check in device_info refused anything below compute capability 7.5 even in that build, so the flag produced an engine that could not start on the cards it was built for: strata_core now gets STRATA_EXPERIMENTAL_SM60=1 with the flag and the check admits 6.0 and up there. The release engine is unchanged (7.5). Checked here: configuring for 70-real without the flag still fails with the 7.5 message; with it (CUDA 12.6 - CUDA 13 no longer compiles compute_70, noted in the comment) it configures and strata-device builds with the define.
This commit is contained in:
1 parent
e1f12eb852
commit
cd677f7414
2 files changed
+27
-8
No files matched your search
+16
-5
@@ -68,6 +68,7 @@ if(STRATA_ENABLE_CUDA)
|
||||
# `enable_language(CUDA)` gives the .cu compile rules but NOT the imported targets, so `CUDA::cudart` has to
|
||||
# be brought in explicitly for the host-side tests that call cudaMalloc themselves.
|
||||
find_package(CUDAToolkit REQUIRED)
|
||||
option(STRATA_EXPERIMENTAL_SM60 "community build for GPUs below compute capability 7.5: Pascal sm_60, Volta sm_70 (#236)" OFF)
|
||||
if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
|
||||
set(CMAKE_CUDA_ARCHITECTURES 120 CACHE STRING "CUDA architectures" FORCE)
|
||||
endif()
|
||||
@@ -79,16 +80,22 @@ if(STRATA_ENABLE_CUDA)
|
||||
if(_base STREQUAL "native" OR _base STREQUAL "all" OR _base STREQUAL "all-major")
|
||||
continue()
|
||||
endif()
|
||||
# STRATA_EXPERIMENTAL_SM60: a Pascal (sm_60, GP100-class) build. It sits below every architecture
|
||||
# these kernels were written for, so two intrinsics are replaced for it - `__dp4a` (6.1+) and
|
||||
# `__nanosleep` (7.0+) - in include/strata/kernels/dp4a.hpp, which is bit-exact for the first and
|
||||
# merely a shorter pause for the second. RTX 20/30/40/50 cards must use the release engine instead.
|
||||
# STRATA_EXPERIMENTAL_SM60: a Pascal (sm_60, GP100-class) or Volta (sm_70, V100 / Titan V, #236) build.
|
||||
# These sit below every architecture the kernels were written for, so two intrinsics are replaced below
|
||||
# their arch - `__dp4a` (6.1+) and `__nanosleep` (7.0+) - in include/strata/kernels/dp4a.hpp, which is
|
||||
# bit-exact for the first and merely a shorter pause for the second (sm_70 has both). Community-tested,
|
||||
# not in the ready-made engine; RTX 20/30/40/50 cards must use the release engine instead. It needs a CUDA
|
||||
# 12.x toolkit: CUDA 13 dropped sm_60 and sm_70 (nvcc fails CMake's compiler test with "compute_70").
|
||||
if(_base LESS 75 AND NOT STRATA_EXPERIMENTAL_SM60)
|
||||
message(FATAL_ERROR
|
||||
"Strata needs an NVIDIA GPU of compute capability 7.5 or newer (RTX 20 / 30 / 40 / 50 series), but "
|
||||
"CMAKE_CUDA_ARCHITECTURES is '${CMAKE_CUDA_ARCHITECTURES}'. (A Pascal build is "
|
||||
"CMAKE_CUDA_ARCHITECTURES is '${CMAKE_CUDA_ARCHITECTURES}'. (A Pascal sm_60 or Volta sm_70 build is "
|
||||
"-DSTRATA_EXPERIMENTAL_SM60=ON; upstream does not support it.)")
|
||||
endif()
|
||||
if(_base LESS 60)
|
||||
message(FATAL_ERROR "CMAKE_CUDA_ARCHITECTURES '${CMAKE_CUDA_ARCHITECTURES}': even the experimental build "
|
||||
"needs compute capability 6.0 (sm_60) or newer")
|
||||
endif()
|
||||
# #220 / #224: RTX 50 engines built with CUDA 12.8 crashed in the prompt path on Linux (13.0 and newer did not)
|
||||
if(_base GREATER_EQUAL 120 AND CMAKE_CUDA_COMPILER_VERSION VERSION_LESS 13.0)
|
||||
message(WARNING "Building for sm_${_base} (RTX 50) with CUDA ${CMAKE_CUDA_COMPILER_VERSION}: engines built with "
|
||||
@@ -166,6 +173,10 @@ if(STRATA_ENABLE_CUDA OR STRATA_ENABLE_HIP)
|
||||
add_library(strata_core STATIC src/core/device.cu src/core/pinned.cu src/platform/memory.cpp src/core/graph.cpp src/core/weights.cpp
|
||||
src/core/layout.cpp)
|
||||
target_include_directories(strata_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
if(STRATA_ENABLE_CUDA AND STRATA_EXPERIMENTAL_SM60)
|
||||
# the runtime device check (src/core/device.cu) admits the cards this build was made for (#236)
|
||||
target_compile_definitions(strata_core PRIVATE STRATA_EXPERIMENTAL_SM60=1)
|
||||
endif()
|
||||
# The selected runtime is PUBLIC because graph.cpp is a HOST translation unit that calls cudaGraphLaunch and
|
||||
# cudaEventQuery: the .cu sources get cudart through the CUDA language rules, a .cpp does not, and the
|
||||
# linker error ("unresolved external symbol cudaGraphInstantiate") names the function rather than the cause.
|
||||
|
||||
+11
-3
@@ -135,10 +135,18 @@ DeviceInfo device_info(int ordinal) {
|
||||
d.arch = base_arch(p.gcnArchName);
|
||||
if (const std::string why = arch_problem(p, ordinal); !why.empty()) throw CudaError(why, -1);
|
||||
#else
|
||||
if (d.cc_major * 10 + d.cc_minor < 75) {
|
||||
// #236: the experimental build (-DSTRATA_EXPERIMENTAL_SM60=ON: Pascal sm_60, Volta sm_70) runs on the cards it
|
||||
// was built for - refusing them below 7.5 there made the flag useless; the release engine keeps 7.5
|
||||
#if defined(STRATA_EXPERIMENTAL_SM60)
|
||||
constexpr int kMinCc = 60;
|
||||
const char* const kNeed = "6.0 or newer (this is the experimental Pascal / Volta build)";
|
||||
#else
|
||||
constexpr int kMinCc = 75;
|
||||
const char* const kNeed = "7.5 or newer (RTX 20 / 30 / 40 / 50 series)";
|
||||
#endif
|
||||
if (d.cc_major * 10 + d.cc_minor < kMinCc) {
|
||||
throw CudaError("device " + d.name + " reports compute capability " + std::to_string(d.cc_major) +
|
||||
"." + std::to_string(d.cc_minor) +
|
||||
"; Strata needs compute capability 7.5 or newer (RTX 20 / 30 / 40 / 50 series)",
|
||||
"." + std::to_string(d.cc_minor) + "; Strata needs compute capability " + kNeed,
|
||||
-1);
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in new issue
Block a user