From b5b7143d2e909ae5cb088ed245d3cd5022147585 Mon Sep 17 00:00:00 2001 From: ElenaTyuleneva Date: Tue, 7 Oct 2025 13:16:38 +0200 Subject: [PATCH] [oneDPL][RNG] Add Philox engine to the oneAPI spec --- .../oneDPL/source/sycl_kernels_api.rst | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/source/elements/oneDPL/source/sycl_kernels_api.rst b/source/elements/oneDPL/source/sycl_kernels_api.rst index a8ae2c5850..2b41297083 100644 --- a/source/elements/oneDPL/source/sycl_kernels_api.rst +++ b/source/elements/oneDPL/source/sycl_kernels_api.rst @@ -27,6 +27,7 @@ Supported Functionality - Engine class templates: - ``linear_congruential_engine`` - ``subtract_with_carry_engine`` + - ``philox_engine`` - Engine adaptor class templates: - ``discard_block_engine`` - Engines and engine adaptors with predefined parameters: @@ -36,6 +37,8 @@ Supported Functionality - ``ranlux48_base`` - ``ranlux24`` - ``ranlux48`` + - ``philox4x32`` + - ``philox4x64`` - Distribution class templates: - ``uniform_int_distribution`` - ``uniform_real_distribution`` @@ -48,7 +51,7 @@ Supported Functionality - ``cauchy_distribution`` - ``extreme_value_distribution`` -``linear_congruential_engine`` and ``subtract_with_carry_engine`` satisfy the uniform random bit generator requirements. +``linear_congruential_engine``, ``subtract_with_carry_engine``, and ``philox_engine`` satisfy the uniform random bit generator requirements. Limitations ----------- @@ -82,7 +85,7 @@ The ``scalar_type`` is used instead of ``result_type`` in all contexts where a s Since ``scalar_type`` is the same as ``result_type`` except for template instantiations with ``sycl::vec``, class templates still meet the applicable requirements of the `C++ Standard`_. -When instantiated with ``sycl::vec``, ``linear_congruential_engine`` and ``subtract_with_carry_engine`` may not +When instantiated with ``sycl::vec``, ``linear_congruential_engine``, ``subtract_with_carry_engine``, and ``philox_engine`` may not formally satisfy the uniform random bit generator requirements defined by the `C++ Standard`_. Instead, the following alternative requirements apply: for an engine object ``g`` of type ``G``, @@ -105,7 +108,7 @@ The following engines and engine adaptors with predefined parameters are defined .. code:: cpp template - using minstd_rand0_vec = linear_congruential_engine, 16807, 0, 2147483647>; + using minstd_rand0_vec = linear_congruential_engine, 16807, 0, 2147483647>; template using minstd_rand_vec = linear_congruential_engine, 48271, 0, 2147483647>; @@ -122,6 +125,14 @@ The following engines and engine adaptors with predefined parameters are defined template using ranlux48_vec = discard_block_engine, 389, 11>; + template + using philox4x32_vec = + philox_engine, 32, 4, 10, 0xCD9E8D57, 0x9E3779B9, 0xD2511F53, 0xBB67AE85>; + + template + using philox4x64_vec = philox_engine, 64, 4, 10, 0xCA5A826395121157, 0x9E3779B97F4A7C15, + 0xD2E7470EE14C6C93, 0xBB67AE8584CAA73B>; + Except for producing a ``sycl::vec`` of random values per invocation, the behavior of these engines is equivalent to the corresponding scalar engines, as described in the following table: @@ -151,7 +162,12 @@ the corresponding scalar engines, as described in the following table: * - ``ranlux48_vec`` - ``ranlux48`` - 1112339016 - + * - ``philox4x32_vec`` + - ``philox4x32`` + - 1955073260 + * - ``philox4x64_vec`` + - ``philox4x64`` + - 3409172418970261260 Function Objects ++++++++++++++++