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

[SYCL][L0] check USM capabilities #794

Merged
merged 2 commits into from
Feb 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions SYCL/Plugin/level-zero-usm-capabilities.cpp
Original file line number Diff line number Diff line change
@@ -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 <CL/sycl.hpp>
#include <iostream>

// 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<info::device::name>() << 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;
}