|
27 | 27 | // maintained there should be a (+1) change to the major version in
|
28 | 28 | // addition to the increase of the minor.
|
29 | 29 | //
|
| 30 | +// PI version changes log: |
| 31 | +// -- Version 1.2: |
| 32 | +// 1. (Binary backward compatibility breaks) Two fields added to the |
| 33 | +// pi_device_binary_struct structure: |
| 34 | +// pi_device_binary_property_set PropertySetsBegin; |
| 35 | +// pi_device_binary_property_set PropertySetsEnd; |
| 36 | +// 2. A number of types needed to define pi_device_binary_property_set added. |
| 37 | +// |
30 | 38 | #define _PI_H_VERSION_MAJOR 1
|
31 |
| -#define _PI_H_VERSION_MINOR 1 |
| 39 | +#define _PI_H_VERSION_MINOR 2 |
32 | 40 |
|
33 | 41 | #define _PI_STRING_HELPER(a) #a
|
34 | 42 | #define _PI_CONCAT(a, b) _PI_STRING_HELPER(a.b)
|
@@ -531,6 +539,35 @@ struct _pi_offload_entry_struct {
|
531 | 539 |
|
532 | 540 | using _pi_offload_entry = _pi_offload_entry_struct *;
|
533 | 541 |
|
| 542 | +// A type of a binary image property. |
| 543 | +typedef enum { |
| 544 | + PI_PROP_TYPE_UNKNOWN, |
| 545 | + PI_PROP_TYPE_UINT32, // 32-bit integer |
| 546 | + PI_PROP_TYPE_STRING // null-terminated string |
| 547 | +} _pi_property_type; |
| 548 | + |
| 549 | +// Device binary image property. |
| 550 | +// If the type size of the property value is fixed and is no greater than |
| 551 | +// 64 bits, then ValAddr is 0 and the value is stored in the ValSize field. |
| 552 | +// Example - PI_PROP_TYPE_UINT32, which is 32-bit |
| 553 | +struct _pi_device_binary_property_struct { |
| 554 | + char *Name; // null-terminated property name |
| 555 | + void *ValAddr; // address of property value |
| 556 | + uint32_t Type; // _pi_property_type |
| 557 | + uint64_t ValSize; // size of property value in bytes |
| 558 | +}; |
| 559 | + |
| 560 | +typedef _pi_device_binary_property_struct *pi_device_binary_property; |
| 561 | + |
| 562 | +// Named array of properties. |
| 563 | +struct _pi_device_binary_property_set_struct { |
| 564 | + char *Name; // the name |
| 565 | + pi_device_binary_property PropertiesBegin; // array start |
| 566 | + pi_device_binary_property PropertiesEnd; // array end |
| 567 | +}; |
| 568 | + |
| 569 | +typedef _pi_device_binary_property_set_struct *pi_device_binary_property_set; |
| 570 | + |
534 | 571 | /// Types of device binary.
|
535 | 572 | using pi_device_binary_type = uint8_t;
|
536 | 573 | // format is not determined
|
@@ -566,10 +603,15 @@ static const uint8_t PI_DEVICE_BINARY_OFFLOAD_KIND_SYCL = 4;
|
566 | 603 | #define PI_DEVICE_BINARY_TARGET_SPIRV64_X86_64 "spir64_x86_64"
|
567 | 604 | #define PI_DEVICE_BINARY_TARGET_SPIRV64_GEN "spir64_gen"
|
568 | 605 | #define PI_DEVICE_BINARY_TARGET_SPIRV64_FPGA "spir64_fpga"
|
569 |
| - |
570 | 606 | /// PTX 64-bit image <-> "nvptx64", 64-bit NVIDIA PTX device
|
571 | 607 | #define PI_DEVICE_BINARY_TARGET_NVPTX64 "nvptx64"
|
572 | 608 |
|
| 609 | +/// Device binary image property set names recognized by the SYCL runtime. |
| 610 | +/// Name must be consistent with |
| 611 | +/// PropertySetRegistry::SYCL_SPECIALIZATION_CONSTANTS defined in |
| 612 | +/// PropertySetIO.h |
| 613 | +#define PI_PROPERTY_SET_SPEC_CONST_MAP "SYCL/specialization constants" |
| 614 | + |
573 | 615 | /// This struct is a record of the device binary information. If the Kind field
|
574 | 616 | /// denotes a portable binary type (SPIR-V or LLVM IR), the DeviceTargetSpec
|
575 | 617 | /// field can still be specific and denote e.g. FPGA target. It must match the
|
@@ -610,6 +652,13 @@ struct pi_device_binary_struct {
|
610 | 652 | /// the offload entry table
|
611 | 653 | _pi_offload_entry EntriesBegin;
|
612 | 654 | _pi_offload_entry EntriesEnd;
|
| 655 | + // Array of preperty sets; e.g. specialization constants symbol-int ID map is |
| 656 | + // propagated to runtime with this mechanism. |
| 657 | + pi_device_binary_property_set PropertySetsBegin; |
| 658 | + pi_device_binary_property_set PropertySetsEnd; |
| 659 | + // TODO Other fields like entries, link options can be propagated using |
| 660 | + // the property set infrastructure. This will improve binary compatibility and |
| 661 | + // add flexibility. |
613 | 662 | };
|
614 | 663 | using pi_device_binary = pi_device_binary_struct *;
|
615 | 664 |
|
|
0 commit comments