Commit 20f19611 authored by Yu Cheng's avatar Yu Cheng Committed by GitHub
Browse files

[CMake] Add CUDA Major Version Detection for Conditional Compilation (#197)

* [Feature] Add TMA Store Synchronization Support

- Introduce TMAStoreArrive and TMAStoreWait operations for CUDA TMA store synchronization
- Add new builtin operations in op/builtin.cc and op/builtin.h
- Implement TMAStoreSyncInjector to automatically inject TMA store synchronization calls
- Update CUDA codegen to support new TMA store synchronization intrinsics
- Add Python language bindings for new TMA store synchronization operations

* [CMake] Add CUDA Major Version Detection for Conditional Compilation

- Introduce CUDA_MAJOR_VERSION CMake variable to dynamically detect CUDA toolkit version
- Update runtime and transform files to use CUDA_MAJOR_VERSION for version-specific code paths
- Replace hardcoded __CUDACC_VER_MAJOR__ with dynamically set CUDA_MAJOR_VERSION
- Improve cross-version compatibility for CUDA-dependent code sections
parent 6ab29ffc
......@@ -156,6 +156,10 @@ if(USE_CUDA)
endif()
message(STATUS "CUDA Toolkit includes: ${CUDAToolkit_INCLUDE_DIRS}")
set(CUDA_MAJOR_VERSION ${CUDAToolkit_VERSION_MAJOR})
message(STATUS "Setting CUDA_MAJOR_VERSION=${CUDA_MAJOR_VERSION}")
add_compile_definitions(CUDA_MAJOR_VERSION=${CUDA_MAJOR_VERSION})
list(APPEND TILE_LANG_INCLUDES ${CUDAToolkit_INCLUDE_DIRS})
endif(USE_CUDA)
......
......@@ -17,7 +17,7 @@ namespace tl {
using namespace runtime;
#if (__CUDACC_VER_MAJOR__ >= 12)
#if (CUDA_MAJOR_VERSION >= 12)
template <typename T> static std::string ArrayToStr(const T *ptr, size_t n) {
std::stringstream ss;
ss << "[";
......@@ -203,7 +203,7 @@ TVM_REGISTER_GLOBAL(tvm_tensormap_create_im2col)
}
*ret = static_cast<int>(result);
});
#endif // (__CUDACC_VER_MAJOR__ >= 12)
#endif // (CUDA_MAJOR_VERSION >= 12)
} // namespace tl
} // namespace tvm
......@@ -13,12 +13,12 @@
namespace tvm {
namespace tl {
#if (__CUDACC_VER_MAJOR__ >= 12)
#if (CUDA_MAJOR_VERSION >= 12)
constexpr const char *tvm_tensormap_create_tiled =
"__tvm_tensormap_create_tiled";
constexpr const char *tvm_tensormap_create_im2col =
"__tvm_tensormap_create_im2col";
#endif // (__CUDACC_VER_MAJOR__ >= 12)
#endif // (CUDA_MAJOR_VERSION >= 12)
} // namespace tl
} // namespace tvm
......
......@@ -36,7 +36,7 @@ namespace tl {
using namespace tir;
#if (__CUDACC_VER_MAJOR__ >= 12)
#if (CUDA_MAJOR_VERSION >= 12)
class LowerHopperIntrin : public StmtExprMutator {
public:
static PrimFunc Substitute(PrimFunc &f) {
......@@ -169,7 +169,7 @@ tvm::transform::Pass LowerHopperIntrin() {
TVM_REGISTER_GLOBAL("tl.transform.LowerHopperIntrin")
.set_body_typed(LowerHopperIntrin);
#endif // (__CUDACC_VER_MAJOR__ >= 12)
#endif // (CUDA_MAJOR_VERSION >= 12)
} // namespace tl
} // namespace tvm
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment