-
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 36 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,6 @@ | ||
| # commit 39df0317814c164f5242eda8d6f08550f6268492 | ||
| # Merge: 68d93efd be27d8f0 | ||
| # Author: Kenneth Benzie (Benie) <k.benzie@codeplay.com> | ||
| # Date: Mon Dec 16 13:53:13 2024 +0000 | ||
| # Merge pull request #2467 from nrspruit/fix_external_import_function_call | ||
| # [L0] Fix external semaphore import function calls to match the header | ||
| set(UNIFIED_RUNTIME_TAG 39df0317814c164f5242eda8d6f08550f6268492) | ||
| # commit 8e819c2d4d3cd7e8a5d8b5ea64ed22dab575737f | ||
| # Merge: 65ca7748 39df0317 | ||
| # Author: Li, Ian <ian.li@intel.com> | ||
| # Date: Mon Dec 16 10:05:24 2024 -0800 | ||
| # Merge branch 'main' of https://github.com/oneapi-src/unified-runtime into ianayl/2way-prefetch | ||
| set(UNIFIED_RUNTIME_TAG 8e819c2d4d3cd7e8a5d8b5ea64ed22dab575737f) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| //==--------------- 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 | ||
|
|
||
| namespace sycl { | ||
| inline namespace _V1 { | ||
| namespace ext::oneapi::experimental { | ||
|
|
||
| /// @brief Indicates the destination device for USM data to be prefetched to | ||
ianayl marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| enum class prefetch_type { device, host }; | ||
|
|
||
| } // namespace ext::oneapi::experimental | ||
| } // namespace _V1 | ||
| } // namespace sycl | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,9 @@ | |||||
| #include <sycl/event.hpp> // for event_impl | ||||||
| #include <sycl/exception_list.hpp> // for queue_impl | ||||||
| #include <sycl/ext/oneapi/experimental/event_mode_property.hpp> | ||||||
| #ifdef __INTEL_PREVIEW_BREAKING_CHANGES | ||||||
| #include <sycl/ext/oneapi/experimental/enqueue_types.hpp> // for prefetch_type | ||||||
|
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
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. Please, apply also to other files. |
||||||
| #endif | ||||||
| #include <sycl/kernel.hpp> // for kernel_impl | ||||||
| #include <sycl/kernel_bundle.hpp> // for kernel_bundle_impl | ||||||
|
|
||||||
|
|
@@ -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 |
|---|---|---|
|
|
@@ -242,6 +242,19 @@ 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: | ||
| throw sycl::exception(sycl::make_error_code(errc::feature_not_supported), | ||
| "Prefetch as a part of the experimental enqueue " | ||
| "function extension is currently not supported by " | ||
| "SYCL Graph extension."); | ||
| // return createCGCopy<sycl::detail::CGPrefetchUSMExp>(); | ||
| #else | ||
| case sycl::detail::CGType::PrefetchUSMExpD2H: | ||
| throw sycl::exception(sycl::make_error_code(errc::feature_not_supported), | ||
| "Prefetch from device to host is currently not " | ||
| "supported by SYCL Graph extension."); | ||
| #endif | ||
| case sycl::detail::CGType::AdviseUSM: | ||
| return createCGCopy<sycl::detail::CGAdviseUSM>(); | ||
| case sycl::detail::CGType::Copy2DUSM: | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.