Skip to content

Commit

Permalink
wip comment out flags
Browse files Browse the repository at this point in the history
  • Loading branch information
q10 committed Nov 23, 2024
1 parent e544d17 commit 67a6050
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 45 deletions.
12 changes: 9 additions & 3 deletions cmake/modules/GpuCppLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,14 @@ endfunction()

function(gpu_cpp_library)
# This function does the following:
#
# 1. Take all the target sources and select relevant sources based on build type (CPU-only, CUDA, HIP)
# 1. Apply source file properties as needed
# 1. HIPify files as needed
# 1. Build the .SO file
# 1. Fetch the HIPified versions of the files as needed (presumes that `hipify()` has already been run)
# 1. Build the .SO file, either as STATIC or MODULE
#
# Building as STATIC allows the target to be linked to other library targets:
# https://www.reddit.com/r/cpp_questions/comments/120p0ey/how_to_create_a_composite_shared_library_out_of

set(flags)
set(singleValueArgs
Expand All @@ -163,6 +167,8 @@ function(gpu_cpp_library)
# Prepare CXX and CU sources
############################################################################

# Take all the sources, and filter them into CPU and GPU buckets depending
# on the source type and build mode
prepare_target_sources(
PREFIX ${args_PREFIX}
CPU_SRCS ${args_CPU_SRCS}
Expand All @@ -181,7 +187,7 @@ function(gpu_cpp_library)
set(lib_name ${args_PREFIX}_py)
if(USE_ROCM)
# Fetch the equivalent HIPified sources if available.
# This presumes that hipify() has already been run.
# This presumes that `hipify()` has already been run.
get_hipified_list("${lib_sources}" lib_sources_hipified)

# Set properties for the HIPified sources
Expand Down
84 changes: 42 additions & 42 deletions fbgemm_gpu/FbgemmGpu.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -312,47 +312,47 @@ list(APPEND gen_defused_optim_py_files
# FBGEMM_GPU Generated Sources
################################################################################

if(CXX_AVX2_FOUND)
set_source_files_properties(${gen_cpu_source_files}
PROPERTIES COMPILE_OPTIONS "${AVX2_FLAGS}")
else()
set_source_files_properties(${gen_cpu_source_files}
PROPERTIES COMPILE_OPTIONS "-fopenmp")
endif()

set_source_files_properties(${gen_cpu_source_files}
PROPERTIES INCLUDE_DIRECTORIES
"${fbgemm_sources_include_directories}")

set_source_files_properties(${gen_gpu_host_source_files}
PROPERTIES INCLUDE_DIRECTORIES
"${fbgemm_sources_include_directories}")

set_source_files_properties(${gen_gpu_kernel_source_files}
PROPERTIES INCLUDE_DIRECTORIES
"${fbgemm_sources_include_directories}")

set_source_files_properties(${gen_gpu_kernel_source_files}
PROPERTIES COMPILE_OPTIONS
"${TORCH_CUDA_OPTIONS}")

set_source_files_properties(${gen_defused_optim_source_files}
PROPERTIES INCLUDE_DIRECTORIES
"${fbgemm_sources_include_directories}")

if(NOT FBGEMM_CPU_ONLY)
set(fbgemm_gpu_sources_gen
${gen_gpu_kernel_source_files}
${gen_gpu_host_source_files}
${gen_cpu_source_files}
${gen_defused_optim_source_files})
else()
set(fbgemm_gpu_sources_gen
${gen_cpu_source_files}
# To force generate_embedding_optimizer to generate Python files
${gen_defused_optim_py_files}
)
endif()
# if(CXX_AVX2_FOUND)
# set_source_files_properties(${gen_cpu_source_files}
# PROPERTIES COMPILE_OPTIONS "${AVX2_FLAGS}")
# else()
# set_source_files_properties(${gen_cpu_source_files}
# PROPERTIES COMPILE_OPTIONS "-fopenmp")
# endif()

# set_source_files_properties(${gen_cpu_source_files}
# PROPERTIES INCLUDE_DIRECTORIES
# "${fbgemm_sources_include_directories}")

# set_source_files_properties(${gen_gpu_host_source_files}
# PROPERTIES INCLUDE_DIRECTORIES
# "${fbgemm_sources_include_directories}")

# set_source_files_properties(${gen_gpu_kernel_source_files}
# PROPERTIES INCLUDE_DIRECTORIES
# "${fbgemm_sources_include_directories}")

# set_source_files_properties(${gen_gpu_kernel_source_files}
# PROPERTIES COMPILE_OPTIONS
# "${TORCH_CUDA_OPTIONS}")

# set_source_files_properties(${gen_defused_optim_source_files}
# PROPERTIES INCLUDE_DIRECTORIES
# "${fbgemm_sources_include_directories}")

# if(NOT FBGEMM_CPU_ONLY)
# set(fbgemm_gpu_sources_gen
# ${gen_gpu_kernel_source_files}
# ${gen_gpu_host_source_files}
# ${gen_cpu_source_files}
# ${gen_defused_optim_source_files})
# else()
# set(fbgemm_gpu_sources_gen
# ${gen_cpu_source_files}
# # To force generate_embedding_optimizer to generate Python files
# ${gen_defused_optim_py_files}
# )
# endif()


################################################################################
Expand Down Expand Up @@ -552,7 +552,7 @@ endif()


################################################################################
# FBGEMM_GPU HIP Code Generation
# FBGEMM_GPU Generated Sources Organized
################################################################################

set(fbgemm_gpu_sources_cpu_gen
Expand Down

0 comments on commit 67a6050

Please sign in to comment.