Skip to content

Commit 145bf70

Browse files
Copilotaneshlya
andauthored
Add warning for incompatible SSE/AVX1 targets in benchmarks (#3604)
Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: aneshlya <[email protected]>
1 parent 3275944 commit 145bf70

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

benchmarks/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ set(BENCHMARKS_ISPC_FLAGS "-O3 --woff" CACHE STRING "Flags to pass to ISPC compi
7979
message(STATUS "Using BENCHMARKS_ISPC_TARGETS: ${BENCHMARKS_ISPC_TARGETS}")
8080
message(STATUS "Using BENCHMARKS_ISPC_FLAGS: ${BENCHMARKS_ISPC_FLAGS}")
8181

82+
# Warn if incompatible targets are used (SSE or AVX1)
83+
# The C++ portion of benchmarks is compiled with -mavx2 which generates AVX2 instructions
84+
# that are not available on SSE or AVX1 targets
85+
if (X86_HOST)
86+
string(TOLOWER "${BENCHMARKS_ISPC_TARGETS}" TARGETS_LOWER)
87+
if (TARGETS_LOWER MATCHES "sse[0-9]*" OR TARGETS_LOWER MATCHES "avx1")
88+
message(WARNING "The C++ portion of benchmarks is compiled with -mavx2 which may produce illegal instructions for SSE or AVX1 targets.\n"
89+
"BENCHMARKS_ISPC_TARGETS contains: ${BENCHMARKS_ISPC_TARGETS}\n")
90+
endif()
91+
endif()
92+
8293
include(cmake/AddBenchmark.cmake)
8394

8495
add_subdirectory(01_trivial)

0 commit comments

Comments
 (0)