Skip to content

Commit b17879a

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

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

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

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

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

11+
#include <sycl/usm/usm_allocator.hpp>
12+
13+
1114
using namespace std;
1215
using namespace sycl;
1316

@@ -24,7 +27,22 @@ int main(int argc, char *argv[]) {
2427
// CHECK: ---> urUSMSharedAlloc
2528
// CHECK-NOT: zeMemAllocShared
2629

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

0 commit comments

Comments
 (0)