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

Commit ba55439

Browse files
committed
[SYCL] Support query of free device memory extension
Signed-off-by: Sergey V Maslov <[email protected]>
1 parent f977ac0 commit ba55439

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// REQUIRES: level_zero, level_zero_dev_kit
2+
3+
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %level_zero_options %s -o %t.out
4+
// RUN: %GPU_RUN_PLACEHOLDER %t.out 2>&1 %GPU_CHECK_PLACEHOLDER
5+
//
6+
// The test is to check that the free device memory is reported be Level Zero backend
7+
//
8+
// CHECK: Free device memory
9+
10+
#include <iostream>
11+
#include <sycl/sycl.hpp>
12+
using namespace sycl;
13+
14+
int main() {
15+
16+
queue Queue;
17+
auto dev = Queue.get_device();
18+
std::cout << "Device: " << dev.get_info<info::device::name>() << std::endl;
19+
20+
if (!dev.is_host() && dev.has(aspect::ext_intel_device_info_free_memory)) {
21+
auto FreeMemory =
22+
dev.get_info<info::device::ext_intel_device_info_free_memory>();
23+
std::cout << "Free device memory: " << FreeMemory << std::endl;
24+
} else {
25+
std::cout
26+
<< "Query ext_intel_device_info_free_memory not supported by the device"
27+
<< std::endl;
28+
}
29+
30+
return 0;
31+
}

0 commit comments

Comments
 (0)