19 inline namespace _V1 {
27 ByteArray(
const std::uint8_t *Ptr, std::size_t Size) : Ptr{Ptr}, Size{Size} {}
28 const std::uint8_t &
operator[](std::size_t Idx)
const {
return Ptr[Idx]; }
29 std::size_t
size()
const {
return Size; }
33 template <
typename... Ts>
auto consume() {
34 if constexpr (
sizeof...(Ts) == 1)
35 return consumeOneElem<Ts...>();
37 return std::tuple{consumeOneElem<Ts>()...};
41 assert(Bytes <= Size &&
"Not enough bytes left!");
48 bool empty()
const {
return Size == 0; }
51 template <
typename T> T consumeOneElem() {
52 assert(
sizeof(T) <= Size &&
"Out of bounds!");
54 std::memcpy(&Val, Ptr,
sizeof(T));
59 const std::uint8_t *Ptr;
74 friend std::ostream &
operator<<(std::ostream &Out,
88 using ValTy = std::remove_pointer<pi_device_binary_property>::type;
127 init(
Bin, PropSetName);
153 virtual void print()
const;
154 virtual void dump(std::ostream &Out)
const;
157 assert(
Bin &&
"binary image data not set");
162 assert(
Bin &&
"binary image data not set");
167 assert(
Bin &&
"binary image data not set");
173 assert(
Bin &&
"binary image data not set");
222 assert(
Bin &&
"Image ID is not available without a binary image.");
245 static std::atomic<uintptr_t> ImageCounter;
246 uintptr_t ImageId = 0;
ConstIterator begin() const
const std::uint8_t & operator[](std::size_t Idx) const
const std::uint8_t * ConstIterator
void dropBytes(std::size_t Bytes)
ConstIterator end() const
ByteArray(const std::uint8_t *Ptr, std::size_t Size)
ByteArray asByteArray() const
const char * asCString() const
friend std::ostream & operator<<(std::ostream &Out, const DeviceBinaryProperty &P)
DeviceBinaryProperty(const _pi_device_binary_property_struct *Prop)
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)
void print() const override
ConstIterator(pi_device_binary_property Cur=nullptr)
std::input_iterator_tag iterator_category
ConstIterator operator++(int)
bool operator==(ConstIterator Other) const
bool operator!=(ConstIterator Other) const
ConstIterator & operator++()
reference operator*() const
ptrdiff_t difference_type
ConstIterator end() const
std::remove_pointer< pi_device_binary_property >::type ValTy
ConstIterator begin() const
pi::PiDeviceBinaryType Format
RTDeviceBinaryImage & operator=(const RTDeviceBinaryImage &)=delete
virtual void dump(std::ostream &Out) const
const pi_device_binary_struct & getRawData() const
pi_device_binary_property getProperty(const char *PropName) const
Returns a single property from SYCL_MISC_PROP category.
RTDeviceBinaryImage::PropertyRange ProgramMetadata
RTDeviceBinaryImage(RTDeviceBinaryImage &&)=default
RTDeviceBinaryImage::PropertyRange SpecConstIDMap
RTDeviceBinaryImage(const RTDeviceBinaryImage &)=delete
RTDeviceBinaryImage::PropertyRange DeviceLibReqMask
const PropertyRange & getHostPipes() const
const PropertyRange & getSpecConstants() const
Gets the iterator range over specialization constants in this binary image.
const char * getLinkOptions() const
RTDeviceBinaryImage(pi_device_binary Bin)
RTDeviceBinaryImage::PropertyRange AssertUsed
RTDeviceBinaryImage & operator=(RTDeviceBinaryImage &&)=default
const PropertyRange & getSpecConstantsDefaultValues() const
RTDeviceBinaryImage::PropertyRange KernelParamOptInfo
const PropertyRange & getAssertUsed() const
const PropertyRange & getProgramMetadata() const
std::uintptr_t getImageID() const
bool supportsSpecConstants() const
const PropertyRange & getExportedSymbols() const
RTDeviceBinaryImage::PropertyRange DeviceGlobals
void init(pi_device_binary Bin)
virtual ~RTDeviceBinaryImage()
const PropertyRange & getDeviceGlobals() const
const PropertyRange & getDeviceRequirements() const
const char * getCompileOptions() const
virtual void print() const
RTDeviceBinaryImage::PropertyRange ExportedSymbols
pi_device_binary get() const
const PropertyRange & getKernelParamOptInfo() const
const PropertyRange & getDeviceLibReqMask() const
RTDeviceBinaryImage::PropertyRange SpecConstDefaultValuesMap
RTDeviceBinaryImage::PropertyRange DeviceRequirements
pi::PiDeviceBinaryType getFormat() const
Returns the format of the binary image.
RTDeviceBinaryImage::PropertyRange HostPipes
__SYCL_EXTERN_STREAM_ATTRS ostream cerr
Linked to standard error (unbuffered)
::pi_device_binary_type PiDeviceBinaryType
std::ostream & operator<<(std::ostream &os, std::optional< T > const &opt)
static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_SPIRV
_pi_device_binary_property_struct * pi_device_binary_property
static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_NONE
C++ wrapper of extern "C" PI interfaces.
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" ...
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 unsigned char * BinaryStart
Pointer to the target code start.