Skip to content

Enhance build flags for Debug and RelWithDebInfo configurations #1671

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ endif()

# Only for debugging. Save building time by shrinking translation unit scope.
set(BUILD_SEPARATE_OPS $ENV{BUILD_SEPARATE_OPS})
if(CMAKE_BUILD_TYPE MATCHES "(Debug|RelWithDebInfo)")
set(BUILD_SEPARATE_OPS TRUE)
endif()
set(BUILD_SPLIT_KERNEL_LIB $ENV{BUILD_SPLIT_KERNEL_LIB})
add_subdirectory(${TORCH_XPU_OPS_ROOT}/src)

Expand Down
15 changes: 11 additions & 4 deletions cmake/BuildFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
list(APPEND SYCL_HOST_FLAGS -g)
list(APPEND SYCL_HOST_FLAGS -O0)
endif(CMAKE_BUILD_TYPE MATCHES Debug)

list(APPEND SYCL_HOST_FLAGS -g -fno-omit-frame-pointer -O0)
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
list(APPEND SYCL_HOST_FLAGS -g -O2)
endif()
if(USE_PER_OPERATOR_HEADERS)
list(APPEND SYCL_HOST_FLAGS -DAT_PER_OPERATOR_HEADERS)
endif()
Expand Down Expand Up @@ -84,6 +84,13 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID STREQUAL "MSVC"
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -Wno-absolute-value)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -no-ftz)
endif()

if(CMAKE_BUILD_TYPE MATCHES Debug)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -g -O0 -Rno-debug-disables-optimization)
elseif(CMAKE_BUILD_TYPE MATCHES RelWithDebInfo)
set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -gline-tables-only -O2)
endif()

set(SYCL_KERNEL_OPTIONS ${SYCL_KERNEL_OPTIONS} -D__INTEL_LLVM_COMPILER_VERSION=${__INTEL_LLVM_COMPILER})

CHECK_SYCL_FLAG("-fsycl-fp64-conv-emu" SUPPORTS_FP64_CONV_EMU)
Expand Down
1 change: 1 addition & 0 deletions test/xpu/extended/skip_list_win.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
skip_dict = {
"test_ops_xpu.py": (
"test_compare_cpu_pow_xpu_bfloat16", # https://github.com/intel/torch-xpu-ops/pull/764
"test_compare_cpu_argmin_xpu_int",
),
}
2 changes: 2 additions & 0 deletions test/xpu/skip_list_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2296,6 +2296,8 @@
# randomly fails
"test_parity__foreach_div_fastpath_inplace_xpu_complex128",
"test_parity__foreach_div_fastpath_outplace_xpu_complex128",
"test_parity__foreach_addcdiv_fastpath_inplace_xpu_complex128",
"test_parity__foreach_addcdiv_fastpath_outplace_xpu_complex128",
),
"nn/test_convolution_xpu.py": (
# Summary: all of them are oneDNN related issues
Expand Down
Loading