14 inline namespace _V1 {
18 void *Addr,
size_t Size,
19 int32_t Flags, int32_t Reserved)
20 : KernelName{new char[Name.
length() + 1]}, Address{Addr}, EntrySize{Size},
21 EntryFlags{Flags}, EntryReserved{Reserved} {
22 std::memcpy(KernelName.get(), Name.c_str(), Name.length() + 1);
27 EntryFlags, EntryReserved};
31 size_t Size, uint32_t Type)
32 : PropName{new char[Name.
length() + 1]}, Value{new unsigned char[Size]},
33 ValueSize{Size}, PropType{Type} {
34 std::memcpy(PropName.get(), Name.c_str(), Name.length() + 1);
35 std::memcpy(Value.get(), Data, Size);
39 : PropName{new char[Name.
length() + 1]}, Value{}, ValueSize{Data},
41 std::memcpy(PropName.get(), Name.c_str(), Name.length() + 1);
50 : SetName{new char[Name.
length() + 1]} {
51 std::memcpy(SetName.get(), Name.c_str(), Name.length() + 1);
59 assert(Fused &&
"Adding to container would invalidate existing PI structs");
60 PIProperties.push_back(Prop.getPIProperty());
61 Properties.push_back(std::move(Prop));
67 const_cast<char *
>(SetName.get()), PIProperties.data(),
68 PIProperties.data() + Properties.size()};
76 assert(Fused &&
"Adding to container would invalidate existing PI structs");
77 PIOffloadEntries.push_back(Cont.getPIOffloadEntry());
78 OffloadEntries.push_back(std::move(Cont));
86 assert(Fused &&
"Adding to container would invalidate existing PI structs");
87 PIPropertySets.push_back(Cont.getPIPropertySet());
88 PropertySets.push_back(std::move(Cont));
92 const unsigned char *BinaryStart,
size_t BinarySize,
const char *TargetSpec,
97 DeviceBinary.
Format = Format;
105 DeviceBinary.
BinaryEnd = BinaryStart + BinarySize;
108 DeviceBinary.
EntriesEnd = PIOffloadEntries.data() + PIOffloadEntries.size();
110 DeviceBinary.
PropertySetsEnd = PIPropertySets.data() + PIPropertySets.size();
116 const unsigned char *BinaryStart,
118 const char *TargetSpec,
124 assert(Fused &&
"Adding to container would invalidate existing PI structs");
125 PIBinaries.push_back(
126 Cont.getPIDeviceBinary(BinaryStart, BinarySize, TargetSpec, Format));
127 Binaries.push_back(std::move(Cont));
132 PIStruct = std::make_unique<pi_device_binaries_struct>();
134 PIStruct->NumDeviceBinaries = PIBinaries.size();
135 PIStruct->DeviceBinaries = PIBinaries.data();
138 PIStruct->HostEntriesBegin =
nullptr;
139 PIStruct->HostEntriesEnd =
nullptr;
141 return PIStruct.get();
void addDeviceBinary(DeviceBinaryContainer &&Cont, const unsigned char *BinaryStart, size_t BinarySize, const char *TargetSpec, pi_device_binary_type Format)
pi_device_binaries getPIDeviceStruct()
Representation of pi_device_binary_struct for creation of JIT device binaries at runtime.
void addOffloadEntry(OffloadEntryContainer &&Cont)
pi_device_binary_struct getPIDeviceBinary(const unsigned char *BinaryStart, size_t BinarySize, const char *TargetSpec, pi_device_binary_type Format)
void addProperty(PropertySetContainer &&Cont)
Representation of _pi_offload_entry for creation of JIT device binaries at runtime.
_pi_offload_entry_struct getPIOffloadEntry()
OffloadEntryContainer(const std::string &Name, void *Addr, size_t Size, int32_t Flags, int32_t Reserved)
Representation of _pi_device_binary_property_struct for creation of JIT device binaries at runtime.
_pi_device_binary_property_struct getPIProperty()
PropertyContainer(const std::string &Name, void *Data, size_t Size, uint32_t Type)
Representation of _pi_device_binary_property_set_struct for creation of JIT device binaries at runtim...
void addProperty(PropertyContainer &&Prop)
_pi_device_binary_property_set_struct getPIPropertySet()
PropertySetContainer(const std::string &Name)
ValueT length(const ValueT *a, const int len)
Calculate the square root of the input array.
@ PI_PROPERTY_TYPE_UINT32
uint8_t pi_device_binary_type
Types of device binary.
static const uint16_t PI_DEVICE_BINARY_VERSION
static const uint8_t PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL
static const uint16_t PI_DEVICE_BINARIES_VERSION
This struct is a record of all the device code that may be offloaded.
This struct is a record of the device binary information.
_pi_offload_entry EntriesEnd
const char * LinkOptions
a null-terminated string; target- and compiler-specific options which are suggested to use to "link" ...
_pi_offload_entry EntriesBegin
the offload entry table
const char * CompileOptions
a null-terminated string; target- and compiler-specific options which are suggested to use to "compil...
const unsigned char * BinaryEnd
Pointer to the target code end.
const char * ManifestStart
Pointer to the manifest data start.
uint16_t Version
version of this structure - for backward compatibility; all modifications which change order/type/off...
const char * DeviceTargetSpec
null-terminated string representation of the device's target architecture which holds one of: __SYCL_...
pi_device_binary_property_set PropertySetsEnd
pi_device_binary_property_set PropertySetsBegin
uint8_t Format
format of the binary data - SPIR-V, LLVM IR bitcode,...
const char * ManifestEnd
Pointer to the manifest data end.
uint8_t Kind
the type of offload model the binary employs; must be 4 for SYCL
const unsigned char * BinaryStart
Pointer to the target code start.