-
Notifications
You must be signed in to change notification settings - Fork 795
[SYCL] Add property validation to sycl object ctors #15253
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
sergey-semenov
merged 29 commits into
intel:sycl
from
KseniyaTikhomirova:defbased_property
Oct 10, 2024
Merged
Changes from 2 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
91f0ce6
Add def based check for queue
KseniyaTikhomirova ae0b1d4
add test for queue
KseniyaTikhomirova 6e673ac
fix code-review comments
KseniyaTikhomirova 34d65d9
fix format
KseniyaTikhomirova 05b7398
add check to buffer & image
KseniyaTikhomirova 10bd181
fix format
KseniyaTikhomirova 87a1691
fix build & format
KseniyaTikhomirova f3b6e39
add check to context
KseniyaTikhomirova db53824
add test for context
KseniyaTikhomirova c5a4eff
fix build
KseniyaTikhomirova d88c3f2
add check to sampler
KseniyaTikhomirova d83f367
add test for sampler
KseniyaTikhomirova 8edf0c1
add check to stream
KseniyaTikhomirova a9c8c39
add test for stream
KseniyaTikhomirova 0587a71
update tests
KseniyaTikhomirova f02ca36
add check to reduction
KseniyaTikhomirova 72fc90d
add test for reduction
KseniyaTikhomirova 4e5f586
add check to usm_allocator
KseniyaTikhomirova 2d99591
add test for usm_allocator
KseniyaTikhomirova 0973de0
update linux symbols
KseniyaTikhomirova e76b4ae
fix stream test
KseniyaTikhomirova 4f25430
fix format
KseniyaTikhomirova 80acde2
add check to accessor
KseniyaTikhomirova 05cf71d
add test for sampled/unsampled_image
KseniyaTikhomirova 24120ff
Merge branch 'sycl' into defbased_property
KseniyaTikhomirova f16372f
fix tests
KseniyaTikhomirova 6fa9b2b
add a few accessor tests
KseniyaTikhomirova 95ea264
Merge branch 'sycl' into defbased_property
KseniyaTikhomirova e44a496
fix win build
KseniyaTikhomirova 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
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
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
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
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
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 |
|---|---|---|
|
|
@@ -8,4 +8,5 @@ add_sycl_unittest(QueueTests OBJECT | |
| ShortcutFunctions.cpp | ||
| InOrderQueue.cpp | ||
| InteropRetain.cpp | ||
| Properties.cpp | ||
| ) | ||
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,90 @@ | ||
| //==-------- Properties.cpp --- check properties handling in RT --- --------==// | ||
| // | ||
| // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
| // See https://llvm.org/LICENSE.txt for license information. | ||
| // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
| // | ||
| //===----------------------------------------------------------------------===// | ||
|
|
||
| #include <gtest/gtest.h> | ||
| #include <helpers/UrMock.hpp> | ||
| #include <sycl/properties/queue_properties.hpp> | ||
| #include <sycl/sycl.hpp> | ||
|
|
||
| template <typename PropertyType> void DatalessQueuePropertyCheck() { | ||
| try { | ||
| sycl::queue Queue{PropertyType{}}; | ||
| ASSERT_TRUE(Queue.has_property<PropertyType>()); | ||
| Queue.get_property<PropertyType>(); | ||
| // no explicit checks, we expect no exception to be thrown | ||
| } catch (...) { | ||
| FAIL(); | ||
| } | ||
| } | ||
|
|
||
| TEST(QueueProperties, ValidDatalessProperties) { | ||
| sycl::unittest::UrMock<> Mock; | ||
| DatalessQueuePropertyCheck<sycl::property::queue::in_order>(); | ||
| DatalessQueuePropertyCheck<sycl::property::queue::enable_profiling>(); | ||
| DatalessQueuePropertyCheck< | ||
| sycl::ext::oneapi::property::queue::discard_events>(); | ||
| DatalessQueuePropertyCheck< | ||
| sycl::ext::oneapi::property::queue::priority_normal>(); | ||
| DatalessQueuePropertyCheck< | ||
| sycl::ext::oneapi::property::queue::priority_low>(); | ||
| DatalessQueuePropertyCheck< | ||
| sycl::ext::oneapi::property::queue::priority_high>(); | ||
| DatalessQueuePropertyCheck< | ||
| sycl::ext::intel::property::queue::no_immediate_command_list>(); | ||
| DatalessQueuePropertyCheck< | ||
| sycl::ext::intel::property::queue::immediate_command_list>(); | ||
| DatalessQueuePropertyCheck< | ||
| sycl::ext::oneapi::cuda::property::queue::use_default_stream>(); | ||
| } | ||
|
|
||
| inline ur_result_t urDeviceGetInfoRedefined(void *pParams) { | ||
| auto params = reinterpret_cast<ur_device_get_info_params_t *>(pParams); | ||
| switch (*params->ppropName) { | ||
| case UR_DEVICE_INFO_MAX_COMPUTE_QUEUE_INDICES: { | ||
| if (*params->ppPropValue) | ||
| *static_cast<int32_t *>(*params->ppPropValue) = 8; | ||
| if (*params->ppPropSizeRet) | ||
| **params->ppPropSizeRet = sizeof(int32_t); | ||
| return UR_RESULT_SUCCESS; | ||
| } | ||
| default: | ||
| return UR_RESULT_SUCCESS; | ||
| } | ||
| } | ||
|
|
||
| TEST(QueueProperties, ValidPropertyComputeIndex) { | ||
| sycl::unittest::UrMock<> Mock; | ||
| mock::getCallbacks().set_after_callback("urDeviceGetInfo", | ||
| &urDeviceGetInfoRedefined); | ||
| try { | ||
| sycl::queue Queue{sycl::ext::intel::property::queue::compute_index{1}}; | ||
| ASSERT_TRUE( | ||
| Queue.has_property<sycl::ext::intel::property::queue::compute_index>()); | ||
| EXPECT_EQ( | ||
| Queue.get_property<sycl::ext::intel::property::queue::compute_index>() | ||
| .get_index(), | ||
| 1); | ||
| // no explicit checks, we expect no exception to be thrown | ||
| } catch (...) { | ||
| FAIL(); | ||
| } | ||
| } | ||
|
|
||
| TEST(QueueProperties, SetUnsupportedParam) { | ||
| sycl::unittest::UrMock<> Mock; | ||
| try { | ||
| sycl::queue Queue{sycl::property::image::use_host_ptr{}}; | ||
| } catch (sycl::exception &e) { | ||
| EXPECT_EQ(e.code(), sycl::errc::invalid); | ||
| EXPECT_STREQ(e.what(), "The property list contains property unsupported " | ||
| "for the current object"); | ||
| return; | ||
| } | ||
|
|
||
| FAIL() << "Test must exit in exception handler. Exception is not thrown."; | ||
| } |
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.