From 4c10505efcb506a5b02a9f23c694df5dc11d98ca Mon Sep 17 00:00:00 2001 From: Sergey V Maslov Date: Tue, 1 Feb 2022 08:44:51 -0800 Subject: [PATCH 1/2] [SYCL][L0] check USM capabilities Signed-off-by: Sergey V Maslov --- SYCL/Plugin/level-zero-usm-capabilities.cpp | 37 +++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 SYCL/Plugin/level-zero-usm-capabilities.cpp diff --git a/SYCL/Plugin/level-zero-usm-capabilities.cpp b/SYCL/Plugin/level-zero-usm-capabilities.cpp new file mode 100644 index 0000000000..f96ed0cde3 --- /dev/null +++ b/SYCL/Plugin/level-zero-usm-capabilities.cpp @@ -0,0 +1,37 @@ +// REQUIRES: gpu, level_zero, level_zero_dev_kit +// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out +// RUN: GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER + +#include +#include + +// Check for queries of USM capabilities. +// All supported L0 devices have these capabilities currently: +// +// CHECK: usm_host_allocations: 1 +// CHECK: usm_device_allocations: 1 +// CHECK: usm_shared_allocations: 1 +// CHECK: usm_system_allocations: 0 +// CHECK: usm_atomic_host_allocations: 0 +// CHECK: usm_atomic_shared_allocations: 0 + +using namespace cl::sycl; + +int main() { + auto D = device(gpu_selector()); + std::cout << "name = " << D.get_info() << std::endl; + + std::cout << " usm_host_allocations: " << D.has(aspect::usm_host_allocations) + << std::endl; + std::cout << " usm_device_allocations: " + << D.has(aspect::usm_device_allocations) << std::endl; + std::cout << " usm_shared_allocations: " + << D.has(aspect::usm_shared_allocations) << std::endl; + std::cout << " usm_system_allocations: " + << D.has(aspect::usm_system_allocations) << std::endl; + std::cout << " usm_atomic_host_allocations: " + << D.has(aspect::usm_atomic_host_allocations) << std::endl; + std::cout << " usm_atomic_shared_allocations: " + << D.has(aspect::usm_atomic_shared_allocations) << std::endl; + return 0; +} From bcda46583e2fc62c787e555ffe02c1a5adad7dfc Mon Sep 17 00:00:00 2001 From: Sergey V Maslov Date: Tue, 1 Feb 2022 12:39:52 -0800 Subject: [PATCH 2/2] fix typo Signed-off-by: Sergey V Maslov --- SYCL/Plugin/level-zero-usm-capabilities.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SYCL/Plugin/level-zero-usm-capabilities.cpp b/SYCL/Plugin/level-zero-usm-capabilities.cpp index f96ed0cde3..cab3c3ac48 100644 --- a/SYCL/Plugin/level-zero-usm-capabilities.cpp +++ b/SYCL/Plugin/level-zero-usm-capabilities.cpp @@ -1,6 +1,6 @@ // REQUIRES: gpu, level_zero, level_zero_dev_kit // RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out -// RUN: GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER +// RUN: %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER #include #include