Skip to content

Add definition of when a USM allocation is 'accessible'. - #1057

Open
VerenaBeckham wants to merge 2 commits into
KhronosGroup:mainfrom
VerenaBeckham:verena/accessible
Open

VerenaBeckham wants to merge 2 commits into
KhronosGroup:mainfrom
VerenaBeckham:verena/accessible

Conversation

@VerenaBeckham

Copy link
Copy Markdown
Contributor

Part 2 of addressing #186.


Each USM allocation has an associated SYCL <<context>>, and any access to that
memory must use the same context.
Each USM allocation has an associated SYCL <<context>> and must be accessible in

@TApplencourt TApplencourt Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we replace this with something like

A USM allocation in only accessible in devices associated with his <<context>>. More restriction apply:

And then remove the context part of both shared and host? If not we need to add a "context" for device alloc:

A USM device allocation is accessible only from the device and the context specified in the USM allocation.

Because, AFAIK, the code bellow is UB

sycl::context C1{D} C2{D}
sycl::queue Q1(C1,D); Q2(C2,D);
auto p = mallloc_device(Q1);
Q2.submit( *p); // UB. Not the same context, even if it's the same "physical" device

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ah, you are correct. I prefer folding the Context requirement into the bullet points, because it does not apply to the host allocations.
I made that change. I hope it is clear enough to say "device and context".
I also added that device and shared allocations have an associated device, which I think is good info. I've had to look up the different malloc APIs to understand the difference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants