DPC++ Runtime
Runtime libraries for oneAPI DPC++
host_pipe_map_entry.hpp
Go to the documentation of this file.
1 //==----------------- host_pipe_map_entry.hpp --------------------------==//
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 <cstdint>
13 #include <unordered_map>
14 
15 namespace sycl {
16 inline namespace _V1 {
17 namespace detail {
18 
20  std::string MUniqueId;
21  // Pointer to the host_pipe on host.
22  const void *MHostPipePtr;
23  // Size of the underlying type in the host_pipe.
24  std::uint32_t MHostPipeTSize;
25  // The device image that pipe is associated with
27 
28  // Constructor only initializes with the pointer and ID.
29  // Other members will be initialized later
30  HostPipeMapEntry(std::string UniqueId, const void *HostPipePtr)
31  : MUniqueId(UniqueId), MHostPipePtr(HostPipePtr), MHostPipeTSize(0) {}
32 
33  // Constructor only initializes with the size and ID.
34  // Other members will be initialized later
35  HostPipeMapEntry(std::string UniqueId, std::uint32_t HostPipeTSize)
36  : MUniqueId(UniqueId), MHostPipePtr(nullptr),
37  MHostPipeTSize(HostPipeTSize) {}
38 
39  void initialize(std::uint32_t HostPipeTSize) {
40  assert(HostPipeTSize != 0 && "Host pipe initialized with 0 size.");
41  assert(MHostPipeTSize == 0 && "Host pipe has already been initialized.");
42  MHostPipeTSize = HostPipeTSize;
43  }
44 
45  void initialize(const void *HostPipePtr) {
46  assert(!MHostPipePtr && "Host pipe pointer has already been initialized.");
47  MHostPipePtr = HostPipePtr;
48  }
49 
50  void initialize(const RTDeviceBinaryImage *DeviceImage) {
51  mDeviceImage = DeviceImage;
52  }
53 
55  return const_cast<RTDeviceBinaryImage *>(mDeviceImage);
56  }
57 };
58 
59 } // namespace detail
60 } // namespace _V1
61 } // namespace sycl
Definition: access.hpp:18
const RTDeviceBinaryImage * mDeviceImage
void initialize(const RTDeviceBinaryImage *DeviceImage)
HostPipeMapEntry(std::string UniqueId, std::uint32_t HostPipeTSize)
void initialize(std::uint32_t HostPipeTSize)
HostPipeMapEntry(std::string UniqueId, const void *HostPipePtr)
void initialize(const void *HostPipePtr)