From ea8898c76c35ef00873b9ea15d8e1f8d0c3843a6 Mon Sep 17 00:00:00 2001 From: Ronan Keryell Date: Thu, 20 Jul 2023 08:32:17 -0700 Subject: [PATCH] Merge pull request #439 from mmoadeli/impl-spec-mismatch [SYCL] Address multi_ptr in spec vs intel/llvm mismatches Remove the 'explicit' keyword from the multi_ptr::operator pointer() function. Include a generic space constraint in the multi_ptr::ctor from accessor and accessor(local) to support generic_space. Implement the multi_ptr::ctor from local_accessor, including support for generic_space. Enable implicit conversion of multi_ptr from accessors with const types. Add deduction guides for the deprecated access::target::constant_buffer and access::target::local. Implement support for the constant_space specialization of non-legacy multi_ptr. --- adoc/chapters/programming_interface.adoc | 6 --- adoc/headers/multipointer.h | 27 +++++++++++++- adoc/headers/multipointerlegacy.h | 47 ++++++++++++++++++++---- 3 files changed, 66 insertions(+), 14 deletions(-) diff --git a/adoc/chapters/programming_interface.adoc b/adoc/chapters/programming_interface.adoc index 56945638..3167379d 100644 --- a/adoc/chapters/programming_interface.adoc +++ b/adoc/chapters/programming_interface.adoc @@ -9822,12 +9822,6 @@ bool operator>=(std::nullptr_t, const multi_ptr& rhs) The following is the overview of the legacy interface from 1.2.1 provided for the [code]#multi_ptr# class. -This legacy class supports the deprecated [code]#address_space::constant_space# -address space, which can be used to represent a pointer to <>. -Pointers to <> have an implementation-defined address space, -and each implementation can define whether it is legal to assign such a pointer -to a generic address pointer. - [source,,linenums] ---- include::{header_dir}/multipointerlegacy.h[lines=4..-1] diff --git a/adoc/headers/multipointer.h b/adoc/headers/multipointer.h index 944d4d9e..3d42f53f 100644 --- a/adoc/headers/multipointer.h +++ b/adoc/headers/multipointer.h @@ -88,6 +88,15 @@ class multi_ptr { multi_ptr( accessor); + // Deprecated + // Available only when: + // Space == access::address_space::constant_space && + // (std::is_same_v, std::remove_const_t>) && + // (std::is_const_v || !std::is_const_v) + template + multi_ptr( + accessor); + // Assignment and access operators multi_ptr& operator=(const multi_ptr&); multi_ptr& operator=(multi_ptr&&); @@ -296,6 +305,14 @@ class multi_ptr { multi_ptr( accessor); + // Deprecated + // Available only when: + // Space == access::address_space::constant_space && + // (std::is_const_v || !std::is_const_v) + template + multi_ptr( + accessor); + // Assignment operators multi_ptr& operator=(const multi_ptr&); multi_ptr& operator=(multi_ptr&&); @@ -304,7 +321,7 @@ class multi_ptr { pointer get() const; // Conversion to the underlying pointer type - explicit operator pointer() const; + operator pointer() const; // Explicit conversion to a multi_ptr // Available only when: (std::is_const_v || !std::is_const_v) @@ -384,6 +401,14 @@ template multi_ptr(accessor) -> multi_ptr; +template +multi_ptr(accessor) + -> multi_ptr; + +template +multi_ptr(accessor) + -> multi_ptr; + template multi_ptr(local_accessor) -> multi_ptr; diff --git a/adoc/headers/multipointerlegacy.h b/adoc/headers/multipointerlegacy.h index 2fdb6a9c..08bad414 100644 --- a/adoc/headers/multipointerlegacy.h +++ b/adoc/headers/multipointerlegacy.h @@ -43,16 +43,34 @@ class [[deprecated]] multi_ptr { } ElementType* operator->() const; - // Only if Space == global_space + // Available only when: + // (Space == access::address_space::global_space || + // Space == access::address_space::generic_space) && + // (std::is_same_v, std::remove_const_t>) && + // (std::is_const_v || + // !std::is_const_v::value_type>) template multi_ptr( accessor); - // Only if Space == local_space + // Available only when: + // (Space == access::address_space::local_space || + // Space == access::address_space::generic_space) && + // (std::is_same_v, std::remove_const_t>) && + // (std::is_const_v || !std::is_const_v) template multi_ptr( accessor); + // Available only when: + // (Space == access::address_space::local_space || + // Space == access::address_space::generic_space) && + // (std::is_same_v, std::remove_const_t>) && + // (std::is_const_v || !std::is_const_v) + template + multi_ptr(local_accessor); + // Only if Space == constant_space template multi_ptr(accessor { operator ElementType*() const; // Implicit conversion to a multi_ptr - // Only available when ElementType is not const-qualified + // Available only when ElementType is not const-qualified operator multi_ptr() const; // Implicit conversion to a multi_ptr - // Only available when ElementType is const-qualified + // Available only when ElementType is const-qualified operator multi_ptr() const; // Implicit conversion to multi_ptr @@ -176,15 +194,30 @@ class [[deprecated]] multi_ptr { multi_ptr& operator=(VoidType*); multi_ptr& operator=(std::nullptr_t); - // Only if Space == global_space + // Available only when: + // (Space == access::address_space::global_space || + // Space == access::address_space::generic_space) && + // (std::is_const_v || + // !std::is_const_v::value_type>) template multi_ptr(accessor); - // Only if Space == local_space + // Available only when: + // (Space == access::address_space::local_space || + // Space == access::address_space::generic_space) && + // (std::is_const_v || !std::is_const_v) template multi_ptr(accessor); - // Only if Space == constant_space + // Available only when: + // (Space == access::address_space::local_space || + // Space == access::address_space::generic_space) && + // (std::is_const_v || !std::is_const_v) + template + multi_ptr(local_accessor); + + // Only if Space == access::address_space::constant_space template multi_ptr(accessor);