Skip to content

Commit f82536b

Browse files
committed
Revert "Running ubsan."
This reverts commit c1afa2c.
1 parent c1afa2c commit f82536b

File tree

3 files changed

+406
-506
lines changed

3 files changed

+406
-506
lines changed

.github/workflows/benchmark-debug.yml

Lines changed: 0 additions & 200 deletions
This file was deleted.

cmake/flags_and_options.cmake

Lines changed: 79 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -46,25 +46,13 @@ set(BNCH_SWT_COMPILE_DEFINITIONS
4646
${BNCH_SWT_SIMD_DEFINITIONS}
4747
)
4848

49-
# Updated to include UBSan for Clang and GCC
50-
# Note: Sanitizers usually require -fno-omit-frame-pointer for clear stack traces
51-
52-
set(BNCH_SWT_UBSAN_FLAGS
53-
-fsanitize=undefined
54-
-fsanitize=float-divide-by-zero
55-
-fsanitize=float-cast-overflow
56-
-fno-sanitize-recover=all
57-
-fno-omit-frame-pointer
58-
)
59-
6049
set(BNCH_SWT_CLANG_COMPILE_OPTIONS
6150
-O3
62-
${BNCH_SWT_UBSAN_FLAGS}
6351
-funroll-loops
6452
-fvectorize
6553
-fslp-vectorize
6654
-finline-functions
67-
# -fomit-frame-pointer # Removed to allow UBSan traces
55+
-fomit-frame-pointer
6856
-fmerge-all-constants
6957
-ffunction-sections
7058
-fdata-sections
@@ -92,12 +80,11 @@ set(BNCH_SWT_CLANG_COMPILE_OPTIONS
9280

9381
set(BNCH_SWT_APPLECLANG_COMPILE_OPTIONS
9482
-O3
95-
${BNCH_SWT_UBSAN_FLAGS}
9683
-funroll-loops
9784
-fvectorize
9885
-fslp-vectorize
9986
-finline-functions
100-
# -fomit-frame-pointer # Removed to allow UBSan traces
87+
-fomit-frame-pointer
10188
-fmerge-all-constants
10289
-ffunction-sections
10390
-fdata-sections
@@ -126,10 +113,9 @@ set(BNCH_SWT_APPLECLANG_COMPILE_OPTIONS
126113

127114
set(BNCH_SWT_GNU_COMPILE_OPTIONS
128115
-O3
129-
${BNCH_SWT_UBSAN_FLAGS}
130116
-funroll-loops
131117
-finline-functions
132-
# -fomit-frame-pointer # Removed to allow UBSan traces
118+
-fomit-frame-pointer
133119
-fno-math-errno
134120
-falign-functions=32
135121
-falign-loops=32
@@ -160,11 +146,75 @@ set(BNCH_SWT_GNU_COMPILE_OPTIONS
160146
-Wdouble-promotion
161147
)
162148

163-
# You must also link against the UBSan runtime
149+
set(BNCH_SWT_MSVC_RELEASE_FLAGS
150+
/Ob3
151+
/Ot
152+
/Oy
153+
/GT
154+
$<$<NOT:$<CUDA_COMPILER_ID:NVIDIA>>:/GL>
155+
/fp:precise
156+
/Qpar
157+
/GS-
158+
)
159+
160+
set(BNCH_SWT_MSVC_COMPILE_OPTIONS
161+
/Gy
162+
/Gw
163+
$<$<NOT:$<CUDA_COMPILER_ID:NVIDIA>>:/Zc:inline>
164+
/Zc:throwingNew
165+
/W4
166+
$<$<NOT:$<CUDA_COMPILER_ID:NVIDIA>>:/bigobj>
167+
/permissive-
168+
/Zc:__cplusplus
169+
/wd4820
170+
/wd4324
171+
/wd5002
172+
/Zc:alignedNew
173+
/Zc:auto
174+
/Zc:forScope
175+
/Zc:implicitNoexcept
176+
/Zc:noexceptTypes
177+
/Zc:referenceBinding
178+
/Zc:rvalueCast
179+
/Zc:sizedDealloc
180+
/Zc:strictStrings
181+
/Zc:ternary
182+
/Zc:wchar_t
183+
$<$<CONFIG:Release>:${BNCH_SWT_MSVC_RELEASE_FLAGS}>
184+
)
185+
186+
string(TOUPPER "${CMAKE_CUDA_HOST_COMPILER_ID}" BNCH_SWT_HOST_COMPILER_ID)
187+
188+
set(BNCH_SWT_NVCC_HOST_FLAGS "")
189+
foreach(flag ${BNCH_SWT_${BNCH_SWT_HOST_COMPILER_ID}_COMPILE_OPTIONS})
190+
list(APPEND BNCH_SWT_NVCC_HOST_FLAGS "-Xcompiler=${flag}")
191+
endforeach()
192+
193+
set(BNCH_SWT_NVCC_COMPILE_OPTIONS
194+
${BNCH_SWT_NVCC_HOST_FLAGS}
195+
$<$<CONFIG:Debug>:-g -G>
196+
$<$<NOT:$<CONFIG:Debug>>:-O3>
197+
--fmad=false
198+
--prec-div=true
199+
--prec-sqrt=true
200+
--restrict
201+
--extended-lambda
202+
)
203+
204+
set(BNCH_SWT_CXX_COMPILE_OPTIONS
205+
$<$<CXX_COMPILER_ID:Clang>:${BNCH_SWT_CLANG_COMPILE_OPTIONS}>
206+
$<$<CXX_COMPILER_ID:AppleClang>:${BNCH_SWT_APPLECLANG_COMPILE_OPTIONS}>
207+
$<$<CXX_COMPILER_ID:GNU>:${BNCH_SWT_GNU_COMPILE_OPTIONS}>
208+
$<$<CXX_COMPILER_ID:MSVC>:${BNCH_SWT_MSVC_COMPILE_OPTIONS}>
209+
)
210+
211+
set(BNCH_SWT_COMPILE_OPTIONS
212+
$<$<COMPILE_LANGUAGE:CXX>:${BNCH_SWT_CXX_COMPILE_OPTIONS}>
213+
$<$<COMPILE_LANGUAGE:CUDA>:${BNCH_SWT_NVCC_COMPILE_OPTIONS}>
214+
${BNCH_SWT_SIMD_FLAGS}
215+
)
216+
164217
set(BNCH_SWT_LINK_OPTIONS
165-
# Let the compiler driver handle the sanitizer runtime injection
166-
$<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:-fsanitize=undefined>
167-
168218
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<PLATFORM_ID:Darwin>>:
169219
-Wl,-dead_strip
170220
-Wl,-x
@@ -175,9 +225,10 @@ set(BNCH_SWT_LINK_OPTIONS
175225
-Wl,-x
176226
-Wl,-S
177227
>
178-
# Remove -static-libubsan and let GCC try to use the dynamic runtime
179228
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<PLATFORM_ID:Darwin>>:
180229
-Wl,-dead_strip
230+
-Wl,-x
231+
-Wl,-S
181232
>
182233
$<$<AND:$<CXX_COMPILER_ID:Clang>,$<PLATFORM_ID:Linux>>:
183234
-Wl,--gc-sections
@@ -203,4 +254,10 @@ set(BNCH_SWT_LINK_OPTIONS
203254
/MACHINE:X64
204255
/LTCG
205256
>
257+
$<$<AND:$<CUDA_COMPILER_ID:NVIDIA>,$<PLATFORM_ID:Linux>>:
258+
-lcudart_static
259+
-lrt
260+
-ldl
261+
-lpthread
262+
>
206263
)

0 commit comments

Comments
 (0)