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

Commit d6e43f6

Browse files
[SYCL] Support query of free device memory extension (#1162)
1 parent 2eb7ff3 commit d6e43f6

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: env ZES_ENABLE_SYSMAN=1 %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
7+
// backend
8+
//
9+
// CHECK: Free device memory
10+
11+
#include <iostream>
12+
#include <sycl/sycl.hpp>
13+
using namespace sycl;
14+
15+
int main() {
16+
17+
queue Queue;
18+
auto dev = Queue.get_device();
19+
std::cout << "Device: " << dev.get_info<info::device::name>() << std::endl;
20+
21+
if (!dev.is_host() && dev.has(aspect::ext_intel_free_memory)) {
22+
auto FreeMemory = dev.get_info<info::device::ext_intel_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)