DPC++ Runtime
Runtime libraries for oneAPI DPC++
device_binary_image.cpp
Go to the documentation of this file.
1 //==----- device_binary_image.cpp --- SYCL device binary image abstraction -==//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include <CL/sycl/detail/pi.hpp>
10 
11 #include <memory>
12 
14 
16 namespace sycl {
17 namespace detail {
18 
19 DynRTDeviceBinaryImage::DynRTDeviceBinaryImage(
20  std::unique_ptr<char[]> &&DataPtr, size_t DataSize, OSModuleHandle M)
21  : RTDeviceBinaryImage(M) {
22  Data = std::move(DataPtr);
26  Bin->CompileOptions = "";
27  Bin->LinkOptions = "";
28  Bin->ManifestStart = nullptr;
29  Bin->ManifestEnd = nullptr;
30  Bin->BinaryStart = reinterpret_cast<unsigned char *>(Data.get());
31  Bin->BinaryEnd = Bin->BinaryStart + DataSize;
32  Bin->EntriesBegin = nullptr;
33  Bin->EntriesEnd = nullptr;
35  switch (Bin->Format) {
38  break;
39  default:
41  }
42  init(Bin);
43 }
44 
46  delete Bin;
47  Bin = nullptr;
48 }
49 
50 } // namespace detail
51 } // namespace sycl
52 } // __SYCL_INLINE_NAMESPACE(cl)
cl::sycl::detail::DynRTDeviceBinaryImage::~DynRTDeviceBinaryImage
~DynRTDeviceBinaryImage() override
Definition: device_binary_image.cpp:45
PI_DEVICE_BINARY_VERSION
static const uint16_t PI_DEVICE_BINARY_VERSION
Definition: pi.h:692
PI_DEVICE_BINARY_TYPE_SPIRV
static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_SPIRV
Definition: pi.h:687
__SYCL_PI_DEVICE_BINARY_TARGET_UNKNOWN
#define __SYCL_PI_DEVICE_BINARY_TARGET_UNKNOWN
Target identification strings for pi_device_binary_struct.DeviceTargetSpec.
Definition: pi.h:704
cl::sycl::detail::RTDeviceBinaryImage
Definition: device_binary_image.hpp:20
pi_device_binary_struct::DeviceTargetSpec
const char * DeviceTargetSpec
null-terminated string representation of the device's target architecture which holds one of: __SYCL_...
Definition: pi.h:778
cl::sycl::detail::pi::getBinaryImageFormat
PiDeviceBinaryType getBinaryImageFormat(const unsigned char *ImgData, size_t ImgSize)
Tries to determine the device binary image foramat.
Definition: pi.cpp:705
pi_device_binary_struct::BinaryStart
const unsigned char * BinaryStart
Pointer to the target code start.
Definition: pi.h:790
pi_device_binary_struct::ManifestStart
const char * ManifestStart
Pointer to the manifest data start.
Definition: pi.h:786
pi_device_binary_struct::BinaryEnd
const unsigned char * BinaryEnd
Pointer to the target code end.
Definition: pi.h:792
sycl
Definition: invoke_simd.hpp:68
cl::sycl::detail::pi::DeviceBinaryImage::Bin
pi_device_binary Bin
Definition: pi.hpp:392
pi.hpp
PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL
static const uint8_t PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL
Definition: pi.h:695
pi_device_binary_struct
This struct is a record of the device binary information.
Definition: pi.h:758
pi_device_binary_struct::LinkOptions
const char * LinkOptions
a null-terminated string; target- and compiler-specific options which are suggested to use to "link" ...
Definition: pi.h:784
pi_device_binary_struct::Format
uint8_t Format
format of the binary data - SPIR-V, LLVM IR bitcode,...
Definition: pi.h:766
pi_device_binary_struct::Kind
uint8_t Kind
the type of offload model the binary employs; must be 4 for SYCL
Definition: pi.h:764
cl
We provide new interfaces for matrix muliply in this patch:
Definition: access.hpp:13
cl::sycl::detail::DynRTDeviceBinaryImage::Data
std::unique_ptr< char[]> Data
Definition: device_binary_image.hpp:67
pi_device_binary_struct::CompileOptions
const char * CompileOptions
a null-terminated string; target- and compiler-specific options which are suggested to use to "compil...
Definition: pi.h:781
cl::sycl::detail::OSModuleHandle
intptr_t OSModuleHandle
Uniquely identifies an operating system module (executable or a dynamic library)
Definition: os_util.hpp:48
device_binary_image.hpp
pi_device_binary_struct::Version
uint16_t Version
version of this structure - for backward compatibility; all modifications which change order/type/off...
Definition: pi.h:762
__SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64
#define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64
SPIR-V 64-bit image <-> "spir64", 64-bit OpenCL device.
Definition: pi.h:708
pi_device_binary_struct::EntriesEnd
_pi_offload_entry EntriesEnd
Definition: pi.h:795
pi_device_binary_struct::ManifestEnd
const char * ManifestEnd
Pointer to the manifest data end.
Definition: pi.h:788
cl::sycl::detail::pi::DeviceBinaryImage::init
void init(pi_device_binary Bin)
Definition: pi.cpp:746
__SYCL_INLINE_NAMESPACE
#define __SYCL_INLINE_NAMESPACE(X)
Definition: defines_elementary.hpp:12
pi_device_binary_struct::EntriesBegin
_pi_offload_entry EntriesBegin
the offload entry table
Definition: pi.h:794