-
Notifications
You must be signed in to change notification settings - Fork 787
[SYCL][Fusion] Restrict types of fusable command groups #12556
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
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
// RUN: %{build} -fsycl-embed-ir -o %t.out | ||
// RUN: env SYCL_RT_WARNING_LEVEL=2 %{run} %t.out 2>&1 | FileCheck %s | ||
|
||
// Test non-kernel device command groups are not fused | ||
|
||
#include <sycl/sycl.hpp> | ||
|
||
using namespace sycl; | ||
|
||
int main() { | ||
constexpr size_t dataSize = 512; | ||
constexpr float Pattern{10}; | ||
|
||
queue q{ext::codeplay::experimental::property::queue::enable_fusion{}}; | ||
ext::codeplay::experimental::fusion_wrapper fw(q); | ||
|
||
constexpr size_t count = 64; | ||
auto *dst = malloc_device<float>(count, q); | ||
auto *src = malloc_device<float>(count, q); | ||
|
||
{ | ||
// CHECK: Not fusing 'copy acc to ptr' command group. Can only fuse device kernel command groups. | ||
buffer<float> src(dataSize); | ||
std::shared_ptr<float> dst(new float[dataSize]); | ||
fw.start_fusion(); | ||
q.submit([&](handler &cgh) { | ||
accessor acc(src, cgh, read_only); | ||
cgh.copy(acc, dst); | ||
}); | ||
fw.complete_fusion(); | ||
} | ||
|
||
{ | ||
// CHECK: Not fusing 'copy ptr to acc' command group. Can only fuse device kernel command groups. | ||
buffer<float> dst(dataSize); | ||
std::shared_ptr<float> src(new float[dataSize]); | ||
fw.start_fusion(); | ||
q.submit([&](handler &cgh) { | ||
accessor acc(dst, cgh, write_only); | ||
cgh.copy(src, acc); | ||
}); | ||
fw.complete_fusion(); | ||
} | ||
|
||
{ | ||
// CHECK: Not fusing 'copy acc to acc' command group. Can only fuse device kernel command groups. | ||
buffer<float> dst(dataSize); | ||
buffer<float> src(dataSize); | ||
fw.start_fusion(); | ||
q.submit([&](handler &cgh) { | ||
accessor acc0(src, cgh, read_only); | ||
accessor acc1(dst, cgh, write_only); | ||
cgh.copy(acc0, acc1); | ||
}); | ||
fw.complete_fusion(); | ||
} | ||
|
||
{ | ||
// CHECK: Not fusing 'barrier' command group. Can only fuse device kernel command groups. | ||
fw.start_fusion(); | ||
q.submit([&](handler &cgh) { cgh.ext_oneapi_barrier(); }); | ||
fw.complete_fusion(); | ||
} | ||
|
||
{ | ||
// CHECK: Not fusing 'barrier waitlist' command group. Can only fuse device kernel command groups. | ||
buffer<float> dst(dataSize); | ||
buffer<float> src(dataSize); | ||
std::vector<event> event_list; | ||
event_list.push_back(q.submit([&](handler &cgh) { | ||
accessor acc0(src, cgh, read_only); | ||
accessor acc1(dst, cgh, write_only); | ||
cgh.copy(acc0, acc1); | ||
})); | ||
fw.start_fusion(); | ||
q.submit([&](handler &cgh) { cgh.ext_oneapi_barrier(event_list); }); | ||
fw.complete_fusion(); | ||
} | ||
|
||
{ | ||
// CHECK: Not fusing 'fill' command group. Can only fuse device kernel command groups. | ||
buffer<float> dst(dataSize); | ||
fw.start_fusion(); | ||
q.submit([&](handler &cgh) { | ||
accessor acc(dst, cgh, write_only); | ||
cgh.fill(acc, Pattern); | ||
}); | ||
fw.complete_fusion(); | ||
} | ||
|
||
{ | ||
// CHECK: Not fusing 'copy usm' command group. Can only fuse device kernel command groups. | ||
fw.start_fusion(); | ||
q.submit([&](handler &cgh) { cgh.memcpy(dst, src, count); }); | ||
fw.complete_fusion(); | ||
} | ||
|
||
{ | ||
// CHECK: Not fusing 'fill usm' command group. Can only fuse device kernel command groups. | ||
fw.start_fusion(); | ||
q.submit([&](handler &cgh) { | ||
cgh.memset(dst, static_cast<int>(Pattern), count); | ||
}); | ||
fw.complete_fusion(); | ||
} | ||
|
||
free(src, q); | ||
free(dst, q); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.