File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ of which approach is in use.
67
67
## Common front-end part
68
68
69
69
DPC++ FE should support the following attribute:
70
- ` [[__sycl_detail__::uniquely_identifiable_object(kind)]] ` . This attribute accepts
70
+ ` [[__sycl_detail__::uniquely_identifiable_object(kind)]] ` . The attribute accepts
71
71
a string literal and should be applied to types (like ` device_global ` or
72
72
` specialization_id ` ).
73
73
@@ -83,6 +83,31 @@ things:
83
83
contains the ` kind ` string passed via
84
84
` [[__sycl_detail__::uniquely_identifiable_object(kind)]] ` attribute
85
85
86
+ To illustrate, here is a SYCL code snippet:
87
+
88
+ ```
89
+ template <typename T>
90
+ class
91
+ // Note: the attribute usage will be guarded by macro to be only applied when
92
+ // DPC++ compiler is used to avoid generating warnings. That is described
93
+ // later in the doc
94
+ [[__sycl_detail__::uniquely_identifiable_object("specialization_id")]]
95
+ specialization_id {
96
+ // ...
97
+ };
98
+
99
+ specialization_id<int> spec_const(38);
100
+ ```
101
+
102
+ After processed by DPC++ compiler, it will result in the following LLVM IR:
103
+
104
+ ```
105
+ %class.specialization_id = type { i32 }
106
+ @spec_const = dso_local global %class.specialization_id { i32 38 } #0
107
+
108
+ attributes #0 = { "sycl-unique-id"="string returned by __builtin_sycl_unique_id(spec_const)" "sycl-uid-kind"="specialization_id" }
109
+ ```
110
+
86
111
** TODO** : we have ` [[__sycl_detail__::device_global]] ` attribute documented in
87
112
[ device global design doc] [ device-global-design ] , which instructs front-end to
88
113
emit some additional semantic checking. Shall we leave it in place or that
You can’t perform that action at this time.
0 commit comments