Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit e2ecc95

Browse files
[SYCL][Level Zero][USM] Add a test for read-only shared alloc (#1409)
1 parent 252525f commit e2ecc95

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

SYCL/USM/shared_read_only.cpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// REQUIRES: level_zero
2+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
3+
// RUN: env ZE_DEBUG=1 %GPU_RUN_PLACEHOLDER %t.out 2> %t1.out; cat %t1.out %GPU_CHECK_PLACEHOLDER
4+
5+
#include <sycl/sycl.hpp>
6+
7+
int main() {
8+
sycl::queue q;
9+
auto *p1 = sycl::malloc_shared<float>(
10+
42, q, {sycl::ext::oneapi::property::usm::device_read_only()});
11+
auto *p2 = sycl::malloc_shared<float>(42, q);
12+
13+
// CHECK: zeMemAllocShared
14+
// CHECK: {{zeCommandListAppendMemAdvise.*ZE_MEMORY_ADVICE_SET_READ_MOSTLY}}
15+
// CHECK: {{zeCommandListAppendMemAdvise.*ZE_MEMORY_ADVICE_SET_PREFERRED_LOCATION*}}
16+
// CHECK: zeMemAllocShared
17+
// CHECK-NOT: MemAdvise
18+
19+
free(p2, q);
20+
free(p1, q);
21+
return 0;
22+
}

0 commit comments

Comments
 (0)