Skip to content

Commit fa428bf

Browse files
authored
[SYCL][DOC] Initial Draft of Extension for querying free device memory on Level Zero (#3468)
Signed-off-by: James Brodman <[email protected]>
1 parent bfef316 commit fa428bf

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

sycl/doc/extensions/LevelZeroBackend/LevelZeroBackend.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,54 @@ Applications must make sure that the Level-Zero handles themselves aren't used s
139139
Practically speaking, and taking into account that SYCL runtime takes ownership of the Level-Zero handles,
140140
the application should not attempt further direct use of those handles.
141141

142+
## 5 Level-Zero additional functionality
143+
144+
### 5.1 Device Information Descriptors
145+
The Level Zero backend provides the following device information descriptors
146+
that an application can use to query information about a Level Zero device.
147+
Applications use these queries via the `device::get_backend_info<>()` member
148+
function as shown in the example below (which illustrates the `free_memory`
149+
query):
150+
151+
``` C++
152+
sycl::queue Queue;
153+
auto Device = Queue.get_device();
154+
155+
size_t freeMemory =
156+
Device.get_backend_info<sycl::ext::oneapi::level_zero::info::device::free_memory>();
157+
```
158+
159+
New descriptors added as part of this specification are described in the table below and in the subsequent synopsis.
160+
161+
| Descriptor | Description |
162+
| ---------- | ----------- |
163+
| `sycl::ext::oneapi::level_zero::info::device::free_memory` | Returns the number of bytes of free memory for the device. |
164+
165+
166+
``` C++
167+
namespace sycl{
168+
namespace ext {
169+
namespace oneapi{
170+
namespace level_zero {
171+
namespace info {
172+
namespace device {
173+
174+
struct free_memory {
175+
using return_type = size_t;
176+
};
177+
178+
} // namespace device;
179+
} // namespace info
180+
} // namespace level_zero
181+
} // namespace oneapi
182+
} // namespace ext
183+
} // namespace sycl
184+
```
185+
142186
## Revision History
143187
|Rev|Date|Author|Changes|
144188
|-------------|:------------|:------------|:------------|
145189
|1|2021-01-26|Sergey Maslov|Initial public working draft
146190
|2|2021-02-22|Sergey Maslov|Introduced explicit ownership for context
191+
|3|2021-04-13|James Brodman|Free Memory Query
147192

0 commit comments

Comments
 (0)