Skip to content

Commit ce4788a

Browse files
committed
Add description/requirements for __builtin_unique_ID
1 parent edb1586 commit ce4788a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

sycl/doc/SYCL2020-SpecializationConstants.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,7 @@ DPC++ FE is responsible for several things related to specialization constants:
625625
buffer with specialization constants values when they are emulated.
626626
3. Communicating to DPC++ RT mapping between `specialization_id`s and
627627
corresponding symbolic IDs through integration footer.
628+
4. It provides `__builtin_unique_ID` implementation.
628629

629630
`kernel_handler` is defined by SYCL 2020 specification as interface for
630631
retrieving specialization constant values in SYCL kernel functions, but it
@@ -738,6 +739,15 @@ generating integration footer at all, but since the host part of the program can
738739
be compiled with a third-party C++ 17-compatible compiler, which is unaware of
739740
the clang-specific built-ins, it can result in build errors.
740741

742+
`__builtin_unique_ID` is defined as follows: it accepts a variable and returns
743+
a C-string (`const char *`), which:
744+
- if the variable has external linkage, the string must be consistent in all
745+
translation units that reference this same variable.
746+
- if the variable has internal linkage, the string must be unique across all
747+
translation units.
748+
- return string must be the same if the built-in was called twice for the same
749+
variable within a single translation unit.
750+
741751
### DPC++ runtime
742752

743753
For each device binary compiler generates a map

0 commit comments

Comments
 (0)