Skip to content
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][Doc] Introduce test plan for virtual mem extension #15509

Open
wants to merge 1 commit into
base: sycl
Choose a base branch
from

Conversation

AlexeySachkov
Copy link
Contributor

No description provided.

@AlexeySachkov AlexeySachkov requested review from steffenlarsen and a team September 25, 2024 14:20
@AlexeySachkov AlexeySachkov requested a review from a team as a code owner September 25, 2024 14:20
Functionality provided by the extension is optional and it is only available if
corresponding aspect (`ext_oneapi_virtual_mem`) is supported by a device.

However, we still need to check that that we return a proper exception (with
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
However, we still need to check that that we return a proper exception (with
However, we still need to check that we return a proper exception (with

Copy link
Contributor

Choose a reason for hiding this comment

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

Otherwise LGTM

This test case is intended to check that memory accesses to contiguous
virtual memory ranges are performed correctly.

A test reserve a number of virtual memory ranges which comprsise a contiguous
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
A test reserve a number of virtual memory ranges which comprsise a contiguous
A test reserve a number of virtual memory ranges which comprise a contiguous

- that we can copy _from_ a buffer via accessor _to_ virtual memory
- that we can use `memset` on virtual memory
- that we can use `fill` on virtual memory

Copy link
Contributor

Choose a reason for hiding this comment

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

What about calling sycl::free on a virtual memory pointer?
If it's allowed, and the spec does say that it is allowed, then should we also check it has same effect as the unmap function?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it should be an explicit exception in the spec about sycl::free because the core spec says the pointer must have been allocated using one of the USM allocation functions.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, free should be excluded by the extension. Maybe add another todo to mention this open?

passed to it contains multiple devices and not every of them have
`ext_oneapi_virtual_mem` aspect
- **TODO**: do we need to check that returned granularity is not bigger than
maximum allocation size on a device?
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting question. It's not necessarily guaranteed by the spec, but maybe it would be good to make sure. I would assume the max allocation still applies to these.

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

Overall I think this looks reasonable. 👍

APIs results in UB and therefore there is nothing to test. This is probably an
incorrect approach of the spec, because we should be able to perform some checks
and inform user about an error. If/when the spec is updated, this test plan
should be updated as well to cover those new scenarios.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this was intentionally left out to avoid the overhead of calculating these things and requesting information that the user should have already requested. That said, this is not something I expect the user to call 1M times, so maybe the overhead would be fine.

- that we can copy _from_ a buffer via accessor _to_ virtual memory
- that we can use `memset` on virtual memory
- that we can use `fill` on virtual memory

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, free should be excluded by the extension. Maybe add another todo to mention this open?

steffenlarsen pushed a commit that referenced this pull request Oct 28, 2024
…tension (#15848)

Based on the test plan #15509, this PR
adds an e2e test checking memory granularities returned by
`get_mem_granularity`.

---------

Co-authored-by: Alexey Sachkov <[email protected]>
Co-authored-by: Marcos Maronas <[email protected]>
steffenlarsen pushed a commit that referenced this pull request Oct 30, 2024
…eapi_virtual_mem` extension (#15887)

Based on the test plan #15509, this PR
adds an e2e test checking whether virtual memory range can correctly be
accessed even if it was re-mapped to a different physical range.
YixingZhang007 pushed a commit to YixingZhang007/llvm that referenced this pull request Oct 30, 2024
…tension (intel#15848)

Based on the test plan intel#15509, this PR
adds an e2e test checking memory granularities returned by
`get_mem_granularity`.

---------

Co-authored-by: Alexey Sachkov <[email protected]>
Co-authored-by: Marcos Maronas <[email protected]>
YixingZhang007 pushed a commit to YixingZhang007/llvm that referenced this pull request Oct 30, 2024
…eapi_virtual_mem` extension (intel#15887)

Based on the test plan intel#15509, this PR
adds an e2e test checking whether virtual memory range can correctly be
accessed even if it was re-mapped to a different physical range.
martygrant pushed a commit that referenced this pull request Nov 4, 2024
)

Based on the test plan #15509, this PR
adds an e2e test described as `Basic access from a kernel`.
It introduces the `helpers.hpp` common header file, which includes the
`GetLCMGranularity` function, to be used in upcoming e2e tests for
`sycl_ext_oneapi_virtual_mem` extension.

---------

Co-authored-by: Alexey Sachkov <[email protected]>
Co-authored-by: Steffen Larsen <[email protected]>
steffenlarsen pushed a commit that referenced this pull request Nov 8, 2024
…irtual_mem` extension (#15988)

Based on the test plan #15509, this PR
adds an e2e test that performs following checks:
- A check should be performed that we can successfully perform and
immediately release a valid reservation of virtual memory.
- A check should be performed that methods `get_context()`,
`get_device()` and `size()` return correct values (i.e. ones which were
passed to physical_mem constructor).
- A check should be performed that a value returned from a valid call to
`map()` is the same as `reinterpret_cast<void *>(ptr)`.
- A check should be performed that we can change access mode of a
virtual memory range and immediately see it changed.
- A check should be performed that we can successfully map and
immediately unmap a virtual memory range.
martygrant pushed a commit that referenced this pull request Nov 8, 2024
…_virtual_mem` extension (#15944)

Based on the test plan #15509, this PR
adds an e2e test described as `"Extending" virtual memory range`.
steffenlarsen pushed a commit that referenced this pull request Nov 12, 2024
…em` extension (#15974)

Based on the test plan #15509, this PR
adds an E2E test to ensure that USM APIs also accept the pointer to
virtual memory.

---------

Co-authored-by: Udit Agarwal <[email protected]>
sarnex pushed a commit that referenced this pull request Nov 14, 2024
…sion (#16050)

Based on the test plan #15509, this PR
adds an unit-test checking if extension throws expected exception when
one of the devices does not have `sycl::aspect::ext_oneapi_virtual_mem`.
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.

5 participants