Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

[SYCL] Add a test with rebound usm_allocator #1038

Merged
merged 10 commits into from
Jun 4, 2022

Conversation

aelovikov-intel
Copy link

No description provided.

aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request May 25, 2022
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
@aelovikov-intel
Copy link
Author

/verify with intel/llvm#6191

@aelovikov-intel aelovikov-intel marked this pull request as ready for review May 25, 2022 17:13
@aelovikov-intel aelovikov-intel requested a review from a team as a code owner May 25, 2022 17:13
@aelovikov-intel aelovikov-intel force-pushed the usm_allocator_rebound branch from 59ded82 to 6fd5ca7 Compare May 25, 2022 19:23
Copy link

@gmlueck gmlueck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

smaslov-intel
smaslov-intel previously approved these changes May 26, 2022
@aelovikov-intel
Copy link
Author

/verify with intel/llvm#6191

@aelovikov-intel
Copy link
Author

/verify with intel/llvm#6191

Instead, repurpose the test to serve as a manual check/documentation/example.
int NumExactlyAligned = 0;

for (auto *Ptr : Ptrs) {
auto Val = reinterpret_cast<uintptr_t>(Ptr);

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

Copy link
Author

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.

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.
@aelovikov-intel
Copy link
Author

/verify with intel/llvm#6191

@aelovikov-intel
Copy link
Author

/verify with intel/llvm#6191

@aelovikov-intel
Copy link
Author

/verify with intel/llvm#6191

Copy link

@cperkinsintel cperkinsintel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pvchupin pvchupin merged commit 6bf5d74 into intel:intel Jun 4, 2022
pvchupin pushed a commit to intel/llvm that referenced this pull request Jun 4, 2022
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
myler pushed a commit to myler/llvm-test-suite that referenced this pull request Jun 17, 2022
@aelovikov-intel aelovikov-intel deleted the usm_allocator_rebound branch August 15, 2022 20:46
aelovikov-intel added a commit to aelovikov-intel/llvm that referenced this pull request Mar 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants