-
Notifications
You must be signed in to change notification settings - Fork 795
[UR][SYCL] Add support for bidirectional USM prefetching #16047
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
Changes from all commits
28410c6
b52e1c9
fd714dc
cfcf6ed
fb407c2
26a9b47
f0f228e
272adc6
23f1d3a
af6ca57
d299e93
aceb895
c3275d2
ed00b06
c6c9edc
fd3d2e5
d166c94
ea90e8a
6e301db
edd6953
dc22f07
1283866
af759f4
3b449e1
847f00a
a357c83
40eaf08
206c6da
71765c6
4f773d5
1b3ff0c
b001eac
1bd9f25
da8cd0c
b2d92d7
0ec09f8
653df4f
4e910dc
d8dedee
e0730ea
85939ab
15fabf6
a0ba532
c976662
ca566dd
b173fda
c416193
0a33c2f
2268f26
4f2c030
2e286fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| # commit d03f19a88e42cb98be9604ff24b61190d1e48727 | ||
| # Merge: 3ce6fcc9 84454b0e | ||
| # Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com> | ||
| # Date: Thu Feb 13 11:43:34 2025 +0000 | ||
| # Merge pull request #2680 from ldorau/Set_UMF_CUDA_INCLUDE_DIR_to_not_fetch_cudart_from_gitlab | ||
| # Do not fetch cudart from gitlab for UMF | ||
| set(UNIFIED_RUNTIME_TAG d03f19a88e42cb98be9604ff24b61190d1e48727) | ||
| # commit 5e33542d592b63fc4d35fc4ffd02efb5c33395ec | ||
| # Merge: 1b0f730f 3ce6fcc9 | ||
| # Author: Li, Ian <ian.li@intel.com> | ||
| # Date: Wed Feb 12 14:47:55 2025 -0800 | ||
| # | ||
| # Merge branch 'main' of https://github.com/oneapi-src/unified-runtime into ianayl/2way-prefetch | ||
| set(UNIFIED_RUNTIME_TAG 5e33542d592b63fc4d35fc4ffd02efb5c33395ec) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| //==--------------- enqueue_types.hpp ---- SYCL enqueue types --------------==// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <string> | ||
|
|
||
| namespace sycl { | ||
| inline namespace _V1 { | ||
| namespace ext::oneapi::experimental { | ||
|
|
||
| /// @brief Indicates the destination device for USM data to be prefetched to. | ||
| enum class prefetch_type { device, host }; | ||
|
|
||
| inline std::string prefetchTypeToString(prefetch_type value) { | ||
| switch (value) { | ||
| case sycl::ext::oneapi::experimental::prefetch_type::device: | ||
| return "prefetch_type::device"; | ||
| case sycl::ext::oneapi::experimental::prefetch_type::host: | ||
| return "prefetch_type::host"; | ||
| default: | ||
| return "prefetch_type::unknown"; | ||
| } | ||
| } | ||
|
|
||
| } // namespace ext::oneapi::experimental | ||
| } // namespace _V1 | ||
| } // namespace sycl |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,24 +8,27 @@ | |||||
|
|
||||||
| #pragma once | ||||||
|
|
||||||
| #include <sycl/accessor.hpp> // for AccessorImplHost, AccessorImplPtr | ||||||
| #include <sycl/detail/cg_types.hpp> // for ArgDesc, HostTask, HostKernelBase | ||||||
| #include <sycl/detail/common.hpp> // for code_location | ||||||
| #include <sycl/detail/helpers.hpp> // for context_impl | ||||||
| #include <sycl/detail/ur.hpp> // for ur_rect_region_t, ur_rect_offset_t | ||||||
| #include <sycl/event.hpp> // for event_impl | ||||||
| #include <sycl/exception_list.hpp> // for queue_impl | ||||||
| #include <sycl/accessor.hpp> // for AccessorImplHost, AccessorImplPtr | ||||||
| #include <sycl/detail/cg_types.hpp> // for ArgDesc, HostTask, HostKernelBase | ||||||
| #include <sycl/detail/common.hpp> // for code_location | ||||||
| #include <sycl/detail/helpers.hpp> // for context_impl | ||||||
| #include <sycl/detail/ur.hpp> // for ur_rect_region_t, ur_rect_offset_t | ||||||
| #include <sycl/event.hpp> // for event_impl | ||||||
| #include <sycl/exception_list.hpp> // for queue_impl | ||||||
| #include <sycl/ext/oneapi/experimental/event_mode_property.hpp> | ||||||
| #include <sycl/kernel.hpp> // for kernel_impl | ||||||
| #include <sycl/kernel_bundle.hpp> // for kernel_bundle_impl | ||||||
|
|
||||||
| #include <assert.h> // for assert | ||||||
| #include <memory> // for shared_ptr, unique_ptr | ||||||
| #include <stddef.h> // for size_t | ||||||
| #include <stdint.h> // for int32_t | ||||||
| #include <string> // for string | ||||||
| #include <utility> // for move | ||||||
| #include <vector> // for vector | ||||||
| #ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||||||
| #include <sycl/ext/oneapi/experimental/enqueue_types.hpp> // for prefetch_type | ||||||
| #endif | ||||||
| #include <sycl/kernel.hpp> // for kernel_impl | ||||||
| #include <sycl/kernel_bundle.hpp> // for kernel_bundle_impl | ||||||
|
|
||||||
| #include <assert.h> // for assert | ||||||
| #include <memory> // for shared_ptr, unique_ptr | ||||||
| #include <stddef.h> // for size_t | ||||||
| #include <stdint.h> // for int32_t | ||||||
| #include <string> // for string | ||||||
| #include <utility> // for move | ||||||
| #include <vector> // for vector | ||||||
|
|
||||||
| namespace sycl { | ||||||
| inline namespace _V1 { | ||||||
|
|
@@ -406,6 +409,41 @@ class CGPrefetchUSM : public CG { | |||||
| size_t getLength() { return MLength; } | ||||||
| }; | ||||||
|
|
||||||
| /// Command group class for experimental USM prefetch provided in the enqueue | ||||||
| /// functions extension. | ||||||
| #ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||||||
| class CGPrefetchUSMExp : public CG { | ||||||
| void *MDst; | ||||||
| size_t MLength; | ||||||
| ext::oneapi::experimental::prefetch_type MPrefetchType; | ||||||
|
|
||||||
| public: | ||||||
| CGPrefetchUSMExp(void *DstPtr, size_t Length, CG::StorageInitHelper CGData, | ||||||
| ext::oneapi::experimental::prefetch_type Type, | ||||||
| detail::code_location loc = {}) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| : CG(CGType::PrefetchUSMExp, std::move(CGData), std::move(loc)), | ||||||
| MDst(DstPtr), MLength(Length), MPrefetchType(Type) {} | ||||||
| void *getDst() { return MDst; } | ||||||
| size_t getLength() { return MLength; } | ||||||
| ext::oneapi::experimental::prefetch_type getPrefetchType() { | ||||||
| return MPrefetchType; | ||||||
| } | ||||||
| }; | ||||||
| #else | ||||||
| class CGPrefetchUSMExpD2H : public CG { | ||||||
| void *MDst; | ||||||
| size_t MLength; | ||||||
|
|
||||||
| public: | ||||||
| CGPrefetchUSMExpD2H(void *DstPtr, size_t Length, CG::StorageInitHelper CGData, | ||||||
| detail::code_location loc = {}) | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| : CG(CGType::PrefetchUSMExpD2H, std::move(CGData), std::move(loc)), | ||||||
| MDst(DstPtr), MLength(Length) {} | ||||||
| void *getDst() { return MDst; } | ||||||
| size_t getLength() { return MLength; } | ||||||
| }; | ||||||
| #endif | ||||||
|
|
||||||
| /// "Advise USM" command group class. | ||||||
| class CGAdviseUSM : public CG { | ||||||
| void *MDst; | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -243,6 +243,13 @@ class node_impl : public std::enable_shared_from_this<node_impl> { | |
| return createCGCopy<sycl::detail::CGFillUSM>(); | ||
| case sycl::detail::CGType::PrefetchUSM: | ||
| return createCGCopy<sycl::detail::CGPrefetchUSM>(); | ||
| #ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a reason why getCGCopy() throws an exception here? In command.cpp line 3046 there is an implementation for these new command group types when using Graphs. If that implementation is working, then I wouldn't expect an exception to be thrown only when a CG copy happens. |
||
| case sycl::detail::CGType::PrefetchUSMExp: | ||
| return createCGCopy<sycl::detail::CGPrefetchUSMExp>(); | ||
| #else | ||
| case sycl::detail::CGType::PrefetchUSMExpD2H: | ||
| return createCGCopy<sycl::detail::CGPrefetchUSMExpD2H>(); | ||
| #endif | ||
| case sycl::detail::CGType::AdviseUSM: | ||
| return createCGCopy<sycl::detail::CGAdviseUSM>(); | ||
| case sycl::detail::CGType::Copy2DUSM: | ||
|
|
@@ -636,6 +643,31 @@ class node_impl : public std::enable_shared_from_this<node_impl> { | |
| << " Length: " << Prefetch->getLength() << "\\n"; | ||
| } | ||
| break; | ||
| #ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||
| case sycl::detail::CGType::PrefetchUSMExp: | ||
| Stream << "CGPrefetchUSMExp \\n"; | ||
| if (Verbose) { | ||
| sycl::detail::CGPrefetchUSMExp *Prefetch = | ||
| static_cast<sycl::detail::CGPrefetchUSMExp *>(MCommandGroup.get()); | ||
| Stream << "Dst: " << Prefetch->getDst() | ||
| << " Length: " << Prefetch->getLength() << " Type: " | ||
| << sycl::ext::oneapi::experimental::prefetchTypeToString( | ||
| Prefetch->getPrefetchType()) | ||
| << "\\n"; | ||
| } | ||
| break; | ||
| #else | ||
| case sycl::detail::CGType::PrefetchUSMExpD2H: | ||
| Stream << "CGPrefetchUSM (Experimental, Device-To-Host) \\n"; | ||
| if (Verbose) { | ||
| sycl::detail::CGPrefetchUSMExpD2H *Prefetch = | ||
| static_cast<sycl::detail::CGPrefetchUSMExpD2H *>( | ||
| MCommandGroup.get()); | ||
| Stream << "Dst: " << Prefetch->getDst() | ||
| << " Length: " << Prefetch->getLength() << "\\n"; | ||
| } | ||
| break; | ||
| #endif | ||
| case sycl::detail::CGType::AdviseUSM: | ||
| Stream << "CGAdviseUSM \\n"; | ||
| if (Verbose) { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, apply also to other files.