Skip to content

Commit eda8c3e

Browse files
committed
Point to PR for device global var restrictions
Update the unresolved issue about diagnosing invalid `device_global` declarations to reference the PR against the API spec that describes exactly what these restrictions are.
1 parent e54e376 commit eda8c3e

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

sycl/doc/DeviceGlobal.md

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -515,16 +515,12 @@ declaration.
515515
### Need to diagnose invalid declarations of `device_global` variables
516516

517517
The device global extension specification places restrictions on where a
518-
`device_global` variable can be declared. These restrictions are similar to
519-
ones we have already for variables of type `specialization_id`:
518+
`device_global` variable can be declared aas clarified in [this PR][11] against
519+
the extension specification API.
520520

521-
* A `device_global` variable can be declared at namespace scope.
522-
* A `device_global` variable can be declared as a static member variable in
523-
class scope, but only if the declaration has public visibility from namespace
524-
scope.
525-
* No other declarations are allowed for a variable of type `device_global`.
521+
[11]: <https://github.com/intel/llvm/pull/4697>
526522

527-
The device compiler front-end needs to emit a diagnostic if a `device_global`
523+
The device compiler front-end should emit a diagnostic if a `device_global`
528524
variable is declared in a way that violates these restrictions. We do not have
529525
agreement yet, though, on how this should be done. For example, should the
530526
front-end recognize these variable declarations by the name of their type, or
@@ -539,13 +535,13 @@ Unless we decorate these variables in some special way, the current behavior of
539535
the `llvm-spirv` tool is to generate these variables in the private address
540536
space, even though they are declared at module scope.
541537

542-
The [existing OpenCL attribute][11] `[[clang::opencl_global]]` is almost what
538+
The [existing OpenCL attribute][12] `[[clang::opencl_global]]` is almost what
543539
we need, but again this attribute can only be applied to a variable
544540
declaration. Instead, we want some attribute that can be applied to the type
545541
declaration of `class device_global`. We could invent some new attribute with
546542
this semantic, but there is another problem.
547543

548-
[11]: <https://clang.llvm.org/docs/AttributeReference.html#global-global-clang-opencl-global>
544+
[12]: <https://clang.llvm.org/docs/AttributeReference.html#global-global-clang-opencl-global>
549545

550546
Applying `[[clang::opencl_global]]` to a variable of class type currently
551547
raises an error message saying there is no candidate "global" constructor for
@@ -577,9 +573,9 @@ compiler works in OpenCL C 2.0 mode.
577573
The following three device global properties must be propagated from DPC++
578574
source code, through LLVM IR, and into SPIR-V where they are represented as
579575
SPIR-V decorations (defined in the
580-
[SPV\_INTEL\_global\_variable\_decorations][12] extension).
576+
[SPV\_INTEL\_global\_variable\_decorations][13] extension).
581577

582-
[12]: <extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc>
578+
[13]: <extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc>
583579

584580
* `host_access`
585581
* `init_mode`
@@ -617,7 +613,7 @@ An alternative solution would be to augment the SPIR-V with some new decoration
617613
that gives a unique name to each `OpVariable` that needs to be accessed from
618614
the host. We could then use that name with the backend functions, and avoid
619615
renaming variables with internal linkage. This would be only a minor change to
620-
the [SPV\_INTEL\_global\_variable\_decorations][12] extension, but it would
616+
the [SPV\_INTEL\_global\_variable\_decorations][13] extension, but it would
621617
also require changes in the Level Zero and OpenCL backends.
622618

623619
### Does the compiler need to be deterministic?

0 commit comments

Comments
 (0)