24 inline namespace _V1 {
32 ByteArray(
const std::uint8_t *Ptr, std::size_t Size) : Ptr{Ptr}, Size{Size} {}
33 const std::uint8_t &
operator[](std::size_t Idx)
const {
return Ptr[Idx]; }
34 std::size_t
size()
const {
return Size; }
38 template <
typename... Ts>
auto consume() {
39 if constexpr (
sizeof...(Ts) == 1)
40 return consumeOneElem<Ts...>();
42 return std::tuple{consumeOneElem<Ts>()...};
46 assert(Bytes <= Size &&
"Not enough bytes left!");
53 bool empty()
const {
return Size == 0; }
56 template <
typename T> T consumeOneElem() {
57 assert(
sizeof(T) <= Size &&
"Out of bounds!");
59 std::memcpy(&Val, Ptr,
sizeof(T));
64 const std::uint8_t *Ptr;
79 friend std::ostream &
operator<<(std::ostream &Out,
93 using ValTy = std::remove_pointer<sycl_device_binary_property>::type;
132 init(
Bin, PropSetName);
158 virtual void print()
const;
159 virtual void dump(std::ostream &Out)
const;
162 assert(
Bin &&
"binary image data not set");
167 assert(
Bin &&
"binary image data not set");
172 assert(
Bin &&
"binary image data not set");
178 assert(
Bin &&
"binary image data not set");
232 assert(
Bin &&
"Image ID is not available without a binary image.");
259 static std::atomic<uintptr_t> ImageCounter;
260 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
DeviceBinaryProperty(const _sycl_device_binary_property_struct *Prop)
friend std::ostream & operator<<(std::ostream &Out, const DeviceBinaryProperty &P)
uint32_t asUint32() const
const _sycl_device_binary_property_struct * Prop
std::unique_ptr< char[]> Data
~DynRTDeviceBinaryImage() override
DynRTDeviceBinaryImage(std::unique_ptr< char[]> &&DataPtr, size_t DataSize)
void print() const override
std::input_iterator_tag iterator_category
ConstIterator operator++(int)
bool operator==(ConstIterator Other) const
ConstIterator(sycl_device_binary_property Cur=nullptr)
bool operator!=(ConstIterator Other) const
ConstIterator & operator++()
reference operator*() const
ptrdiff_t difference_type
std::remove_pointer< sycl_device_binary_property >::type ValTy
ConstIterator end() const
ConstIterator begin() const
RTDeviceBinaryImage & operator=(const RTDeviceBinaryImage &)=delete
virtual void dump(std::ostream &Out) const
RTDeviceBinaryImage::PropertyRange ProgramMetadata
RTDeviceBinaryImage::PropertyRange ImportedSymbols
RTDeviceBinaryImage(RTDeviceBinaryImage &&)=default
RTDeviceBinaryImage::PropertyRange SpecConstIDMap
RTDeviceBinaryImage(const RTDeviceBinaryImage &)=delete
RTDeviceBinaryImage::PropertyRange DeviceLibReqMask
RTDeviceBinaryImage::PropertyRange VirtualFunctions
const PropertyRange & getHostPipes() const
const PropertyRange & getSpecConstants() const
Gets the iterator range over specialization constants in this binary image.
const sycl_device_binary_struct & getRawData() const
const char * getLinkOptions() const
const PropertyRange & getVirtualFunctions() const
RTDeviceBinaryImage::PropertyRange AssertUsed
RTDeviceBinaryImage & operator=(RTDeviceBinaryImage &&)=default
ur::DeviceBinaryType getFormat() const
Returns the format of the binary image.
const PropertyRange & getSpecConstantsDefaultValues() const
RTDeviceBinaryImage::PropertyRange KernelParamOptInfo
const std::vector< ur_program_metadata_t > & getProgramMetadataUR() const
RTDeviceBinaryImage(sycl_device_binary Bin)
const PropertyRange & getAssertUsed() const
const PropertyRange & getProgramMetadata() const
std::uintptr_t getImageID() const
bool supportsSpecConstants() const
ur::DeviceBinaryType Format
sycl_device_binary_property getProperty(const char *PropName) const
Returns a single property from SYCL_MISC_PROP category.
const PropertyRange & getExportedSymbols() const
RTDeviceBinaryImage::PropertyRange DeviceGlobals
std::vector< ur_program_metadata_t > ProgramMetadataUR
sycl_device_binary get() const
virtual ~RTDeviceBinaryImage()
const PropertyRange & getDeviceGlobals() const
const PropertyRange & getDeviceRequirements() const
const PropertyRange & getImportedSymbols() const
const char * getCompileOptions() const
virtual void print() const
RTDeviceBinaryImage::PropertyRange ExportedSymbols
const PropertyRange & getKernelParamOptInfo() const
const PropertyRange & getDeviceLibReqMask() const
void init(sycl_device_binary Bin)
RTDeviceBinaryImage::PropertyRange SpecConstDefaultValuesMap
RTDeviceBinaryImage::PropertyRange DeviceRequirements
RTDeviceBinaryImage::PropertyRange HostPipes
sycl_device_binary_type
Types of device binary.
@ SYCL_DEVICE_BINARY_TYPE_SPIRV
@ SYCL_DEVICE_BINARY_TYPE_NONE
__SYCL_EXTERN_STREAM_ATTRS ostream cerr
Linked to standard error (unbuffered)
std::ostream & operator<<(std::ostream &os, std::optional< T > const &opt)
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 * BinaryStart
Pointer to the target code start.
const unsigned char * BinaryEnd
Pointer to the target code end.
C++ utilities for Unified Runtime integration.
_sycl_device_binary_property_struct * sycl_device_binary_property