@@ -988,186 +988,11 @@ using pi_device_exec_capabilities = pi_bitfield;
988
988
static constexpr pi_device_exec_capabilities PI_EXEC_KERNEL = (1 << 0 );
989
989
static constexpr pi_device_exec_capabilities PI_EXEC_NATIVE_KERNEL = (1 << 1 );
990
990
991
- // Entry type, matches OpenMP for compatibility
992
- struct _pi_offload_entry_struct {
993
- void *addr;
994
- char *name;
995
- size_t size;
996
- int32_t flags;
997
- int32_t reserved;
998
- };
999
-
1000
- using _pi_offload_entry = _pi_offload_entry_struct *;
1001
-
1002
- // A type of a binary image property.
1003
- typedef enum {
1004
- PI_PROPERTY_TYPE_UNKNOWN,
1005
- PI_PROPERTY_TYPE_UINT32, // 32-bit integer
1006
- PI_PROPERTY_TYPE_BYTE_ARRAY, // byte array
1007
- PI_PROPERTY_TYPE_STRING // null-terminated string
1008
- } pi_property_type;
1009
-
1010
- // Device binary image property.
1011
- // If the type size of the property value is fixed and is no greater than
1012
- // 64 bits, then ValAddr is 0 and the value is stored in the ValSize field.
1013
- // Example - PI_PROPERTY_TYPE_UINT32, which is 32-bit
1014
- struct _pi_device_binary_property_struct {
1015
- char *Name; // null-terminated property name
1016
- void *ValAddr; // address of property value
1017
- uint32_t Type; // _pi_property_type
1018
- uint64_t ValSize; // size of property value in bytes
1019
- };
1020
-
1021
- typedef _pi_device_binary_property_struct *pi_device_binary_property;
1022
-
1023
- // Named array of properties.
1024
- struct _pi_device_binary_property_set_struct {
1025
- char *Name; // the name
1026
- pi_device_binary_property PropertiesBegin; // array start
1027
- pi_device_binary_property PropertiesEnd; // array end
1028
- };
1029
-
1030
- typedef _pi_device_binary_property_set_struct *pi_device_binary_property_set;
1031
-
1032
- // / Types of device binary.
1033
- using pi_device_binary_type = uint8_t ;
1034
- // format is not determined
1035
- static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_NONE = 0 ;
1036
- // specific to a device
1037
- static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_NATIVE = 1 ;
1038
- // portable binary types go next
1039
- // SPIR-V
1040
- static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_SPIRV = 2 ;
1041
- // LLVM bitcode
1042
- static constexpr pi_device_binary_type PI_DEVICE_BINARY_TYPE_LLVMIR_BITCODE = 3 ;
1043
-
1044
- // Device binary descriptor version supported by this library.
1045
- static const uint16_t PI_DEVICE_BINARY_VERSION = 1 ;
1046
-
1047
- // The kind of offload model the binary employs; must be 4 for SYCL
1048
- static const uint8_t PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL = 4 ;
1049
-
1050
- // / Target identification strings for
1051
- // / pi_device_binary_struct.DeviceTargetSpec
1052
- // /
1053
- // / A device type represented by a particular target
1054
- // / triple requires specific binary images. We need
1055
- // / to map the image type onto the device target triple
1056
- // /
1057
- #define __SYCL_PI_DEVICE_BINARY_TARGET_UNKNOWN " <unknown>"
1058
- // / SPIR-V 32-bit image <-> "spir", 32-bit OpenCL device
1059
- #define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV32 " spir"
1060
- // / SPIR-V 64-bit image <-> "spir64", 64-bit OpenCL device
1061
- #define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64 " spir64"
1062
- // / Device-specific binary images produced from SPIR-V 64-bit <->
1063
- // / various "spir64_*" triples for specific 64-bit OpenCL devices
1064
- #define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_X86_64 " spir64_x86_64"
1065
- #define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_GEN " spir64_gen"
1066
- #define __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_FPGA " spir64_fpga"
1067
- // / PTX 64-bit image <-> "nvptx64", 64-bit NVIDIA PTX device
1068
- #define __SYCL_PI_DEVICE_BINARY_TARGET_NVPTX64 " nvptx64"
1069
- #define __SYCL_PI_DEVICE_BINARY_TARGET_AMDGCN " amdgcn"
1070
- #define __SYCL_PI_DEVICE_BINARY_TARGET_NATIVE_CPU " native_cpu"
1071
-
1072
991
// / Extension to denote native support of assert feature by an arbitrary device
1073
992
// / piDeviceGetInfo call should return this extension when the device supports
1074
993
// / native asserts if supported extensions' names are requested
1075
994
#define PI_DEVICE_INFO_EXTENSION_DEVICELIB_ASSERT " cl_intel_devicelib_assert"
1076
995
1077
- // / Device binary image property set names recognized by the SYCL runtime.
1078
- // / Name must be consistent with
1079
- // / PropertySetRegistry::SYCL_SPECIALIZATION_CONSTANTS defined in
1080
- // / PropertySetIO.h
1081
- #define __SYCL_PI_PROPERTY_SET_SPEC_CONST_MAP " SYCL/specialization constants"
1082
- // / PropertySetRegistry::SYCL_SPEC_CONSTANTS_DEFAULT_VALUES defined in
1083
- // / PropertySetIO.h
1084
- #define __SYCL_PI_PROPERTY_SET_SPEC_CONST_DEFAULT_VALUES_MAP \
1085
- " SYCL/specialization constants default values"
1086
- // / PropertySetRegistry::SYCL_DEVICELIB_REQ_MASK defined in PropertySetIO.h
1087
- #define __SYCL_PI_PROPERTY_SET_DEVICELIB_REQ_MASK " SYCL/devicelib req mask"
1088
- // / PropertySetRegistry::SYCL_KERNEL_PARAM_OPT_INFO defined in PropertySetIO.h
1089
- #define __SYCL_PI_PROPERTY_SET_KERNEL_PARAM_OPT_INFO " SYCL/kernel param opt"
1090
- // / PropertySetRegistry::SYCL_KERNEL_PROGRAM_METADATA defined in PropertySetIO.h
1091
- #define __SYCL_PI_PROPERTY_SET_PROGRAM_METADATA " SYCL/program metadata"
1092
- // / PropertySetRegistry::SYCL_MISC_PROP defined in PropertySetIO.h
1093
- #define __SYCL_PI_PROPERTY_SET_SYCL_MISC_PROP " SYCL/misc properties"
1094
- // / PropertySetRegistry::SYCL_ASSERT_USED defined in PropertySetIO.h
1095
- #define __SYCL_PI_PROPERTY_SET_SYCL_ASSERT_USED " SYCL/assert used"
1096
- // / PropertySetRegistry::SYCL_EXPORTED_SYMBOLS defined in PropertySetIO.h
1097
- #define __SYCL_PI_PROPERTY_SET_SYCL_EXPORTED_SYMBOLS " SYCL/exported symbols"
1098
- // / PropertySetRegistry::SYCL_IMPORTED_SYMBOLS defined in PropertySetIO.h
1099
- #define __SYCL_PI_PROPERTY_SET_SYCL_IMPORTED_SYMBOLS " SYCL/imported symbols"
1100
- // / PropertySetRegistry::SYCL_DEVICE_GLOBALS defined in PropertySetIO.h
1101
- #define __SYCL_PI_PROPERTY_SET_SYCL_DEVICE_GLOBALS " SYCL/device globals"
1102
- // / PropertySetRegistry::SYCL_DEVICE_REQUIREMENTS defined in PropertySetIO.h
1103
- #define __SYCL_PI_PROPERTY_SET_SYCL_DEVICE_REQUIREMENTS \
1104
- " SYCL/device requirements"
1105
- // / PropertySetRegistry::SYCL_HOST_PIPES defined in PropertySetIO.h
1106
- #define __SYCL_PI_PROPERTY_SET_SYCL_HOST_PIPES " SYCL/host pipes"
1107
- // / PropertySetRegistry::SYCL_VIRTUAL_FUNCTIONS defined in PropertySetIO.h
1108
- #define __SYCL_PI_PROPERTY_SET_SYCL_VIRTUAL_FUNCTIONS " SYCL/virtual functions"
1109
-
1110
- // / Program metadata tags recognized by the PI backends. For kernels the tag
1111
- // / must appear after the kernel name.
1112
- #define __SYCL_PI_PROGRAM_METADATA_TAG_REQD_WORK_GROUP_SIZE \
1113
- " @reqd_work_group_size"
1114
- #define __SYCL_PI_PROGRAM_METADATA_GLOBAL_ID_MAPPING " @global_id_mapping"
1115
-
1116
- #define __SYCL_PI_PROGRAM_METADATA_TAG_NEED_FINALIZATION " Requires finalization"
1117
-
1118
- // / This struct is a record of the device binary information. If the Kind field
1119
- // / denotes a portable binary type (SPIR-V or LLVM IR), the DeviceTargetSpec
1120
- // / field can still be specific and denote e.g. FPGA target. It must match the
1121
- // / __tgt_device_image structure generated by the clang-offload-wrapper tool
1122
- // / when their Version field match.
1123
- struct pi_device_binary_struct {
1124
- // / version of this structure - for backward compatibility;
1125
- // / all modifications which change order/type/offsets of existing fields
1126
- // / should increment the version.
1127
- uint16_t Version;
1128
- // / the type of offload model the binary employs; must be 4 for SYCL
1129
- uint8_t Kind;
1130
- // / format of the binary data - SPIR-V, LLVM IR bitcode,...
1131
- uint8_t Format;
1132
- // / null-terminated string representation of the device's target architecture
1133
- // / which holds one of:
1134
- // / __SYCL_PI_DEVICE_BINARY_TARGET_UNKNOWN - unknown
1135
- // / __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV32 - general value for 32-bit OpenCL
1136
- // / devices
1137
- // / __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64 - general value for 64-bit OpenCL
1138
- // / devices
1139
- // / __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_X86_64 - 64-bit OpenCL CPU device
1140
- // / __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_GEN - GEN GPU device (64-bit
1141
- // / OpenCL)
1142
- // / __SYCL_PI_DEVICE_BINARY_TARGET_SPIRV64_FPGA - 64-bit OpenCL FPGA device
1143
- const char *DeviceTargetSpec;
1144
- // / a null-terminated string; target- and compiler-specific options
1145
- // / which are suggested to use to "compile" program at runtime
1146
- const char *CompileOptions;
1147
- // / a null-terminated string; target- and compiler-specific options
1148
- // / which are suggested to use to "link" program at runtime
1149
- const char *LinkOptions;
1150
- // / Pointer to the manifest data start
1151
- const char *ManifestStart;
1152
- // / Pointer to the manifest data end
1153
- const char *ManifestEnd;
1154
- // / Pointer to the target code start
1155
- const unsigned char *BinaryStart;
1156
- // / Pointer to the target code end
1157
- const unsigned char *BinaryEnd;
1158
- // / the offload entry table
1159
- _pi_offload_entry EntriesBegin;
1160
- _pi_offload_entry EntriesEnd;
1161
- // Array of preperty sets; e.g. specialization constants symbol-int ID map is
1162
- // propagated to runtime with this mechanism.
1163
- pi_device_binary_property_set PropertySetsBegin;
1164
- pi_device_binary_property_set PropertySetsEnd;
1165
- // TODO Other fields like entries, link options can be propagated using
1166
- // the property set infrastructure. This will improve binary compatibility and
1167
- // add flexibility.
1168
- };
1169
- using pi_device_binary = pi_device_binary_struct *;
1170
-
1171
996
// pi_buffer_region structure repeats cl_buffer_region, used for sub buffers.
1172
997
struct pi_buffer_region_struct {
1173
998
size_t origin;
@@ -1211,27 +1036,6 @@ struct pi_image_region_struct {
1211
1036
};
1212
1037
using pi_image_region = pi_image_region_struct *;
1213
1038
1214
- // Offload binaries descriptor version supported by this library.
1215
- static const uint16_t PI_DEVICE_BINARIES_VERSION = 1 ;
1216
-
1217
- // / This struct is a record of all the device code that may be offloaded.
1218
- // / It must match the __tgt_bin_desc structure generated by
1219
- // / the clang-offload-wrapper tool when their Version field match.
1220
- struct pi_device_binaries_struct {
1221
- // / version of this structure - for backward compatibility;
1222
- // / all modifications which change order/type/offsets of existing fields
1223
- // / should increment the version.
1224
- uint16_t Version;
1225
- // / Number of device binaries in this descriptor
1226
- uint16_t NumDeviceBinaries;
1227
- // / Device binaries data
1228
- pi_device_binary DeviceBinaries;
1229
- // / the offload entry table (not used, for compatibility with OpenMP)
1230
- _pi_offload_entry *HostEntriesBegin;
1231
- _pi_offload_entry *HostEntriesEnd;
1232
- };
1233
- using pi_device_binaries = pi_device_binaries_struct *;
1234
-
1235
1039
// This union encapsulates the two external handles we currently support.
1236
1040
// When choosing the correct field from the union we need to look at the value
1237
1041
// of the enum `pi_external_mem_handle_type` or
@@ -1369,6 +1173,11 @@ typedef struct {
1369
1173
1370
1174
using pi_launch_property = _pi_launch_property;
1371
1175
1176
+ struct sycl_device_binaries_struct ;
1177
+ typedef sycl_device_binaries_struct *pi_device_binary;
1178
+ struct _sycl_device_binary_property_struct ;
1179
+ typedef _sycl_device_binary_property_struct *pi_device_binary_property;
1180
+
1372
1181
//
1373
1182
// Following section contains SYCL RT Plugin Interface (PI) functions.
1374
1183
// They are 3 distinct categories:
0 commit comments