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

[L0][UR] Only Override max allocation limits given env #12375

Merged
merged 6 commits into from
Jan 19, 2024

Conversation

nrspruit
Copy link
Contributor

@nrspruit nrspruit commented Jan 12, 2024

pre merge CI PR for oneapi-src/unified-runtime#1245

@kbenzie
Copy link
Contributor

kbenzie commented Jan 17, 2024

Okay, I've managed to reproduce this Windows compile error locally. I'll work on a fix to UR and prioritise it.

@kbenzie
Copy link
Contributor

kbenzie commented Jan 17, 2024

An include changed which also includes Windows.h, its defining min. Fix will be trivial.

kbenzie added a commit to kbenzie/unified-runtime that referenced this pull request Jan 17, 2024
Define `NOMINMAX` before including Windows.h to fix the building in
intel/llvm#12375.
@kbenzie
Copy link
Contributor

kbenzie commented Jan 17, 2024

oneapi-src/unified-runtime#1258 should do the trick.

@nrspruit nrspruit marked this pull request as draft January 17, 2024 15:49
@kbenzie
Copy link
Contributor

kbenzie commented Jan 17, 2024

oneapi-src/unified-runtime#1258 should do the trick.

Actually this isn't required, we already define NOMINMAX in the UR CMake but its not replicated in the PI plugin CMake for L0. If you apply this patch @nrspruit we should be able to merge this sooner:

diff --git a/sycl/plugins/level_zero/CMakeLists.txt b/sycl/plugins/level_zero/CMakeLists.txt
index 5c24988813c1..19a75b4736bd 100644
--- a/sycl/plugins/level_zero/CMakeLists.txt
+++ b/sycl/plugins/level_zero/CMakeLists.txt
@@ -102,6 +102,10 @@ add_sycl_plugin(level_zero
 if (WIN32)
   # 0x800: Search for the DLL only in the System32 folder
   target_link_options(pi_level_zero PUBLIC /DEPENDENTLOADFLAG:0x800)
+  target_compile_definitions(pi_level_zero PRIVATE
+    WIN32_LEAN_AND_MEAN
+    NOMINMAX
+  )
 endif()

 add_dependencies(pi_level_zero ze-api)

@nrspruit nrspruit marked this pull request as ready for review January 17, 2024 19:55
@nrspruit
Copy link
Contributor Author

oneapi-src/unified-runtime#1258 should do the trick.

Actually this isn't required, we already define NOMINMAX in the UR CMake but its not replicated in the PI plugin CMake for L0. If you apply this patch @nrspruit we should be able to merge this sooner:

diff --git a/sycl/plugins/level_zero/CMakeLists.txt b/sycl/plugins/level_zero/CMakeLists.txt
index 5c24988813c1..19a75b4736bd 100644
--- a/sycl/plugins/level_zero/CMakeLists.txt
+++ b/sycl/plugins/level_zero/CMakeLists.txt
@@ -102,6 +102,10 @@ add_sycl_plugin(level_zero
 if (WIN32)
   # 0x800: Search for the DLL only in the System32 folder
   target_link_options(pi_level_zero PUBLIC /DEPENDENTLOADFLAG:0x800)
+  target_compile_definitions(pi_level_zero PRIVATE
+    WIN32_LEAN_AND_MEAN
+    NOMINMAX
+  )
 endif()

 add_dependencies(pi_level_zero ze-api)

Hello @kbenzie , it looks like this flag is also needed for the opencl plugin. Should this be a larger patch for all plugins?

@nrspruit
Copy link
Contributor Author

oneapi-src/unified-runtime#1258 should do the trick.

Actually this isn't required, we already define NOMINMAX in the UR CMake but its not replicated in the PI plugin CMake for L0. If you apply this patch @nrspruit we should be able to merge this sooner:

diff --git a/sycl/plugins/level_zero/CMakeLists.txt b/sycl/plugins/level_zero/CMakeLists.txt
index 5c24988813c1..19a75b4736bd 100644
--- a/sycl/plugins/level_zero/CMakeLists.txt
+++ b/sycl/plugins/level_zero/CMakeLists.txt
@@ -102,6 +102,10 @@ add_sycl_plugin(level_zero
 if (WIN32)
   # 0x800: Search for the DLL only in the System32 folder
   target_link_options(pi_level_zero PUBLIC /DEPENDENTLOADFLAG:0x800)
+  target_compile_definitions(pi_level_zero PRIVATE
+    WIN32_LEAN_AND_MEAN
+    NOMINMAX
+  )
 endif()

 add_dependencies(pi_level_zero ze-api)

Hello @kbenzie , it looks like this flag is also needed for the opencl plugin. Should this be a larger patch for all plugins?

after updating both plugins opencl and level zero there is a new error because this is set elsewhere:
D:\github_work\llvm\llvm\src\xpti\include\xpti/xpti_trace_framework.hpp(25): error C2220: the following warning is treated as an error
D:\github_work\llvm\llvm\src\xpti\include\xpti/xpti_trace_framework.hpp(25): warning C4005: 'NOMINMAX': macro redefinition
D:\github_work\llvm\llvm\src\xpti\include\xpti/xpti_trace_framework.hpp(25): note: 'NOMINMAX' previously declared on the command line

@kbenzie
Copy link
Contributor

kbenzie commented Jan 18, 2024

after updating both plugins opencl and level zero there is a new error because this is set elsewhere:
D:\github_work\llvm\llvm\src\xpti\include\xpti/xpti_trace_framework.hpp(25): error C2220: the following warning is treated as an error
D:\github_work\llvm\llvm\src\xpti\include\xpti/xpti_trace_framework.hpp(25): warning C4005: 'NOMINMAX': macro redefinition
D:\github_work\llvm\llvm\src\xpti\include\xpti/xpti_trace_framework.hpp(25): note: 'NOMINMAX' previously declared on the command line

Hmm, perhaps we need to move the windows.h include out of ur_util.hpp to avoid it being transitively included all over the place. I'll try that out.

@kbenzie
Copy link
Contributor

kbenzie commented Jan 18, 2024

Since some functions moved out of the ur_util.hpp header the pi_unified_runtime target now needs to link against the UnifiedRuntimeCommon library. This should fix this link error.

diff --git a/sycl/plugins/unified_runtime/CMakeLists.txt b/sycl/plugins/unified_runtime/CMakeLists.txt
index 8d7f2f32b415..b2bb94714c0b 100644
--- a/sycl/plugins/unified_runtime/CMakeLists.txt
+++ b/sycl/plugins/unified_runtime/CMakeLists.txt
@@ -150,6 +150,7 @@ set(UNIFIED_RUNTIME_PLUGIN_ARGS
     Threads::Threads
     UnifiedRuntimeLoader
     UnifiedRuntime-Headers
+    UnifiedRuntimeCommon
   INCLUDE_DIRS
     "${UNIFIED_RUNTIME_SRC_INCLUDE_DIR}"
     "${UNIFIED_RUNTIME_COMMON_INCLUDE_DIR}"

@nrspruit nrspruit force-pushed the enable_relaxed_alloc_pre_merge branch from a0be361 to a2a27ff Compare January 18, 2024 16:57
nrspruit and others added 4 commits January 18, 2024 09:02
Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
@kbenzie
Copy link
Contributor

kbenzie commented Jan 19, 2024

My local build did not have SYCL_ENABLE_XPTI_TRACING=ON so they were not failing in this way. I've enabled that now and reproduced the error, I'm not really sure why its there yet but looking into it now.

@kbenzie
Copy link
Contributor

kbenzie commented Jan 19, 2024

I've reverted the CMake changes since they were no logner required after moving the Windows.h include, this should also fix the macro redefinition error.

@kbenzie kbenzie mentioned this pull request Jan 19, 2024
7 tasks
@againull againull merged commit 650dc77 into intel:sycl Jan 19, 2024
12 checks passed
steffenlarsen pushed a commit that referenced this pull request Jan 22, 2024
UR testing.

Depends on #12375

---------

Co-authored-by: Kenneth Benzie (Benie) <k.benzie83@gmail.com>
kbenzie added a commit that referenced this pull request Jan 22, 2024
Signed-off-by: Spruit, Neil R <neil.r.spruit@intel.com>
Co-authored-by: Kenneth Benzie (Benie) <k.benzie@codeplay.com>
kbenzie added a commit that referenced this pull request Jan 22, 2024
UR testing.

Depends on #12375

---------

Co-authored-by: Kenneth Benzie (Benie) <k.benzie83@gmail.com>
@aelovikov-intel
Copy link
Contributor

I see

SYCL :: DeviceLib/string_test.cpp

failing in post-commit after this PR on Intel Arc A-series GPU. Please fix ASAP, it's been ignored for two days...

@nrspruit @againull

@nrspruit
Copy link
Contributor Author

I see

SYCL :: DeviceLib/string_test.cpp

failing in post-commit after this PR on Intel Arc A-series GPU. Please fix ASAP, it's been ignored for two days...

@nrspruit @againull

Do you have a link to the error or an error log?

@aelovikov-intel
Copy link
Contributor

Do you have a link to the error or an error log?

https://github.com/intel/llvm/actions/runs/7588321461/job/20670983110

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants