-
Notifications
You must be signed in to change notification settings - Fork 131
[SYCL] Add a test with rebound usm_allocator #1038
Conversation
According to https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_c_allocator_interface the default value for the "Alignment" template parameter must be 0. Otherwise the rebound allocator wouldn't change the alignment properly. Test added in intel/llvm-test-suite#1038
/verify with intel/llvm#6191 |
59ded82
to
6fd5ca7
Compare
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.
LGTM
/verify with intel/llvm#6191 |
/verify with intel/llvm#6191 |
Instead, repurpose the test to serve as a manual check/documentation/example.
SYCL/USM/allocator_rebind.cpp
Outdated
int NumExactlyAligned = 0; | ||
|
||
for (auto *Ptr : Ptrs) { | ||
auto Val = reinterpret_cast<uintptr_t>(Ptr); |
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.
maybe rename Val
to Addr
? that might be clearer
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 didn't want to do that because its type wouldn't be a pointer. Can rename if you insist though.
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 wouldn't insist, but maybe persuade?
If someone isn't reading this closely, then they'll likely conclude that Val
is just the value held by the pointer. But clearly, we are testing the actual address of the pointer to ensure it's aligned. So I think Addr
, or similar, is clearer for the upcoming operations. Also, it makes people pay attention. "Wow, he wants the address? That is so cool, I'd like to meet this guy"
Basically, reverse alignment change direction during the rebinding.
/verify with intel/llvm#6191 |
/verify with intel/llvm#6191 |
/verify with intel/llvm#6191 |
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.
LGTM
According to https://www.khronos.org/registry/SYCL/specs/sycl-2020/html/sycl-2020.html#_c_allocator_interface the default value for the "Alignment" template parameter must be 0. Otherwise the rebound allocator wouldn't change the alignment properly. Test added in intel/llvm-test-suite#1038
No description provided.