From 12a2ba235ed1268bbd04f123eb25b65485ae672f Mon Sep 17 00:00:00 2001 From: Pavel Dyakov Date: Fri, 1 Sep 2023 03:15:39 -0700 Subject: [PATCH] Applying the comments --- .../oneDPL/source/sycl_kernels_api.rst | 111 +++++++----------- 1 file changed, 45 insertions(+), 66 deletions(-) diff --git a/source/elements/oneDPL/source/sycl_kernels_api.rst b/source/elements/oneDPL/source/sycl_kernels_api.rst index 1ff8bd657c..072c5fc512 100644 --- a/source/elements/oneDPL/source/sycl_kernels_api.rst +++ b/source/elements/oneDPL/source/sycl_kernels_api.rst @@ -46,91 +46,70 @@ Supported functionality: - ``cauchy_distribution`` - ``extreme_value_distribution`` -Additionally, ``sycl::vec<>`` can be used as the result type for engines, engine adaptors, and distributions. - -Limitations: ------------- -The following deviations from the `C++ Standard`_ may apply: - -- ``random_device`` and ``seed_seq`` classes and related APIs in other classes are not required; -- ``operator>>()``, ``operator<<()``, ``operator==()`` are not required; -- specifying the size of a random number engine's state is not required; -- distributions are only required to operate with floating point types applicable to supported SYCL devices. - Extensions: ------------ The following extensions from the `C++ Standard`_ may apply: -- ``linear_congruential_engine`` and ``subtract_with_carry_engine`` satisfy the requirements of UniformRandomBitGenerator - for all cases except when ``UIntType`` template parameter equals ``sycl::vec<>``. - When ``UIntType`` equals ``sycl::vec<>`` +- As the ``result_type`` for engines, engine adaptors, and distributions ``sycl::vec<>`` can be used. + +- ``linear_congruential_engine`` and ``subtract_with_carry_engine`` satisfy the description and main requirements of UniformRandomBitGenerator. + Next extensions are applied: when ``UIntType`` equals ``sycl::vec<>`` - ``G::result_type`` is ``sycl::vec`` , where ``UIntElemType`` is one of unsigned integers type supported by SYCL devices, ``N`` is a number of elements - ``G::min()`` returns the smallest scalar value of ``UIntElemType`` type that G's operator() may return. - ``G::min()`` returns the largest scalar value of ``UIntElemType`` type that G's operator() may return. - ``g()`` returns a ``sycl::vec`` filled with ``N`` values in the closed interval ``[G::min(), G::max()]`` -- Next engines and engine adaptors with predefined parameters may be implemented: - -.. code:: cpp - - template - using minstd_rand0_vec = linear_congruential_engine, 16807, 0, 2147483647>;`` - -Required behavior: The 10000th consecutively produced random number value of a default-constructed object -of type ``minstd_rand0_vec<>`` is the same as for ``minstd_rand0`` and equals 1043618065. - -.. code:: cpp - - template - using minstd_rand_vec = linear_congruential_engine, 48271, 0, 2147483647>; - -Required behavior: The 10000th consecutively produced random number value of a default-constructed object -of type ``minstd_rand_vec<>`` is the same as for ``minstd_rand`` and equals 399268537. - -.. code:: cpp - - template - using ranlux24_base_vec = subtract_with_carry_engine, 24, 10, 24> - -Required behavior: The 10000th consecutively produced random number value of a default-constructed object -of type ``ranlux24_base_vec<>`` is the same as for ``ranlux24_base`` and equals 7937952. - -.. code:: cpp - - template - using ranlux48_base_vec = subtract_with_carry_engine, 48, 5, 12>; - -Required behavior: The 10000th consecutively produced random number value of a default-constructed object -of type ``ranlux48_base_vec<>`` is the same as for ``ranlux48_base`` and equals 61839128582725. - -.. code:: cpp - - template - using ranlux24_vec = discard_block_engine, 223, 23>; - -Required behavior: The 10000th consecutively produced random number value of a default-constructed object -of type ``ranlux24_vec<>`` is the same as for ``ranlux24`` and equals 9901578. - -.. code:: cpp - - template - using ranlux48_vec = discard_block_engine, 389, 11>; - -Required behavior: The 10000th consecutively produced random number value of a default-constructed object -of type ``ranlux48_vec<>`` is the same as for ``ranlux48`` and equals 1112339016. - -- ``linear_congruential_engine<>`` class template has the UIntScalarType type for template parameters ``a``, ``c``, ``m`` +- ``linear_congruential_engine<>`` class template has the ``UIntScalarType`` type for template parameters ``a``, ``c``, ``m``. Template type parameter ``UIntScalarType`` - equals appropriate ``UIntType`` if the last one is scalar - equals ``T`` if the ``UIntType`` is of ``sycl::vec`` type -- distribution class templates uses a scalar_type as a type for input arguments in costructors that is +- distribution class templates uses a ``scalar_type`` as a type for input arguments in costructors that - equals appropriate ``IntType`` or ``RealType`` distribution template parameter if the last one is scalar - equals ``T`` if the ``UIntType`` or ``RealType`` distribution template parameter is of ``sycl::vec`` type +- Next engines and engine adaptors with predefined parameters may be implemented: + + .. container:: tablenoborder + + + .. list-table:: + :header-rows: 1 + + * - Engines and engine adaptors based on ``sycl::vec<>`` + - C++ standard analogue + - The 10000th consecutively produced random number value of a default-constructed object + * - ``template using minstd_rand0_vec = linear_congruential_engine, 16807, 0, 2147483647>;`` + - ``minstd_rand0`` + - 1043618065 + * - ``template using minstd_rand_vec = linear_congruential_engine, 48271, 0, 2147483647>;`` + - ``minstd_rand`` + - 399268537 + * - ``template using ranlux24_base_vec = subtract_with_carry_engine, 24, 10, 24>;`` + - ``ranlux24_base`` + - 7937952 + * - ``template using ranlux48_base_vec = subtract_with_carry_engine, 48, 5, 12>;`` + - ``ranlux48_base`` + - 61839128582725 + * - ``template using ranlux24_vec = discard_block_engine, 223, 23>;`` + - ``ranlux24`` + - 9901578 + * - ``template using ranlux48_vec = discard_block_engine, 389, 11>;`` + - ``ranlux48`` + - 1112339016 + +Limitations: +------------ +The following deviations from the `C++ Standard`_ may apply: + +- ``random_device`` and ``seed_seq`` classes and related APIs in other classes are not required; +- ``operator>>()``, ``operator<<()``, ``operator==()`` are not required; +- specifying the size of a random number engine's state is not required; +- distributions are only required to operate with floating point types applicable to supported SYCL devices. + Function Objects ++++++++++++++++