diff --git a/sycl/doc/extensions/DeviceGlobal/SYCL_INTEL_device_global.asciidoc b/sycl/doc/extensions/DeviceGlobal/SYCL_INTEL_device_global.asciidoc index 1fe4db3eea11e..dd02a140fb7fe 100755 --- a/sycl/doc/extensions/DeviceGlobal/SYCL_INTEL_device_global.asciidoc +++ b/sycl/doc/extensions/DeviceGlobal/SYCL_INTEL_device_global.asciidoc @@ -185,8 +185,6 @@ Since _T_ is restricted to types with trivial default constructors in this versi The allocation of type _T_ is zero-initialized on each device prior to the first access to that `device_global` variable. -`device_global` may only be declared with static storage duration at namespace scope or class scope. If a `device_global` is declared with any other storage duration or scope, the program is ill-formed. - Properties may be specified for a `device_global` to provide semantic modification or optimization hint information to the compiler. See the section below for a list of the properties that are allowed. @@ -395,6 +393,94 @@ Available only if `sycl::is_property_of_v +using namespace sycl::ext::oneapi; + +device_global a; // OK +static device_global b; // OK +inline device_global c; // OK + +struct Foo { + static device_global d; // OK +}; +device_global Foo::d; + +struct Bar { + device_global e; // ILLEGAL: non-static member variable not +}; // allowed + +struct Baz { + private: + static device_global f; // ILLEGAL: not publicly accessible from +}; // namespace scope +device_global Baz::f; + +device_global g; // OK +device_global h[4]; // ILLEGAL: array of "device_global" not + // allowed + +device_global same_name; // OK +namespace foo { + device_global same_name; // OK +} +namespace { + device_global same_name; // OK +} +inline namespace other { + device_global same_name; // ILLEGAL: shadows "device_global" variable +} // with same name in enclosing namespace scope +inline namespace { + namespace foo { // ILLEGAL: namespace name shadows "::foo" + } // namespace which contains "device_global" + // variable. +} +---- + === Properties for device global variables The `device_global` class supports several compile-time-constant properties.