-
Notifications
You must be signed in to change notification settings - Fork 788
[SYCL] Fix malloc shared by throwing when usm_shared_allocations not supported #12700
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
Conversation
Can you provide an explanation as to why these syclcompat tests are being skipped? |
Here's what i propose, instead of skipping them with REQUIRES I could substitute malloc_shared with malloc_device instead which is supported by all devices that we run tests on. Going forward, people should just be mindful to avoid using malloc_shared to allocate memory unless they're prepared to handle exceptions that could be thrown from the call. Instead they can use buffers/accessors or use malloc_device. |
Yes, that is perfectly reasonable. For the diff --git a/sycl/test-e2e/syclcompat/util/util_find_first_set.cpp b/sycl/test-e2e/syclcompat/util/util_find_first_set.cpp
index c350049ff1d7..308da571cc29 100644
--- a/sycl/test-e2e/syclcompat/util/util_find_first_set.cpp
+++ b/sycl/test-e2e/syclcompat/util/util_find_first_set.cpp
@@ -104,14 +104,16 @@ void test_find_first_set() {
sycl::queue q_ct1 = *dev_ct1.default_queue();
int *test_result, host_test_result = 0;
- test_result = sycl::malloc_shared<int>(sizeof(int), q_ct1);
+ test_result = sycl::malloc_device<int>(1, q_ct1);
*test_result = 0;
+ int h_test_result;
q_ct1.parallel_for(
sycl::nd_range<3>(sycl::range<3>(1, 1, 1), sycl::range<3>(1, 1, 1)),
[=](sycl::nd_item<3> item_ct1) { find_first_set_test(test_result); });
dev_ct1.queues_wait_and_throw();
+ q_ct1.copy(&h_test_result, test_result, sizeof(int)).wait();
find_first_set_test(&host_test_result);
assert(*test_result == 0);
assert(host_test_result == 0); |
Great, I will apply the suggested changes! |
@cperkinsintel ping |
@intel/llvm-gatekeepers ping |
Final PR in the series of #12636.
Refer to it for a description.
After a discussion with @AlexeySachkov we've decided its best to not rewrite USM and syclcompat tests with buffers/accessors. For USM, the reason is obvious and for syclcompat you can reach out to Alexey. Therefore, these tests are handled using if statements or requring aspect to be supported.
Once this PR is merged, the behavior of malloc_shared will be to throw if the usm_shared_allocations is not supported which is conformant with the spec.