@@ -515,16 +515,12 @@ declaration.
515
515
### Need to diagnose invalid declarations of ` device_global ` variables
516
516
517
517
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.
520
520
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 >
526
522
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 `
528
524
variable is declared in a way that violates these restrictions. We do not have
529
525
agreement yet, though, on how this should be done. For example, should the
530
526
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
539
535
the ` llvm-spirv ` tool is to generate these variables in the private address
540
536
space, even though they are declared at module scope.
541
537
542
- The [ existing OpenCL attribute] [ 11 ] ` [[clang::opencl_global]] ` is almost what
538
+ The [ existing OpenCL attribute] [ 12 ] ` [[clang::opencl_global]] ` is almost what
543
539
we need, but again this attribute can only be applied to a variable
544
540
declaration. Instead, we want some attribute that can be applied to the type
545
541
declaration of ` class device_global ` . We could invent some new attribute with
546
542
this semantic, but there is another problem.
547
543
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 >
549
545
550
546
Applying ` [[clang::opencl_global]] ` to a variable of class type currently
551
547
raises an error message saying there is no candidate "global" constructor for
@@ -577,9 +573,9 @@ compiler works in OpenCL C 2.0 mode.
577
573
The following three device global properties must be propagated from DPC++
578
574
source code, through LLVM IR, and into SPIR-V where they are represented as
579
575
SPIR-V decorations (defined in the
580
- [ SPV\_ INTEL\_ global\_ variable\_ decorations] [ 12 ] extension).
576
+ [ SPV\_ INTEL\_ global\_ variable\_ decorations] [ 13 ] extension).
581
577
582
- [ 12 ] : < extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc >
578
+ [ 13 ] : < extensions/DeviceGlobal/SPV_INTEL_global_variable_decorations.asciidoc >
583
579
584
580
* ` host_access `
585
581
* ` init_mode `
@@ -617,7 +613,7 @@ An alternative solution would be to augment the SPIR-V with some new decoration
617
613
that gives a unique name to each ` OpVariable ` that needs to be accessed from
618
614
the host. We could then use that name with the backend functions, and avoid
619
615
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
621
617
also require changes in the Level Zero and OpenCL backends.
622
618
623
619
### Does the compiler need to be deterministic?
0 commit comments