Skip to content

Commit bc5105f

Browse files
committed
Merge branch 'main' into reuse-shadow-memory
2 parents 45b9e60 + 2739808 commit bc5105f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+4118
-438
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ option(UR_USE_ASAN "enable AddressSanitizer" OFF)
2727
option(UR_USE_UBSAN "enable UndefinedBehaviorSanitizer" OFF)
2828
option(UR_USE_MSAN "enable MemorySanitizer" OFF)
2929
option(UR_USE_TSAN "enable ThreadSanitizer" OFF)
30-
option(UR_USE_CFI "enable Control Flow Integrity checks (requires clang and implies -flto)" ON)
30+
option(UR_USE_CFI "enable Control Flow Integrity checks (requires clang and implies -flto)" OFF)
3131
option(UR_ENABLE_TRACING "enable api tracing through xpti" OFF)
3232
option(UR_ENABLE_SANITIZER "enable device sanitizer" ON)
3333
option(UR_ENABLE_SYMBOLIZER "enable symoblizer for sanitizer" OFF)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ List of options provided by CMake:
130130
| UR_USE_TSAN | Enable ThreadSanitizer | ON/OFF | OFF |
131131
| UR_USE_UBSAN | Enable UndefinedBehavior Sanitizer | ON/OFF | OFF |
132132
| UR_USE_MSAN | Enable MemorySanitizer (clang only) | ON/OFF | OFF |
133-
| UR_USE_CFI | Enable Control Flow Integrity checks (clang only, also enables lto) | ON/OFF | ON |
133+
| UR_USE_CFI | Enable Control Flow Integrity checks (clang only, also enables lto) | ON/OFF | OFF |
134134
| UR_ENABLE_TRACING | Enable XPTI-based tracing layer | ON/OFF | OFF |
135135
| UR_ENABLE_SANITIZER | Enable device sanitizer layer | ON/OFF | ON |
136136
| UR_CONFORMANCE_TARGET_TRIPLES | SYCL triples to build CTS device binaries for | Comma-separated list | spir64 |

cmake/FetchLevelZero.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,14 @@ if (UR_COMPUTE_RUNTIME_TAG STREQUAL "")
104104
set(UR_COMPUTE_RUNTIME_TAG 24.39.31294.12)
105105
endif()
106106
include(FetchContent)
107-
# Sparse fetch only the dir with level zero headers to avoid pulling in the entire compute-runtime.
108-
FetchContentSparse_Declare(compute-runtime-level-zero-headers ${UR_COMPUTE_RUNTIME_REPO} "${UR_COMPUTE_RUNTIME_TAG}" "level_zero/include")
109-
FetchContent_GetProperties(compute-runtime-level-zero-headers)
110-
if(NOT compute-runtime-level-zero-headers_POPULATED)
111-
FetchContent_Populate(compute-runtime-level-zero-headers)
107+
# Sparse fetch only the dir with level zero headers for experimental features to avoid pulling in the entire compute-runtime.
108+
FetchContentSparse_Declare(exp-headers ${UR_COMPUTE_RUNTIME_REPO} "${UR_COMPUTE_RUNTIME_TAG}" "level_zero/include")
109+
FetchContent_GetProperties(exp-headers)
110+
if(NOT exp-headers_POPULATED)
111+
FetchContent_Populate(exp-headers)
112112
endif()
113113
add_library(ComputeRuntimeLevelZero-Headers INTERFACE)
114-
set(COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE "${compute-runtime-level-zero-headers_SOURCE_DIR}/../..")
114+
set(COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE "${exp-headers_SOURCE_DIR}/../..")
115115
message(STATUS "Level Zero Adapter: Using Level Zero headers from ${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE}")
116116
target_include_directories(ComputeRuntimeLevelZero-Headers
117117
INTERFACE "$<BUILD_INTERFACE:${COMPUTE_RUNTIME_LEVEL_ZERO_INCLUDE}>"

cmake/FindRocmAgentEnumerator.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# rocm_agent_enumerator is found.
1010
#
1111

12-
find_program(ROCM_AGENT_ENUMERATOR NAMES rocm_agent_enumerator)
12+
find_program(ROCM_AGENT_ENUMERATOR NAMES rocm_agent_enumerator PATHS /opt/rocm/bin)
1313

1414
if(ROCM_AGENT_ENUMERATOR)
1515
set(ROCM_AGENT_ENUMERATOR_FOUND TRUE)

cmake/helpers.cmake

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,13 @@ else()
7979
set(CXX_HAS_CFI_SANITIZE OFF)
8080
endif()
8181

82+
set(CFI_FLAGS "")
83+
if (CFI_HAS_CFI_SANITIZE)
84+
# cfi-icall requires called functions in shared libraries to also be built with cfi-icall, which we can't
85+
# guarantee. -fsanitize=cfi depends on -flto
86+
set(CFI_FLAGS "-flto -fsanitize=cfi -fno-sanitize=cfi-icall -fsanitize-ignorelist=${CMAKE_SOURCE_DIR}/sanitizer-ignorelist.txt")
87+
endif()
88+
8289
function(add_ur_target_compile_options name)
8390
if(NOT MSVC)
8491
target_compile_definitions(${name} PRIVATE -D_FORTIFY_SOURCE=2)
@@ -95,9 +102,8 @@ function(add_ur_target_compile_options name)
95102
-fPIC
96103
-fstack-protector-strong
97104
-fvisibility=hidden
98-
# cfi-icall requires called functions in shared libraries to also be built with cfi-icall, which we can't
99-
# guarantee. -fsanitize=cfi depends on -flto
100-
$<$<BOOL:${CXX_HAS_CFI_SANITIZE}>:-flto -fsanitize=cfi -fno-sanitize=cfi-icall>
105+
106+
${CFI_FLAGS}
101107
$<$<BOOL:${CXX_HAS_FCF_PROTECTION_FULL}>:-fcf-protection=full>
102108
$<$<BOOL:${CXX_HAS_FSTACK_CLASH_PROTECTION}>:-fstack-clash-protection>
103109

@@ -135,7 +141,7 @@ function(add_ur_target_link_options name)
135141
if(NOT MSVC)
136142
if (NOT APPLE)
137143
target_link_options(${name} PRIVATE
138-
$<$<BOOL:${CXX_HAS_CFI_SANITIZE}>:-flto -fsanitize=cfi -fno-sanitize=cfi-icall>
144+
${CFI_FLAGS}
139145
"LINKER:-z,relro,-z,now,-z,noexecstack"
140146
)
141147
if (UR_DEVELOPER_MODE)

0 commit comments

Comments
 (0)