Skip to content

Commit ea9b159

Browse files
jianyuhfacebook-github-bot
authored andcommitted
Make OSS fbgemm compatible with CUDA 12 (#1603)
Summary: Pull Request resolved: #1603 There are some error messages on CUB namespace when building fbgemm with CUDA 12: ``` /usr/local/cuda-12.0/include/cub/agent/../util_math.cuh(103): error: namespace "fbgemm_gpu::cub" has no member "min" /usr/local/cuda-12.0/include/cub/agent/../util_math.cuh(104): error: namespace "fbgemm_gpu::cub" has no member "max" /usr/local/cuda-12.0/include/cub/agent/agent_radix_sort_onesweep.cuh(76): error: RegBoundScaling is not a template /usr/local/cuda-12.0/include/cub/agent/agent_radix_sort_upsweep.cuh(60): error: RegBoundScaling is not a template /usr/local/cuda-12.0/include/cub/agent/single_pass_scan_operators.cuh(325): error: namespace "fbgemm_gpu::cub" has no member "Debug" /usr/local/cuda-12.0/include/cub/agent/single_pass_scan_operators.cuh(354): error: namespace "fbgemm_gpu::cub" has no member "Debug" ``` This Diff fixed the issue. Reviewed By: q10 Differential Revision: D43423185 fbshipit-source-id: 9545835a9847aabeec4bc2a8dda8511771910fb6
1 parent d4e04ab commit ea9b159

File tree

6 files changed

+12
-10
lines changed

6 files changed

+12
-10
lines changed

fbgemm_gpu/CMakeLists.txt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ set(codegen_dependencies
157157
${CMAKE_CODEGEN_DIR}/lookup_args.py
158158
${CMAKE_CODEGEN_DIR}/split_embedding_codegen_lookup_invoker.template
159159
${CMAKE_CURRENT_SOURCE_DIR}/include/fbgemm_gpu/cpu_utils.h
160+
${CMAKE_CURRENT_SOURCE_DIR}/include/fbgemm_gpu/cub_namespace_prefix.cuh
160161
${CMAKE_CURRENT_SOURCE_DIR}/include/fbgemm_gpu/cub_namespace_postfix.cuh
161162
${CMAKE_CURRENT_SOURCE_DIR}/include/fbgemm_gpu/dispatch_macros.h
162163
${CMAKE_CURRENT_SOURCE_DIR}/include/fbgemm_gpu/embedding_backward_template_helpers.cuh
@@ -409,9 +410,10 @@ else()
409410
set_property(TARGET fbgemm_gpu_py PROPERTY CUDA_ARCHITECTURES
410411
"${cuda_architectures}")
411412

412-
if(NOT FBGEMM_CPU_ONLY)
413-
target_compile_definitions(fbgemm_gpu_py PRIVATE FBGEMM_CUB_USE_NAMESPACE)
414-
endif()
413+
# FBGEMM_CUB_USE_NAMESPACE will cause compilation errors on CUB for CUDA 12+
414+
# if(NOT FBGEMM_CPU_ONLY)
415+
# target_compile_definitions(fbgemm_gpu_py PRIVATE FBGEMM_CUB_USE_NAMESPACE)
416+
# endif()
415417
endif()
416418

417419
set_target_properties(fbgemm_gpu_py PROPERTIES PREFIX "")

fbgemm_gpu/include/fbgemm_gpu/sparse_ops.cuh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616

1717
// clang-format off
1818
#include "./cub_namespace_prefix.cuh"
19-
#include "cub/block/block_reduce.cuh"
19+
#include <cub/block/block_reduce.cuh>
2020
#include "./cub_namespace_postfix.cuh"
2121
// clang-format on

fbgemm_gpu/src/jagged_tensor_ops.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
// clang-format off
1717
#include "fbgemm_gpu/cub_namespace_prefix.cuh"
18-
#include "cub/device/device_scan.cuh"
18+
#include <cub/device/device_scan.cuh>
1919
#include "fbgemm_gpu/cub_namespace_postfix.cuh"
2020
// clang-format on
2121

fbgemm_gpu/src/layout_transform_ops.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
// clang-format off
99
#include "fbgemm_gpu/cub_namespace_prefix.cuh"
10-
#include "cub/device/device_scan.cuh"
10+
#include <cub/device/device_scan.cuh>
1111
#include "fbgemm_gpu/cub_namespace_postfix.cuh"
1212
// clang-format on
1313

fbgemm_gpu/src/sparse_ops.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
// clang-format off
2020
#include "fbgemm_gpu/cub_namespace_prefix.cuh"
21-
#include "cub/device/device_scan.cuh"
21+
#include <cub/device/device_scan.cuh>
2222
#include "fbgemm_gpu/cub_namespace_postfix.cuh"
2323
// clang-format on
2424

fbgemm_gpu/src/split_embeddings_cache_cuda.cu

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
// clang-format off
99
#include "fbgemm_gpu/cub_namespace_prefix.cuh"
10-
#include "cub/device/device_radix_sort.cuh"
11-
#include "cub/device/device_run_length_encode.cuh"
12-
#include "cub/device/device_select.cuh"
10+
#include <cub/device/device_radix_sort.cuh>
11+
#include <cub/device/device_run_length_encode.cuh>
12+
#include <cub/device/device_select.cuh>
1313
#include "fbgemm_gpu/cub_namespace_postfix.cuh"
1414
// clang-format on
1515

0 commit comments

Comments
 (0)