-
Notifications
You must be signed in to change notification settings - Fork 789
[SYCL] Add basic tests for virtual functions #14209
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
[SYCL] Add basic tests for virtual functions #14209
Conversation
…ual-functions-basic-e2e-tests
…ual-functions-basic-e2e-tests
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.
Looks good overall. One smallish question.
sizeof(SubstractBy4), sizeof(SubstractBy4AndMultiplyBy4)}); | ||
|
||
sycl::buffer<char> ObjStorage(sycl::range{Size}); | ||
char HostStorage[Size]; |
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.
Do we need to set the alignment of these to correspond to some common alignment between the types we may place in it?
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.
Good question, I think we should indeed align the storage as well. basic.align.1 says:
Attempting to create an object ([intro.object]) in storage that does not meet the alignment requirements of the object's type is undefined behavior.
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.
Resolved in 04dda01
Main motivation is to make sure that storage for objects is properly aligned so there are no UBs when using placement new. It also allowed to simplify tests source code by outlining some common/similar object construction part into a helper.
…ual-functions-basic-e2e-tests
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.
Looks good!
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.
🚀
Failure in host task does not seem related, or I don't understand how adding new tests could lead to timeout on the old one (and that was per-test timeout, not per-suite). I've reported the failure in #14613 and will proceed with the merge |
return nullptr; | ||
} | ||
|
||
return constructHelper<RetT, T...>(TypeIndex, 0); |
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 think something like
llvm/sycl/include/sycl/vector.hpp
Lines 1204 to 1209 in 8eeb60d
static constexpr auto get_vec_idx(int idx) { | |
int counter = 0; | |
int result = -1; | |
((result = counter++ == idx ? Indexes : result), ...); | |
return result; | |
} |
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.
TypeIndex
is a runtime value here, the function is not constexpr
.
Otherwise, I think I could have used tuple_element
as built-in helper, essentially
UPD: looking at it more, TypeIndex
being RT value shouldn't matter here. Checks are happening at runtime, only expansion happens at compile-time and list of types is known. I will take a deeper look to see if I can simplify this
Test plan is available in #10540