-
Notifications
You must be signed in to change notification settings - Fork 808
[SYCL] Fix performance regression in parallel_for with using id class #5385
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
bader
merged 4 commits into
intel:sycl
from
aobolensk:perf_regression_user_defined_type_conversion
Feb 8, 2022
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
78f2888
Fix performance regression in parallel_for with using id class
aobolensk a160066
Use _t and _v versions of type traits
aobolensk 0ddb352
Add test for sycl::id type
aobolensk 9a841b1
Add is_same_v and is_convertible_v to detail namespace
aobolensk 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // RUN: %clangxx -fsycl -fsycl-device-only -D__SYCL_INTERNAL_API -O0 -c -emit-llvm -S -o - %s | FileCheck %s | ||
|
|
||
| // This test performs basic type check for sycl::id that is used in result type. | ||
|
|
||
| #include <CL/sycl.hpp> | ||
| #include <iostream> | ||
|
|
||
| int main() { | ||
| sycl::queue q; | ||
|
|
||
| // Initialize data array | ||
| const int sz = 16; | ||
| int data[sz] = {0}; | ||
| for (int i = 0; i < sz; ++i) { | ||
| data[i] = i; | ||
| } | ||
|
|
||
| // Check user defined sycl::item wrapper | ||
| sycl::buffer<int> data_buf(data, sz); | ||
| q.submit([&](sycl::handler &h) { | ||
| auto buf_acc = data_buf.get_access<sycl::access::mode::read_write>(h); | ||
| h.parallel_for( | ||
| sycl::range<1>{sz}, | ||
| // CHECK: cl{{.*}}sycl{{.*}}detail{{.*}}RoundedRangeKernel{{.*}}id{{.*}}main{{.*}}handler | ||
| [=](sycl::id<1> item) { buf_acc[item] += 1; }); | ||
| }); | ||
| q.wait(); | ||
|
|
||
| return 0; | ||
| } |
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.
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.
We are using at least C++17, right?
Perhaps you can try whether you can remove the
typenameand see whether it still compiles.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.
I have tried to replace
std::is_samewithstd::is_same_vtoo, but it leads tobasic_tests/stdcpp_compat.cppfailure (https://github.com/intel/llvm/runs/4948816096?check_suite_focus=true)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.
By looking at the compilation line in your CI test I can see:
"/__w/llvm/llvm/build/bin/clang" "--driver-mode=g++" "-Xsycl-target-backend=amdgcn-amd-amdhsa" "--offload-arch=gfx906" "-D_GLIBCXX_ASSERTIONS=1" "-std=c++14"C++14 whaaaat? :-)
@bader do you still have some old C++14 while SYCL 2020 is requiring at least C++17?
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.
Yes.
https://github.com/intel/llvm/blob/sycl/sycl/test/basic_tests/stdcpp_compat.cpp#L13 - as you can see this comment says that some features can be unavailable. We are trying to transition old codes written in SYCL-1.2.1 softly.
New code requiring c++17 features can be added under
#ifdef __cplusplus >= 201703L.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.
Perhaps this is a good opportunity to extend https://github.com/intel/llvm/blob/54ede407edeb93b7e9334d1e725f48bf981b2965/sycl/include/CL/sycl/detail/stl_type_traits.hpp with a few
_vones in the meantime?Uh oh!
There was an error while loading. Please reload this page.
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.
@bader do we need to add missing
_vfunctions to stl_type_traits.hpp or we are going to leave it as it is now?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.
@aobolensk, I think this is what @keryell requests. Do you have any objections?
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.
@bader No objections. I will add it.