17 inline namespace _V1 {
26 Out <<
"[Byte array] ";
32 assert(
false &&
"unsupported property");
43 std::ios_base::fmtflags FlagsBackup = Out.flags();
45 for (
const auto &Byte : BA) {
46 Out <<
"0x" <<
static_cast<unsigned>(Byte) <<
" ";
48 Out.flags(FlagsBackup);
55 assert(
false &&
"Unsupported property");
64 assert(
Prop->
ValAddr ==
nullptr &&
"primitive types must be stored inline");
65 const auto *P =
reinterpret_cast<const unsigned char *
>(&
Prop->
ValSize);
66 return (*P) | (*(P + 1) << 8) | (*(P + 2) << 16) | (*(P + 3) << 24);
71 assert(
Prop->
ValSize > 0 &&
"property size mismatch");
72 const auto *Data = pi::cast<const std::uint8_t *>(
Prop->
ValAddr);
78 assert(
Prop->
ValSize > 0 &&
"property size mismatch");
83 const char *PropSetName) {
84 assert(!this->Begin && !this->End &&
"already initialized");
88 assert(PS->
Name &&
"nameless property set - bug in the offload wrapper?");
89 if (!strcmp(PropSetName, PS->
Name))
93 Begin = End =
nullptr;
136 Out.write(
reinterpret_cast<const char *
>(
Bin->
BinaryStart), ImgSize);
145 auto It = std::find_if(BoolProp.
begin(), BoolProp.
end(),
147 return !strcmp(PropName, Prop->Name);
149 if (It == BoolProp.
end())
181 ImageId = ImageCounter++;
184 std::atomic<uintptr_t> RTDeviceBinaryImage::ImageCounter = 1;
187 std::unique_ptr<
char[]> &&DataPtr,
size_t DataSize)
189 Data = std::move(DataPtr);
ByteArray asByteArray() const
const char * asCString() const
const _pi_device_binary_property_struct * Prop
pi_uint32 asUint32() const
std::unique_ptr< char[]> Data
~DynRTDeviceBinaryImage() override
DynRTDeviceBinaryImage(std::unique_ptr< char[]> &&DataPtr, size_t DataSize)
ConstIterator end() const
ConstIterator begin() const
pi::PiDeviceBinaryType Format
virtual void dump(std::ostream &Out) const
pi_device_binary_property getProperty(const char *PropName) const
Returns a single property from SYCL_MISC_PROP category.
RTDeviceBinaryImage::PropertyRange ProgramMetadata
RTDeviceBinaryImage::PropertyRange SpecConstIDMap
RTDeviceBinaryImage::PropertyRange DeviceLibReqMask
RTDeviceBinaryImage::PropertyRange AssertUsed
RTDeviceBinaryImage::PropertyRange KernelParamOptInfo
RTDeviceBinaryImage::PropertyRange DeviceGlobals
void init(pi_device_binary Bin)
virtual void print() const
RTDeviceBinaryImage::PropertyRange ExportedSymbols
RTDeviceBinaryImage::PropertyRange SpecConstDefaultValuesMap
RTDeviceBinaryImage::PropertyRange DeviceRequirements
RTDeviceBinaryImage::PropertyRange HostPipes
__SYCL_EXTERN_STREAM_ATTRS ostream cerr
Linked to standard error (unbuffered)
PiDeviceBinaryType getBinaryImageFormat(const unsigned char *ImgData, size_t ImgSize)
Tries to determine the device binary image foramat.
::pi_device_binary_type PiDeviceBinaryType
std::ostream & operator<<(std::ostream &os, std::optional< T > const &opt)
#define __SYCL_PI_PROPERTY_SET_SYCL_DEVICE_GLOBALS
PropertySetRegistry::SYCL_DEVICE_GLOBALS defined in PropertySetIO.h.
#define __SYCL_PI_PROPERTY_SET_SPEC_CONST_DEFAULT_VALUES_MAP
PropertySetRegistry::SYCL_SPEC_CONSTANTS_DEFAULT_VALUES defined in PropertySetIO.h.
#define __SYCL_PI_PROPERTY_SET_DEVICELIB_REQ_MASK
PropertySetRegistry::SYCL_DEVICELIB_REQ_MASK defined in PropertySetIO.h.
#define __SYCL_PI_PROPERTY_SET_KERNEL_PARAM_OPT_INFO
PropertySetRegistry::SYCL_KERNEL_PARAM_OPT_INFO defined in PropertySetIO.h.
@ PI_PROPERTY_TYPE_UINT32
@ PI_PROPERTY_TYPE_BYTE_ARRAY
@ PI_PROPERTY_TYPE_STRING
#define __SYCL_PI_PROPERTY_SET_SYCL_EXPORTED_SYMBOLS
PropertySetRegistry::SYCL_EXPORTED_SYMBOLS defined in PropertySetIO.h.
#define __SYCL_PI_PROPERTY_SET_PROGRAM_METADATA
PropertySetRegistry::SYCL_KERNEL_PROGRAM_METADATA defined in PropertySetIO.h.
static const uint16_t PI_DEVICE_BINARY_VERSION
#define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64
SPIR-V 64-bit image <-> "spir64", 64-bit OpenCL device.
static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_SPIRV
#define __SYCL_PI_PROPERTY_SET_SYCL_HOST_PIPES
PropertySetRegistry::SYCL_HOST_PIPES defined in PropertySetIO.h.
#define __SYCL_PI_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS
PropertySetRegistry::SYCL_DEVICE_REQUIREMENTS defined in PropertySetIO.h.
#define __SYCL_PI_DEVICE_BINARY_TARGET_UNKNOWN
Target identification strings for pi_device_binary_struct.DeviceTargetSpec.
static const uint8_t PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL
#define __SYCL_PI_PROPERTY_SET_SYCL_ASSERT_USED
PropertySetRegistry::SYCL_ASSERT_USED defined in PropertySetIO.h.
#define __SYCL_PI_PROPERTY_SET_SPEC_CONST_MAP
Device binary image property set names recognized by the SYCL runtime.
#define __SYCL_PI_PROPERTY_SET_SYCL_MISC_PROP
PropertySetRegistry::SYCL_MISC_PROP defined in PropertySetIO.h.
static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_NONE
C++ wrapper of extern "C" PI interfaces.
pi_device_binary_property PropertiesBegin
pi_device_binary_property PropertiesEnd
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.