diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c26b84cfac..d78d2613251 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -888,23 +888,28 @@ cmake_dependent_option( "(USE_CUDA AND NOT MSVC) OR USE_ROCM" OFF) + +IF(USE_ROCM AND "gfx942" IN_LIST PYTORCH_ROCM_ARCH) + message(WARNING "Setting USE_FBGEMM_GENAI for gfx942 to ON by default, doing ROCM build") + set(USE_FBGEMM_GENAI_DEFAULT ON) +elseif(USE_CUDA AND "$ENV{TORCH_CUDA_ARCH_LIST}" MATCHES "10.0" AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8 AND NOT WIN32) + message(STATUS "Setting USE_FBGEMM_GENAI to ON by default , doing CUDA build for SM100a") + set(USE_FBGEMM_GENAI_DEFAULT ON) +else() + set(USE_FBGEMM_GENAI_DEFAULT OFF) +endif() + cmake_dependent_option( USE_FBGEMM_GENAI "Whether to build FBGEMM GenAI quantized GEMM kernels.\ Will be disabled if not supported by the platform" - ON - "USE_ROCM" + ${USE_FBGEMM_GENAI_DEFAULT} + "(USE_CUDA AND NOT MSVC) OR USE_ROCM" OFF) -IF(USE_FBGEMM_GENAI AND USE_ROCM AND NOT "gfx942" IN_LIST PYTORCH_ROCM_ARCH) - message(WARNING "Unsupported ROCM arch for FBGEMM GenAI, will set USE_FBGEMM_GENAI to OFF") - set(USE_FBGEMM_GENAI off) -endif() # Set USE_FBGEMM_GENAI to ON for CUDA build on SM100. if(USE_CUDA AND "$ENV{TORCH_CUDA_ARCH_LIST}" MATCHES "10.0" AND CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 12.8 AND NOT WIN32) - message(STATUS "Setting USE_FBGEMM_GENAI to ON, doing CUDA build for SM100a") - set(USE_FBGEMM_GENAI ON) endif() # CAVEAT: Again, Flash Attention2 will error while building for sm52 while Mem diff --git a/cmake/Summary.cmake b/cmake/Summary.cmake index 2e2fd370a99..1fa1398a891 100644 --- a/cmake/Summary.cmake +++ b/cmake/Summary.cmake @@ -138,6 +138,7 @@ function(caffe2_print_configuration_summary) message(STATUS " USE_EIGEN_FOR_BLAS : ${CAFFE2_USE_EIGEN_FOR_BLAS}") message(STATUS " USE_EIGEN_FOR_SPARSE : ${USE_EIGEN_SPARSE}") message(STATUS " USE_FBGEMM : ${USE_FBGEMM}") + message(STATUS " USE_FBGEMM_GENAI : ${USE_FBGEMM_GENAI}") message(STATUS " USE_KINETO : ${USE_KINETO}") message(STATUS " USE_GFLAGS : ${USE_GFLAGS}") message(STATUS " USE_GLOG : ${USE_GLOG}")