Skip to content

[SYCL][DOC] Initial Draft of Extension for querying free device memory on Level Zero #3468

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 26, 2021
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
45 changes: 45 additions & 0 deletions sycl/doc/extensions/LevelZeroBackend/LevelZeroBackend.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,54 @@ Applications must make sure that the Level-Zero handles themselves aren't used s
Practically speaking, and taking into account that SYCL runtime takes ownership of the Level-Zero handles,
the application should not attempt further direct use of those handles.

## 5 Level-Zero additional functionality

### 5.1 Device Information Descriptors
The Level Zero backend provides the following device information descriptors
that an application can use to query information about a Level Zero device.
Applications use these queries via the `device::get_backend_info<>()` member
function as shown in the example below (which illustrates the `free_memory`
query):

``` C++
sycl::queue Queue;
auto Device = Queue.get_device();

size_t freeMemory =
Device.get_backend_info<sycl::ext::oneapi::level_zero::info::device::free_memory>();
```

New descriptors added as part of this specification are described in the table below and in the subsequent synopsis.

| Descriptor | Description |
| ---------- | ----------- |
| `sycl::ext::oneapi::level_zero::info::device::free_memory` | Returns the number of bytes of free memory for the device. |


``` C++
namespace sycl{
namespace ext {
namespace oneapi{
namespace level_zero {
namespace info {
namespace device {

struct free_memory {
using return_type = size_t;
};

} // namespace device;
} // namespace info
} // namespace level_zero
} // namespace oneapi
} // namespace ext
} // namespace sycl
```

## Revision History
|Rev|Date|Author|Changes|
|-------------|:------------|:------------|:------------|
|1|2021-01-26|Sergey Maslov|Initial public working draft
|2|2021-02-22|Sergey Maslov|Introduced explicit ownership for context
|3|2021-04-13|James Brodman|Free Memory Query