Skip to content

Commit 1ae0565

Browse files
Update Adapters/level_zero/usm_device_read_only.cpp
1 parent 8c1c2ac commit 1ae0565

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

sycl/test-e2e/Adapters/level_zero/usm_device_read_only.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
#include <sycl/ext/oneapi/experimental/annotated_usm/alloc_shared.hpp>
1010

11+
#include <sycl/usm/usm_allocator.hpp>
12+
1113
using namespace std;
1214
using namespace sycl;
1315

@@ -24,7 +26,22 @@ int main(int argc, char *argv[]) {
2426
// CHECK: ---> urUSMSharedAlloc
2527
// CHECK-NOT: zeMemAllocShared
2628

27-
free(ptr1, Q);
29+
sycl::usm_allocator<int, sycl::usm::alloc::shared> allocator_no_prop{Q};
30+
31+
auto ptr3 = allocator_no_prop.allocate(1);
32+
// CHECK: ---> urUSMSharedAlloc
33+
// CHECK: zeMemAllocShared
34+
35+
sycl::usm_allocator<int, sycl::usm::alloc::shared> allocator_prop{
36+
Q, {sycl::ext::oneapi::property::usm::device_read_only{}}};
37+
38+
auto ptr4 = allocator_prop.allocate(1);
39+
// CHECK: ---> urUSMSharedAlloc
40+
// CHECK-NOT: zeMemAllocShared
41+
42+
allocator_prop.deallocate(ptr4, 1);
43+
allocator_no_prop.deallocate(ptr3, 1);
2844
free(ptr2, Q);
45+
free(ptr1, Q);
2946
return 0;
3047
}

0 commit comments

Comments
 (0)