DPC++ Runtime
Runtime libraries for oneAPI DPC++
virtual_mem.hpp
Go to the documentation of this file.
1 //==- virtual_mem.hpp - sycl_ext_oneapi_virtual_mem virtual mem free funcs -==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #pragma once
10 
11 #include <sycl/access/access.hpp>
12 #include <sycl/context.hpp>
13 #include <sycl/detail/common.hpp>
14 #include <sycl/device.hpp>
16 #include <sycl/queue.hpp>
17 
18 #include <optional>
19 
20 namespace sycl {
21 inline namespace _V1 {
22 namespace ext::oneapi::experimental {
23 
24 enum class granularity_mode : char {
25  minimum = 0,
26  recommended = 1,
27 };
28 
29 __SYCL_EXPORT size_t
30 get_mem_granularity(const device &SyclDevice, const context &SyclContext,
32 
33 __SYCL_EXPORT size_t
34 get_mem_granularity(const context &SyclContext,
36 
37 __SYCL_EXPORT uintptr_t reserve_virtual_mem(uintptr_t Start, size_t NumBytes,
38  const context &SyclContext);
39 
40 inline uintptr_t reserve_virtual_mem(size_t NumBytes,
41  const context &SyclContext) {
42  return reserve_virtual_mem(0, NumBytes, SyclContext);
43 }
44 
45 __SYCL_EXPORT void free_virtual_mem(uintptr_t Ptr, size_t NumBytes,
46  const context &SyclContext);
47 
48 __SYCL_EXPORT void set_access_mode(const void *Ptr, size_t NumBytes,
50  const context &SyclContext);
51 
52 __SYCL_EXPORT address_access_mode get_access_mode(const void *Ptr,
53  size_t NumBytes,
54  const context &SyclContext);
55 
56 __SYCL_EXPORT void unmap(const void *Ptr, size_t NumBytes,
57  const context &SyclContext);
58 
59 } // Namespace ext::oneapi::experimental
60 } // namespace _V1
61 } // Namespace sycl
The context class represents a SYCL context on which kernel functions may be executed.
Definition: context.hpp:50
The SYCL device class encapsulates a single SYCL device on which kernels may be executed.
Definition: device.hpp:64
size_t get_mem_granularity(const device &SyclDevice, const context &SyclContext, granularity_mode Mode=granularity_mode::recommended)
Definition: virtual_mem.cpp:25
void unmap(const void *Ptr, size_t NumBytes, const context &SyclContext)
void set_access_mode(const void *Ptr, size_t NumBytes, address_access_mode Mode, const context &SyclContext)
address_access_mode get_access_mode(const void *Ptr, size_t NumBytes, const context &SyclContext)
void free_virtual_mem(uintptr_t Ptr, size_t NumBytes, const context &SyclContext)
uintptr_t reserve_virtual_mem(uintptr_t Start, size_t NumBytes, const context &SyclContext)
Definition: access.hpp:18