Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sycl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ set(SYCL_MINOR_VERSION 7)
set(SYCL_PATCH_VERSION 0)
# Don't forget to re-enable sycl_symbols_windows.dump once we leave ABI-breaking
# window!
set(SYCL_DEV_ABI_VERSION 16)
set(SYCL_DEV_ABI_VERSION 17)
if (SYCL_ADD_DEV_VERSION_POSTFIX)
set(SYCL_VERSION_POSTFIX "-${SYCL_DEV_ABI_VERSION}")
endif()
Expand Down
72 changes: 0 additions & 72 deletions sycl/include/sycl/detail/device_binary_image.hpp

This file was deleted.

190 changes: 0 additions & 190 deletions sycl/include/sycl/detail/pi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,196 +207,6 @@ void emitFunctionWithArgsEndTrace(uint64_t CorrelationID, uint32_t FuncID,
const char *FName, unsigned char *ArgsData,
pi_result Result, pi_plugin Plugin);

// A wrapper for passing around byte array properties
class ByteArray {
public:
using ConstIterator = const std::uint8_t *;

ByteArray(const std::uint8_t *Ptr, std::size_t Size) : Ptr{Ptr}, Size{Size} {}
const std::uint8_t &operator[](std::size_t Idx) const { return Ptr[Idx]; }
std::size_t size() const { return Size; }
ConstIterator begin() const { return Ptr; }
ConstIterator end() const { return Ptr + Size; }

private:
const std::uint8_t *Ptr;
const std::size_t Size;
};

// C++ wrapper over the _pi_device_binary_property_struct structure.
class DeviceBinaryProperty {
public:
DeviceBinaryProperty(const _pi_device_binary_property_struct *Prop)
: Prop(Prop) {}

pi_uint32 asUint32() const;
ByteArray asByteArray() const;
const char *asCString() const;

protected:
friend std::ostream &operator<<(std::ostream &Out,
const DeviceBinaryProperty &P);
const _pi_device_binary_property_struct *Prop;
};

std::ostream &operator<<(std::ostream &Out, const DeviceBinaryProperty &P);

// C++ convenience wrapper over the pi_device_binary_struct structure.
class DeviceBinaryImage {
public:
// Represents a range of properties to enable iteration over them.
// Implements the standard C++ STL input iterator interface.
class PropertyRange {
public:
using ValTy = std::remove_pointer<pi_device_binary_property>::type;

class ConstIterator {
pi_device_binary_property Cur;

public:
using iterator_category = std::input_iterator_tag;
using value_type = ValTy;
using difference_type = ptrdiff_t;
using pointer = const pi_device_binary_property;
using reference = pi_device_binary_property;

ConstIterator(pi_device_binary_property Cur = nullptr) : Cur(Cur) {}
ConstIterator &operator++() {
Cur++;
return *this;
}
ConstIterator operator++(int) {
ConstIterator Ret = *this;
++(*this);
return Ret;
}
bool operator==(ConstIterator Other) const { return Cur == Other.Cur; }
bool operator!=(ConstIterator Other) const { return !(*this == Other); }
reference operator*() const { return Cur; }
};
ConstIterator begin() const { return ConstIterator(Begin); }
ConstIterator end() const { return ConstIterator(End); }
friend class DeviceBinaryImage;
bool isAvailable() const { return !(Begin == nullptr); }

private:
PropertyRange() : Begin(nullptr), End(nullptr) {}
// Searches for a property set with given name and constructs a
// PropertyRange spanning all its elements. If property set is not found,
// the range will span zero elements.
PropertyRange(pi_device_binary Bin, const char *PropSetName)
: PropertyRange() {
init(Bin, PropSetName);
};
void init(pi_device_binary Bin, const char *PropSetName);
pi_device_binary_property Begin;
pi_device_binary_property End;
};

public:
DeviceBinaryImage(pi_device_binary Bin) { init(Bin); }
DeviceBinaryImage() : Bin(nullptr){};

virtual void print() const;
virtual void dump(std::ostream &Out) const;

size_t getSize() const {
assert(Bin && "binary image data not set");
return static_cast<size_t>(Bin->BinaryEnd - Bin->BinaryStart);
}

const char *getCompileOptions() const {
assert(Bin && "binary image data not set");
return Bin->CompileOptions;
}

const char *getLinkOptions() const {
assert(Bin && "binary image data not set");
return Bin->LinkOptions;
}

/// Returns the format of the binary image
pi::PiDeviceBinaryType getFormat() const {
assert(Bin && "binary image data not set");
return Format;
}

/// Returns a single property from SYCL_MISC_PROP category.
pi_device_binary_property getProperty(const char *PropName) const;

/// Gets the iterator range over specialization constants in this binary
/// image. For each property pointed to by an iterator within the
/// range, the name of the property is the specialization constant symbolic ID
/// and the value is a list of 3-element tuples of 32-bit unsigned integers,
/// describing the specialization constant.
/// This is done in order to unify representation of both scalar and composite
/// specialization constants: composite specialization constant is represented
/// by its leaf elements, so for scalars the list contains only a single
/// tuple, while for composite there might be more of them.
/// Each tuple consists of ID of scalar specialization constant, its location
/// within a composite (offset in bytes from the beginning or 0 if it is not
/// an element of a composite specialization constant) and its size.
/// For example, for the following structure:
/// struct A { int a; float b; };
/// struct POD { A a[2]; int b; };
/// List of tuples will look like:
/// { ID0, 0, 4 }, // .a[0].a
/// { ID1, 4, 4 }, // .a[0].b
/// { ID2, 8, 4 }, // .a[1].a
/// { ID3, 12, 4 }, // .a[1].b
/// { ID4, 16, 4 }, // .b
/// And for an interger specialization constant, the list of tuples will look
/// like:
/// { ID5, 0, 4 }
const PropertyRange &getSpecConstants() const { return SpecConstIDMap; }
const PropertyRange getSpecConstantsDefaultValues() const {
// We can't have this variable as a class member, since it would break
// the ABI backwards compatibility.
DeviceBinaryImage::PropertyRange SpecConstDefaultValuesMap;
SpecConstDefaultValuesMap.init(
Bin, __SYCL_PI_PROPERTY_SET_SPEC_CONST_DEFAULT_VALUES_MAP);
return SpecConstDefaultValuesMap;
}
const PropertyRange &getDeviceLibReqMask() const { return DeviceLibReqMask; }
const PropertyRange &getKernelParamOptInfo() const {
return KernelParamOptInfo;
}
const PropertyRange getAssertUsed() const {
// We can't have this variable as a class member, since it would break
// the ABI backwards compatibility.
PropertyRange AssertUsed;
AssertUsed.init(Bin, __SYCL_PI_PROPERTY_SET_SYCL_ASSERT_USED);
return AssertUsed;
}
const PropertyRange &getProgramMetadata() const { return ProgramMetadata; }
const PropertyRange getExportedSymbols() const {
// We can't have this variable as a class member, since it would break
// the ABI backwards compatibility.
DeviceBinaryImage::PropertyRange ExportedSymbols;
ExportedSymbols.init(Bin, __SYCL_PI_PROPERTY_SET_SYCL_EXPORTED_SYMBOLS);
return ExportedSymbols;
}
const PropertyRange getDeviceGlobals() const {
// We can't have this variable as a class member, since it would break
// the ABI backwards compatibility.
DeviceBinaryImage::PropertyRange DeviceGlobals;
DeviceGlobals.init(Bin, __SYCL_PI_PROPERTY_SET_SYCL_DEVICE_GLOBALS);
return DeviceGlobals;
}
virtual ~DeviceBinaryImage() {}

protected:
void init(pi_device_binary Bin);
pi_device_binary get() const { return Bin; }

pi_device_binary Bin;
pi::PiDeviceBinaryType Format = PI_DEVICE_BINARY_TYPE_NONE;
DeviceBinaryImage::PropertyRange SpecConstIDMap;
DeviceBinaryImage::PropertyRange DeviceLibReqMask;
DeviceBinaryImage::PropertyRange KernelParamOptInfo;
DeviceBinaryImage::PropertyRange ProgramMetadata;
};

/// Tries to determine the device binary image foramat. Returns
/// PI_DEVICE_BINARY_TYPE_NONE if unsuccessful.
PiDeviceBinaryType getBinaryImageFormat(const unsigned char *ImgData,
Expand Down
Loading