DPC++ Runtime
Runtime libraries for oneAPI DPC++
|
|
Go to the documentation of this file.
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);
69 ByteArray DeviceBinaryProperty::asByteArray()
const {
71 assert(Prop->ValSize > 0 &&
"property size mismatch");
72 const auto *Data = pi::cast<const std::uint8_t *>(Prop->ValAddr);
73 return {Data, Prop->ValSize};
76 const char *DeviceBinaryProperty::asCString()
const {
78 assert(Prop->ValSize > 0 &&
"property size mismatch");
79 return pi::cast<const char *>(Prop->ValAddr);
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;
101 std::cerr <<
" --- Image " << Bin <<
"\n";
104 std::cerr <<
" Version : " << (int)Bin->Version <<
"\n";
105 std::cerr <<
" Kind : " << (
int)Bin->Kind <<
"\n";
106 std::cerr <<
" Format : " << (int)Bin->Format <<
"\n";
107 std::cerr <<
" Target : " << Bin->DeviceTargetSpec <<
"\n";
109 << ((intptr_t)Bin->BinaryEnd - (intptr_t)Bin->BinaryStart) <<
"\n";
110 std::cerr <<
" OSModuleHandle : " << ModuleHandle <<
"\n";
112 << (Bin->CompileOptions ? Bin->CompileOptions :
"NULL") <<
"\n";
114 << (Bin->LinkOptions ? Bin->LinkOptions :
"NULL") <<
"\n";
117 EntriesIt != Bin->EntriesEnd; ++EntriesIt)
120 std::cerr <<
" Properties [" << Bin->PropertySetsBegin <<
"-"
121 << Bin->PropertySetsEnd <<
"]:\n";
124 PS != Bin->PropertySetsEnd; ++PS) {
135 void RTDeviceBinaryImage::dump(std::ostream &Out)
const {
136 size_t ImgSize = getSize();
137 Out.write(
reinterpret_cast<const char *
>(Bin->
BinaryStart), ImgSize);
141 RTDeviceBinaryImage::getProperty(
const char *PropName)
const {
146 auto It = std::find_if(BoolProp.
begin(), BoolProp.
end(),
148 return !strcmp(PropName, Prop->Name);
150 if (It == BoolProp.
end())
170 SpecConstDefaultValuesMap.init(
181 DynRTDeviceBinaryImage::DynRTDeviceBinaryImage(
182 std::unique_ptr<
char[]> &&DataPtr,
size_t DataSize,
OSModuleHandle M)
184 Data = std::move(DataPtr);
static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_NONE
#define __SYCL_PI_PROPERTY_SET_SPEC_CONST_DEFAULT_VALUES_MAP
PropertySetRegistry::SYCL_SPEC_CONSTANTS_DEFAULT_VALUES defined in PropertySetIO.h.
::pi_device_binary_type PiDeviceBinaryType
static const uint16_t PI_DEVICE_BINARY_VERSION
static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_SPIRV
#define __SYCL_PI_DEVICE_BINARY_TARGET_UNKNOWN
Target identification strings for pi_device_binary_struct.DeviceTargetSpec.
const char * DeviceTargetSpec
null-terminated string representation of the device's target architecture which holds one of: __SYCL_...
void init(pi_device_binary Bin)
@ PI_PROPERTY_TYPE_STRING
#define __SYCL_INLINE_VER_NAMESPACE(X)
const _pi_device_binary_property_struct * Prop
~DynRTDeviceBinaryImage() override
pi_device_binary_property_set PropertySetsEnd
const unsigned char * BinaryStart
Pointer to the target code start.
const char * ManifestStart
Pointer to the manifest data start.
ByteArray asByteArray() const
#define __SYCL_PI_PROPERTY_SET_KERNEL_PARAM_OPT_INFO
PropertySetRegistry::SYCL_KERNEL_PARAM_OPT_INFO defined in PropertySetIO.h.
const unsigned char * BinaryEnd
Pointer to the target code end.
---— Error handling, matching OpenCL plugin semantics.
pi_uint32 asUint32() const
pi_device_binary_property PropertiesBegin
const char * asCString() const
static const uint8_t PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL
ConstIterator end() const
This struct is a record of the device binary information.
const char * LinkOptions
a null-terminated string; target- and compiler-specific options which are suggested to use to "link" ...
PiDeviceBinaryType getBinaryImageFormat(const unsigned char *ImgData, size_t ImgSize)
Tries to determine the device binary image foramat.
#define __SYCL_PI_PROPERTY_SET_DEVICELIB_REQ_MASK
PropertySetRegistry::SYCL_DEVICELIB_REQ_MASK defined in PropertySetIO.h.
uint8_t Format
format of the binary data - SPIR-V, LLVM IR bitcode,...
@ PI_PROPERTY_TYPE_BYTE_ARRAY
#define __SYCL_PI_PROPERTY_SET_SYCL_MISC_PROP
PropertySetRegistry::SYCL_MISC_PROP defined in PropertySetIO.h.
uint8_t Kind
the type of offload model the binary employs; must be 4 for SYCL
__SYCL_EXTERN_STREAM_ATTRS ostream cerr
Linked to standard error (unbuffered)
std::enable_if<!std::is_pointer< T >::value, void >::type print(T val)
intptr_t OSModuleHandle
Uniquely identifies an operating system module (executable or a dynamic library)
const char * CompileOptions
a null-terminated string; target- and compiler-specific options which are suggested to use to "compil...
@ PI_PROPERTY_TYPE_UINT32
#define __SYCL_PI_PROPERTY_SET_SYCL_ASSERT_USED
PropertySetRegistry::SYCL_ASSERT_USED defined in PropertySetIO.h.
ConstIterator begin() const
uint16_t Version
version of this structure - for backward compatibility; all modifications which change order/type/off...
#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.
#define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64
SPIR-V 64-bit image <-> "spir64", 64-bit OpenCL device.
pi_device_binary_property PropertiesEnd
#define __SYCL_PI_PROPERTY_SET_SYCL_DEVICE_GLOBALS
PropertySetRegistry::SYCL_DEVICE_GLOBALS defined in PropertySetIO.h.
_pi_offload_entry EntriesEnd
#define __SYCL_PI_PROPERTY_SET_SPEC_CONST_MAP
Device binary image property set names recognized by the SYCL runtime.
const char * ManifestEnd
Pointer to the manifest data end.
std::ostream & operator<<(std::ostream &Out, const DeviceBinaryProperty &P)
std::unique_ptr< char[]> Data
#define __SYCL_PI_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS
PropertySetRegistry::SYCL_DEVICE_REQUIREMENTS defined in PropertySetIO.h.
pi_device_binary_property_set PropertySetsBegin
_pi_offload_entry EntriesBegin
the offload entry table