Skip to content

Commit 0e2ae18

Browse files
committed
Requirements: SYCL-Specific metadata and modules hierarchy
1 parent 14e2cac commit 0e2ae18

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

sycl/doc/design/RFC_drafts/SYCLBINDesign.md

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,30 @@ Community input is particularly valuable regarding potential integration challen
1515

1616
## Motivation and alternatives considered
1717

18-
### Metadata unique for SYCL programming model
18+
### Requirements: SYCL-Specific metadata and modules hierarchy
1919

20-
- [ ] This section needs re-writing...
21-
22-
LLVM offloading infrastructure supports the following binary formats: Object, Bitcode, Cubin, Fatbinary, PTX and SPIRV which could be placed into OffloadBinary format. None of it satisfies the needs of SYCL programming model.
20+
The SYCL programming model requires device images to be accompanied by specific metadata necessary for SYCL runtime operation:
2321

24-
- [ ] Steffen, I need to discuss with you, why other existing formats did not satisfy our needs. I think we need to provide short summary why each format doesn't work for us somewhere in this section.
22+
1. Device target triple (e.g. ``spirv64_unknown_unknown``).
23+
2. Compiler and linker options for JIT compilation scenarios
24+
3. List of entry points exposed by each image
25+
4. Arrays of [property sets](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/PropertySets.md).
2526

26-
Specifically, SYCL needs to keep the following metadata necessary for SYCL runtime, which is not supported by any of existing formats:
27+
When a binary contains multiple images, some may share common metadata. Therefore, we require a hierarchical structure that enables metadata sharing while allowing specification of image-specific metadata.
2728

28-
1. Device target triple (e.g. spirv64_unknown_unknown).
29-
2. Compiler and linker options to pass to JIT compiler in case of JITing.
30-
3. List of entry points exposed by an image
31-
4. Arrays of property sets.
29+
#### Existing Format Limitations:
3230

33-
While #1 and #2 can be saved to StringData of OffloadBinary, #3 requires additional handling, since StringData serialization infrastructure assumes that value is a single null-terminated string, so to restore multiple null-terminated strings from StringData format, they need to be concatenated with split symbol and then split during deserialization.
31+
LLVM's offloading infrastructure supports several binary formats that can be embedded within the OffloadBinary format. However, these formats have various limitations that make them unsuitable for SYCL:
3432

35-
[Property sets](https://github.com/intel/llvm/blob/sycl/sycl/doc/design/PropertySets.md) (#4) would be even more complicated.
33+
- **Single-module design**: Formats like Object, Bitcode, CUBIN, PTX, and SPIRV are designed for single binary or single-module IR representation, lacking hierarchical structuring capabilities for multiple images/modules
34+
- **Missing SYCL metadata support**: None provide native support for SYCL-specific metadata requirements
35+
- **Vendor constraints**: Fatbinary is NVIDIA proprietary and incompatible with SYCL's vendor-neutral approach
36+
- **Limited container capabilities**: OffloadBinary is not designed for multiple device images or hierarchical organization, with StringData insufficient for complex metadata structures (like #3 and #4 above).
3637

3738
### Abstraction: simplify support in offloading tools
3839

40+
- [ ] This section needs re-writing...
41+
3942
Another motivation to add SYCLBIN format is to encapsulate SYCL-specific logic to SYCL-specific parts of toolchain (clang-sycl-linker, SYCL runtime) and hide SYCL specifics from offloading tools intended to support multiple programming models. Without this format, we would need to use the following workflow to pass metadata (#1 - #4) from compiler to runtime:
4043

4144
1. clang-sycl-linker would use OffloadingImage’s StringData to save metadata #1-#4.

0 commit comments

Comments
 (0)