Skip to content

Commit

Permalink
Merge branch 'main' into khr_addrspace_cast
Browse files Browse the repository at this point in the history
  • Loading branch information
Pennycook authored Dec 2, 2024
2 parents 823bc55 + 94eb558 commit 2e6845c
Show file tree
Hide file tree
Showing 12 changed files with 123 additions and 22 deletions.
6 changes: 3 additions & 3 deletions adoc/chapters/architecture.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ implementation-defined.


[[sec:coordination]]
=== Coordination and Synchronization
=== Coordination and synchronization

Coordination between the host and any devices can be expressed in the host SYCL
application using calls into the SYCL runtime.
Expand All @@ -1403,7 +1403,7 @@ Such functions can be used to ensure that the host and any devices do not access
data concurrently, and/or to reason about the ordering of operations across the
host and any devices.

==== Host-Device Coordination
==== Host-device coordination

The following operations can be used to coordinate host and device(s):

Expand Down Expand Up @@ -1456,7 +1456,7 @@ So it is up to the programmer to use a member function to wait for completion in
some cases if this does not fit the goal.
See <<sec:managing-object-lifetimes>> for more information on object life time.

==== Work-item Coordination
==== Work-item coordination

A <<group-barrier>> provides a mechanism to coordinate all work-items in the
same group.
Expand Down
21 changes: 20 additions & 1 deletion adoc/chapters/device_compiler.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,16 @@ Amongst other things, this restriction makes it illegal for a
implementation defines the [code]#SYCL_EXTERNAL# macro as described in
<<subsec:syclexternal>>.

Inside a <<discarded-statement>> or in the case of a
<<manifestly-constant-evaluated>>, any code accepted by the C++ standard in this
case is also accepted in a SYCL <<device-function>>.

[NOTE]
====
The restriction waiver in <<discarded-statement>> or
<<manifestly-constant-evaluated>> allows any kind of meta-programming in a
<<device-function>>.
====

[[subsec:scalartypes]]
== Built-in scalar data types
Expand Down Expand Up @@ -377,8 +387,17 @@ in <<sec:backends>> must be defined by all conformant implementations.

A number of kernel features defined by this SYCL specification are optional;
they may be supported on some devices but not on other devices.

As stated in <<sec:language.restrictions.kernels>>, the restrictions for
optional kernel features do not apply to discarded statements or to manifestly
constant-evaluated expressions or conversions in device code.
Device code may use optional features in <<discarded-statement>> or
<<manifestly-constant-evaluated>> even if the device does not support the
optional feature.

As described in <<sec:device-aspects>>, an application can test whether a device
supports these features by testing whether the device has an associated aspect.
supports an optional feature by testing whether the device has an associated
aspect.
The following aspects are those that correspond to optional kernel features:

* [code]#fp16#
Expand Down
15 changes: 14 additions & 1 deletion adoc/chapters/glossary.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,12 @@ For the full description please refer to <<subsec:buffers>>.
One of the device with the highest non-negative value is selected.
See <<sec:device-selector>> for more details.

[[discarded-statement]]discarded statement::
ISO C++ +[stmt.if]+ describes a discarded statement as the branch statement
of an [code]#if constexpr# which is not instantiated because of the boolean
condition.
For more context, see <<sec:language.restrictions.kernels>>.

[[event]]event::
A SYCL object that represents the status of an operation that is being
executed by the SYCL runtime.
Expand Down Expand Up @@ -339,6 +345,14 @@ For the full description please refer to <<subsec:buffers>>.
Local memory is a memory region associated with a <<work-group>> and
accessible only by <<work-item,work-items>> in that <<work-group>>.

[[manifestly-constant-evaluated]]manifestly constant-evaluated expression or conversion::
ISO C++ +[expr.const]+ describes manifestly constant-evaluated expression or
conversion like constant expressions, condition of an +if constexpr+, an
immediate invocation, used in template parameters, in constant
initialization, etc.
This is evaluated at compile-time by the compiler.
For more context, see <<sec:language.restrictions.kernels>>.

[[mem-fence]]mem-fence::
A memory fence provides control over re-ordering of memory load and store
operations when coupled with an atomic operation.
Expand All @@ -353,7 +367,6 @@ For the full description please refer to <<subsec:buffers>>.
A <<specialization-constant>> in a device image whose value can be used by
an online compiler as an immediate value during the compilation.


[[nd-item]]nd-item::
A unique identifier representing a single <<work-item>> and <<work-group>>
within the index space of a SYCL kernel execution.
Expand Down
16 changes: 6 additions & 10 deletions adoc/chapters/programming_interface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9933,7 +9933,6 @@ For interoperability with the <<backend>>, users should rely on types exposed by
the decorated version.
If the value of [code]#access::decorated# is [code]#access::decorated::legacy#,
the 1.2.1 interface is exposed.
This interface is deprecated.

The template traits [code]#remove_decoration# and type alias
[code]#remove_decoration_t# retrieve the non-decorated pointer or reference from
Expand Down Expand Up @@ -10136,7 +10135,7 @@ operator=(const multi_ptr<value_type, AS, IsDecorated>&)
----
a@ Available only when: [code]#(Space == access::address_space::generic_space && AS != access::address_space::constant_space)#.

Assigns the value of the left hand side [code]#multi_ptr# into the [code]#generic_ptr#.
Assigns the value of the right hand side [code]#multi_ptr# into the [code]#generic_ptr#.

a@
[source]
Expand All @@ -10149,7 +10148,7 @@ operator=(multi_ptr<value_type, AS, IsDecorated>&&)
a@ Available only when:
[code]#(Space == access::address_space::generic_space && AS != access::address_space::constant_space)#.

Move the value of the left hand side [code]#multi_ptr# into the [code]#generic_ptr#.
Move the value of the right hand side [code]#multi_ptr# into the [code]#generic_ptr#.

a@
[source]
Expand Down Expand Up @@ -10642,10 +10641,6 @@ below.
include::{header_dir}/pointer.h[lines=4..-1]
----

Note that using [code]#global_ptr#, [code]#local_ptr#, [code]#constant_ptr# or
[code]#private_ptr# without specifying the decoration is deprecated.
The default argument is provided for compatibility with 1.2.1.


[[subsec:samplers]]
=== Image samplers
Expand Down Expand Up @@ -13892,9 +13887,10 @@ property::reduction::initialize_to_identity
identity value passed to the reduction interface, or to the identity
value determined by the [code]#known_identity# trait if no identity value
was specified. If no identity value was specified and an identity value
cannot be determined by the [code]#known_identity# trait, the compiler
must raise a diagnostic. When this property is set, the original value of
the reduction variable is not included in the reduction.
cannot be determined by the [code]#known_identity# trait, the
implementation must throw an [code]#exception# with the
[code]#errc::invalid# error code. When this property is set, the original
value of the reduction variable is not included in the reduction.

|====

Expand Down
5 changes: 4 additions & 1 deletion adoc/chapters/what_changed.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,6 @@ Changes in [code]#multi_ptr# interface:
Returned pointer and reference are not annotated by an address space;
** interface exposing decorated types.
Returned pointer and reference are annotated by an address space;
** legacy 1.2.1 interface (deprecated).
* deprecation of the 1.2.1 interface;
* deprecation of [code]#constant_ptr#;
* [code]#global_ptr#, [code]#local_ptr# and [code]#private_ptr# alias take the
Expand Down Expand Up @@ -468,4 +467,8 @@ parameters did not clearly specify which accessor's size determines the amount
of memory that is copied.
The spec now clarifies that the [code]#src# accessor's size is used.

Any code considered as a <<discarded-statement>> or as a
<<manifestly-constant-evaluated>> by the C++ standard is now also accepted in
SYCL device function.

// %%%%%%%%%%%%%%%%%%%%%%%%%%%% end what_changed %%%%%%%%%%%%%%%%%%%%%%%%%%%%
1 change: 1 addition & 0 deletions adoc/config/rouge/lib/rouge/lexers/sycl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ class Sycl < Cpp
context_bound
cpu_selector
decorated_constant_ptr
decorated_generic_ptr
decorated_global_ptr
decorated_local_ptr
decorated_private_ptr
Expand Down
3 changes: 1 addition & 2 deletions adoc/extensions/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ working group.
These extensions may be promoted to core features in future versions of the SYCL
specification, but their design is subject to change.

(There are currently no extensions in this appendix.)

// leveloffset=2 allows extensions to be written as standalone documents
// include::sycl_khr_extension_name.adoc[leveloffset=2]

include::sycl_khr_default_context.adoc[leveloffset=2]
include::sycl_khr_static_addrspace_cast.adoc[leveloffset=2]
include::sycl_khr_dynamic_addrspace_cast.adoc[leveloffset=2]
57 changes: 57 additions & 0 deletions adoc/extensions/sycl_khr_default_context.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[[sec:khr-default-context]]
= SYCL_KHR_DEFAULT_CONTEXT

When a [code]#queue# object is constructed without passing an explicit
[code]#context# object, the queue uses the platform's default context.
This extension adds a new query function to retrieve this default context from a
[code]#platform# object.

[[sec:khr-default-context-dependencies]]
== Dependencies

This extension has no dependencies on other extensions.

[[sec:khr-default-context-feature-test]]
== Feature test macro

An implementation supporting this extension must predefine the macro
[code]#SYCL_KHR_DEFAULT_CONTEXT# to one of the values defined in the table
below.

[%header,cols="1,5"]
|===
|Value
|Description

|1
|Initial version of this extension.
|===

[[sec:khr-default-context-platform]]
== Extensions to the platform class

This extension adds the following new member functions to the [code]#platform#
class.

[source,role=synopsis,id=api:khr-default-context-platform]
----
namespace sycl {
class platform {
context khr_get_default_context() const;
// ...
};
}
----

[[sec:khr-default-context-platform-member-funcs]]
=== Member functions

.[apidef]#platform::khr_get_default_context#
[source,role=synopsis,id=api:platform-khr-get-default-context]
----
context khr_get_default_context() const
----

_Returns:_ A copy of the default context object for this platform.
The default context contains all of the <<root-device, root devices>> that are
associated with this platform.
2 changes: 1 addition & 1 deletion adoc/headers/multipointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ enum class address_space : /* unspecified */ {
enum class decorated : /* unspecified */ {
no,
yes,
legacy // Deprecated in SYCL 2020
legacy
};

} // namespace access
Expand Down
2 changes: 0 additions & 2 deletions adoc/headers/multipointerlegacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
namespace sycl {

// Legacy interface, inherited from 1.2.1.
// Deprecated.
template <typename ElementType, access::address_space Space>
class [[deprecated]] multi_ptr<ElementType, Space, access::decorated::legacy> {
public:
Expand Down Expand Up @@ -162,7 +161,6 @@ class [[deprecated]] multi_ptr<ElementType, Space, access::decorated::legacy> {
};

// Legacy interface, inherited from 1.2.1.
// Deprecated.
// Specialization of multi_ptr for void and const void
// VoidType can be either void or const void
template <access::address_space Space>
Expand Down
15 changes: 15 additions & 0 deletions adoc/headers/pointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ template <typename ElementType,
using private_ptr =
multi_ptr<ElementType, access::address_space::private_space, IsDecorated>;

template <typename ElementType,
access::decorated IsDecorated = access::decorated::legacy>
using generic_ptr =
multi_ptr<ElementType, access::address_space::generic_space, IsDecorated>;

// Template specialization aliases for different pointer address spaces.
// The interface exposes non-decorated pointer while keeping the
// address space information internally.
Expand All @@ -48,6 +53,11 @@ using raw_private_ptr =
multi_ptr<ElementType, access::address_space::private_space,
access::decorated::no>;

template <typename ElementType>
using raw_generic_ptr =
multi_ptr<ElementType, access::address_space::generic_space,
access::decorated::no>;

// Template specialization aliases for different pointer address spaces.
// The interface exposes decorated pointer.

Expand All @@ -66,4 +76,9 @@ using decorated_private_ptr =
multi_ptr<ElementType, access::address_space::private_space,
access::decorated::yes>;

template <typename ElementType>
using decorated_generic_ptr =
multi_ptr<ElementType, access::address_space::generic_space,
access::decorated::yes>;

} // namespace sycl
2 changes: 1 addition & 1 deletion adoc/scripts/reflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
# A single letter followed by a period, typically a middle initial.
endInitial = re.compile(r'^[A-Z]\.$')
# An abbreviation, which does not (usually) end a line.
endAbbrev = re.compile(r'(e\.g|i\.e|c\.f|\bvs\b|\bco\b|\bltd\b|\bch\b)\.$', re.IGNORECASE)
endAbbrev = re.compile(r'(e\.g|i\.e|\bvs\b|\bco\b|\bltd\b|\bch\b|\bcf\b)\.$', re.IGNORECASE)
# A lower case word. When "etc." is followed by this, it does not end a line.
startsLowerCase = re.compile(r'\(?[a-z]')

Expand Down

0 comments on commit 2e6845c

Please sign in to comment.