-
Notifications
You must be signed in to change notification settings - Fork 796
[SYCL][E2E] Add granularity test for sycl_ext_oneapi_virtual_mem extension
#15848
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
Merged
steffenlarsen
merged 15 commits into
intel:sycl
from
dyniols:memory_granularity_and_physical_granularity_checks
Oct 28, 2024
Merged
Changes from 7 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
a506752
added tests checking memory granularity for virtual memory extension
dyniols e9a131d
fix
dyniols 2cb74a1
formatting fixed
dyniols ecfbac8
added description for test
dyniols 662f8e5
formatting fix
dyniols 6975924
removed unnecessary headers
dyniols 27e66fa
new line
dyniols 0ff5854
Update sycl/test-e2e/VirtualMem/memory_granularity.cpp
dyniols 1649631
Update sycl/test-e2e/VirtualMem/memory_granularity.cpp
dyniols c6f0f37
adjusted according to suggestions
dyniols 7b0529d
formatting fixed
dyniols 7f087ea
added lit.local.cfg
dyniols 91ca5cd
added newline
dyniols bb1f4c2
removed unnecessary import
dyniols 5396f1b
fix
dyniols File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| // REQUIRES: aspect-ext_oneapi_virtual_mem | ||
|
|
||
| // This test checks whether memory granularity returned is greater then 0 and | ||
dyniols marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| // that the recommended granularity is the same size or greater than the minimum | ||
| // granularity for virtul memory extension. | ||
dyniols marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| // RUN: %{build} -o %t.out | ||
| // RUN: %{run} %t.out | ||
|
|
||
| #include <string_view> | ||
|
|
||
| #include <sycl/detail/core.hpp> | ||
|
|
||
| #include <sycl/ext/oneapi/virtual_mem/virtual_mem.hpp> | ||
|
|
||
| namespace syclext = sycl::ext::oneapi::experimental; | ||
|
|
||
| template <typename... ArgsT> | ||
| int CheckReturnedGranularitySize(std::string_view TestName, ArgsT... Args) { | ||
| if (syclext::get_mem_granularity(Args...) == 0) { | ||
| std::cout << "Failed check: " << TestName << std::endl; | ||
| return 1; | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| int main() { | ||
| int Failed = 0; | ||
| sycl::queue Q; | ||
| sycl::context Context = Q.get_context(); | ||
| sycl::device Device = Q.get_device(); | ||
|
|
||
| Failed += CheckReturnedGranularitySize( | ||
| "returned granularity size must be greater then 0 for device and " | ||
| "granularity_mode::recommended", | ||
dyniols marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Device, Context, syclext::granularity_mode::recommended); | ||
| Failed += CheckReturnedGranularitySize( | ||
| "returned granularity size must be greater then 0 for device and " | ||
| "granularity_mode::minimum", | ||
| Device, Context, syclext::granularity_mode::minimum); | ||
| Failed += CheckReturnedGranularitySize( | ||
| "returned granularity size must be greater then 0 for context and " | ||
| "granularity_mode::recommended", | ||
| Context, syclext::granularity_mode::recommended); | ||
| Failed += CheckReturnedGranularitySize( | ||
| "returned granularity size must be greater then 0 for context and " | ||
| "granularity_mode::minimum", | ||
| Context, syclext::granularity_mode::minimum); | ||
|
|
||
| constexpr size_t NumberOfElements = 2; | ||
| std::array<size_t, NumberOfElements> RecommendedGranularities = { | ||
| syclext::get_mem_granularity(Device, Context, | ||
| syclext::granularity_mode::recommended), | ||
| syclext::get_mem_granularity(Context, | ||
| syclext::granularity_mode::recommended)}; | ||
|
|
||
| std::array<size_t, NumberOfElements> MinimumGranularities = { | ||
| syclext::get_mem_granularity(Device, Context, | ||
| syclext::granularity_mode::minimum), | ||
| syclext::get_mem_granularity(Context, | ||
| syclext::granularity_mode::minimum)}; | ||
dyniols marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| std::array<std::string_view, NumberOfElements> TestNames = { | ||
| "Failed check: granularity_mode::recommended size must be at least " | ||
| "granularity_mode::minimum for device", | ||
| "Failed check: granularity_mode::recommended size must be at least " | ||
| "granularity_mode::minimum for context"}; | ||
|
|
||
| for (size_t Index = 0; Index < NumberOfElements; ++Index) { | ||
| if (RecommendedGranularities[Index] < MinimumGranularities[Index]) { | ||
| std::cout << TestNames[Index] << std::endl; | ||
| ++Failed; | ||
| } | ||
| } | ||
| return Failed; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.