Skip to content
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

Enable level zero v2 in DPC++ #16656

Open
wants to merge 8 commits into
base: sycl
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 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
9 changes: 8 additions & 1 deletion buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ def do_configure(args):
llvm_enable_zstd = "ON"

if sys.platform != "darwin":
sycl_enabled_backends.append("level_zero")
if args.level_zero_v2:
sycl_enabled_backends.append("level_zero_v2")
else:
sycl_enabled_backends.append("level_zero")


# lld is needed on Windows or for the HIP adapter on AMD
if platform.system() == "Windows" or (args.hip and args.hip_platform == "AMD"):
Expand Down Expand Up @@ -319,6 +323,9 @@ def main():
parser.add_argument(
"--native_cpu", action="store_true", help="Enable SYCL Native CPU"
)
parser.add_argument(
"--level_zero_v2", action="store_true", help="Enable SYCL level_zero_v2"
)
parser.add_argument("--hip", action="store_true", help="switch from OpenCL to HIP")
parser.add_argument(
"--hip-platform",
Expand Down
2 changes: 1 addition & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ if ("opencl" IN_LIST SYCL_ENABLE_BACKENDS)
set(SYCL_BUILD_BACKEND_OPENCL ON)
endif()
if ("level_zero" IN_LIST SYCL_ENABLE_BACKENDS)
set(SYCL_BUILD_BACKENDLEVEL_ZERO ON)
set(SYCL_BUILD_BACKEND_LEVEL_ZERO ON)
endif()
if ("native_cpu" IN_LIST SYCL_ENABLE_BACKENDS)
set(SYCL_BUILD_BACKEND_NATIVE_CPU ON)
Expand Down
10 changes: 9 additions & 1 deletion sycl/cmake/modules/FetchUnifiedRuntime.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ set(UR_ENABLE_TRACING ON)
if("level_zero" IN_LIST SYCL_ENABLE_BACKENDS)
set(UR_BUILD_ADAPTER_L0 ON)
endif()
if("level_zero_v2" IN_LIST SYCL_ENABLE_BACKENDS)
set(UR_BUILD_ADAPTER_L0_V2 ON)
set(ENV{UR_ADAPTER_LEVEL_ZERO_V2} ON)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will only set the env variable for the build process. We either need to change the ur loader again is that the v2 is loaded unconditionally (but i'm not sure about that, the L0 adapter might be in other searchable OS paths, and we'd end up with two adapters anyway) or set this env variable somewhere in SYCL rt init if this compile option is set.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to think in an easy way to do the second option and make the compile option consistent in defining the env variable, but I think we will always need the user to define the UR_ADAPTER_LEVEL_ZERO_V2, I guess we could just depend on the user to define it, or we could define another dpc++ env variable that the user could define if that would make it more clear.

The first option seems the simpler one, but with the probability of reporting still 2 l0 adapters.

I am not sure which one is better, but I think we could just for simplicity go with the first suggestion of just registering the two l0/l0_v2 adapters, and let dpc++ control that with the compile option.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, I agree. I already approved the UR change. Thanks.

endif()
if("cuda" IN_LIST SYCL_ENABLE_BACKENDS)
set(UR_BUILD_ADAPTER_CUDA ON)
endif()
Expand Down Expand Up @@ -116,7 +120,7 @@ if(SYCL_UR_USE_FETCH_CONTENT)
CACHE PATH "Path to external '${name}' adapter source dir" FORCE)
endfunction()

set(UNIFIED_RUNTIME_REPO "https://github.com/oneapi-src/unified-runtime.git")
set(UNIFIED_RUNTIME_REPO "https://github.com/omarahmed1111/unified-runtime.git")
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/UnifiedRuntimeTag.cmake)

set(UMF_BUILD_EXAMPLES OFF CACHE INTERNAL "EXAMPLES")
Expand Down Expand Up @@ -266,6 +270,10 @@ if("level_zero" IN_LIST SYCL_ENABLE_BACKENDS)
# added to the new build system
endif()

if("level_zero_v2" IN_LIST SYCL_ENABLE_BACKENDS)
add_sycl_ur_adapter(level_zero_v2)
endif()

if("cuda" IN_LIST SYCL_ENABLE_BACKENDS)
add_sycl_ur_adapter(cuda)
endif()
Expand Down
12 changes: 6 additions & 6 deletions sycl/cmake/modules/UnifiedRuntimeTag.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# commit 3a1b4c7b9ba952fad6f6ad36c01101bbf368347b
# Merge: c270a6b8 264d0468
# commit c5bf8fd5c92ab7a24b439cd89cefc9cd425ec787
# Merge: e6d4355f 778085f7
# Author: Kenneth Benzie (Benie) <[email protected]>
# Date: Tue Jan 28 15:16:58 2025 +0000
# Merge pull request #2594 from kbenzie/benie/cl-core-functions-no-dlopen
# Fix invalid use of dlopen()
set(UNIFIED_RUNTIME_TAG 3a1b4c7b9ba952fad6f6ad36c01101bbf368347b)
# Date: Mon Jan 13 10:41:50 2025 +0000
# Merge pull request #2479 from aarongreig/aaron/parameterizeDeviceTests
# Parameterize CTS tests across all available adapters and devices.
set(UNIFIED_RUNTIME_TAG 58ccaa9781af27192bb4dcab6b71193f7b016f50)
Loading