diff --git a/adoc/chapters/device_compiler.adoc b/adoc/chapters/device_compiler.adoc index f8b3348f1..d625c7881 100644 --- a/adoc/chapters/device_compiler.adoc +++ b/adoc/chapters/device_compiler.adoc @@ -204,6 +204,7 @@ Amongst other things, this restriction makes it illegal for a However, a function may be defined in another translation unit if the implementation defines the [code]#SYCL_EXTERNAL# macro as described in <>. + * Use of the [code]#long double# type results in undefined behavior. Inside a <> or in the case of a <>, any code accepted by the C++ standard in this @@ -216,132 +217,23 @@ The restriction waiver in <> or <>. ==== -[[subsec:scalartypes]] -== Built-in scalar data types +== Data types -In a SYCL device compiler, the device definition of all standard {cpp} -fundamental types from <> must match the host -definition of those types, in both size and alignment. -A device compiler may have this preconfigured so that it can match them based on -the definitions of those types on the platform, or there may be a necessity for -a device compiler command-line option to ensure the types are the same. +All fundamental types defined by the {cpp} core language must be available in +device code except for those listed in <>. +Whether extended integer and/or extended floating-point types are available in +device code is implementation-defined. -The standard {cpp} fixed width types, e.g. [code]#int8_t#, [code]#int16_t#, -[code]#int32_t#,[code]#int64_t#, should have the same size as defined by the -{cpp} standard for host and device. - - -[[table.types.fundamental]] -.Fundamental data types supported by SYCL -[width="100%",options="header",separator="@",cols="65%,35%"] -|==== -@ Fundamental data type @ Description -a@ -[source] ----- -bool ----- - a@ A conditional data type which can be either true or false. The value - true expands to the integer constant 1 and the value false expands to the - integer constant 0. - -a@ -[source] ----- -char ----- - a@ A signed or unsigned 8-bit integer, as defined by the {cpp} core language - -a@ -[source] ----- -signed char ----- - a@ A signed 8-bit integer, as defined by the {cpp} core language - -a@ -[source] ----- -unsigned char ----- - a@ An unsigned 8-bit integer, as defined by the {cpp} core language - -a@ -[source] ----- -short int ----- - a@ A signed integer of at least 16-bits, as defined by the {cpp} core language - -a@ -[source] ----- -unsigned short int ----- - a@ An unsigned integer of at least 16-bits, as defined by the {cpp} core language - -a@ -[source] ----- -int ----- - a@ A signed integer of at least 16-bits, as defined by the {cpp} core language - -a@ -[source] ----- -unsigned int ----- - a@ An unsigned integer of at least 16-bits, as defined by the {cpp} core language - -a@ -[source] ----- -long int ----- - a@ A signed integer of at least 32-bits, as defined by the {cpp} core language - -a@ -[source] ----- -unsigned long int ----- - a@ An unsigned integer of at least 32-bits, as defined by the {cpp} core language - -a@ -[source] ----- -long long int ----- - a@ An integer of at least 64-bits, as defined by the {cpp} core language - -a@ -[source] ----- -unsigned long long int ----- - a@ An unsigned integer of at least 64-bits, as defined by the {cpp} core language - -a@ -[source] ----- -float ----- - a@ A 32-bit floating-point. The float data type must conform to the IEEE 754 - single precision storage format. - -a@ -[source] ----- -double ----- - a@ A 64-bit floating-point. The double data type must conform to the IEEE 754 - double precision storage format. This type is only supported on devices - that have [code]#aspect::fp64#. - -|==== +The availability of a type in device code does not guarantee that it will be +supported by all devices. +Some types are only supported on devices with specific device aspects, as +described in <>. +All types which are available in device code must have the same size, alignment +requirements, and representation on both host and device. +For enumerations without a fixed underlying type, the implementation must select +the same underlying type on host and device. == Preprocessor directives and macros @@ -387,6 +279,30 @@ literal with greater value. In addition, for each <> supported, the preprocessor macros described in <> must be defined by all conformant implementations. +[[sec:standard-library-support]] +== {cpp} standard library support + +In general, any use of functions or types from the [code]#std# namespace in +device code produces undefined behavior. +However, the functions and types listed in this section are guaranteed to have +defined semantics when used in device code. + +=== Type aliases + +The following type aliases must alias the same types on host and device: + + * [code]#std::size_t#; + * [code]#std::ptrdiff_t#; + * [code]#std::max_align_t#; + * [code]#std::nullptr_t#; and + * The type aliases for integer types defined in [code]##. + +=== Type traits + +For any type available in device code, specializations of the following type +traits must have identical definitions on host and device: + + * [code]#std::numeric_limits# [[sec:optional-kernel-features]] == Optional kernel features diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index af92ab351..ba77f1cbf 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -17809,25 +17809,13 @@ std::error_code make_error_code(errc e) noexcept; == Data types -SYCL as a {cpp} programming model supports the {cpp} core language data types, -and it also provides the ability for all SYCL applications to be executed on -SYCL compatible devices. -The scalar and vector data types that are supported by the SYCL system are -defined below. -More details about the SYCL device compiler support for fundamental and backend -interoperability types are found in <>. +All types which are available in device code must have the same size, alignment +requirements, and representation on both host and device. +=== Scalar types -=== Scalar data types - -The fundamental {cpp} data types which are supported in SYCL are described in -<>. -Note these types are fundamental and therefore do not exist within the -[code]#sycl# namespace. - -Additional scalar data types which are supported by SYCL within the [code]#sycl# -namespace are described in <>. - +In addition to the scalar types defined by {cpp}, SYCL defines a number of +scalar types as described in <>. [[table.types.additional]] .Additional scalar data types supported by SYCL