Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYCL] Address multi_ptr in spec vs intel/llvm mismatches #439

Merged
merged 10 commits into from
Jul 20, 2023
6 changes: 0 additions & 6 deletions adoc/chapters/programming_interface.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<constant-memory>>.
Pointers to <<constant-memory>> 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]
Expand Down
27 changes: 26 additions & 1 deletion adoc/headers/multipointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,15 @@ class multi_ptr {
multi_ptr(
accessor<AccDataT, Dimensions, Mode, target::local, IsPlaceholder>);

// Deprecated
// Available only when:
// Space == access::address_space::constant_space &&
// (std::is_same_v<std::remove_const_t<ElementType>, std::remove_const_t<AccDataT>>) &&
// (std::is_const_v<ElementType> || !std::is_const_v<AccDataT>)
template <typename AccDataT, int Dimensions, access::placeholder IsPlaceholder>
multi_ptr(
accessor<AccDataT, Dimensions, access_mode::read, target::constant_buffer, IsPlaceholder>);

// Assignment and access operators
multi_ptr& operator=(const multi_ptr&);
multi_ptr& operator=(multi_ptr&&);
Expand Down Expand Up @@ -296,6 +305,14 @@ class multi_ptr<VoidType, Space, DecorateAddress> {
multi_ptr(
accessor<ElementType, Dimensions, Mode, target::local, IsPlaceholder>);

// Deprecated
// Available only when:
// Space == access::address_space::constant_space &&
// (std::is_const_v<VoidType> || !std::is_const_v<ElementType>)
template <typename ElementType, int Dimensions, access::placeholder IsPlaceholder>
multi_ptr(
accessor<ElementType, Dimensions, access_mode::read, target::constant_buffer, IsPlaceholder>);

// Assignment operators
multi_ptr& operator=(const multi_ptr&);
multi_ptr& operator=(multi_ptr&&);
Expand All @@ -304,7 +321,7 @@ class multi_ptr<VoidType, Space, DecorateAddress> {
pointer get() const;

// Conversion to the underlying pointer type
explicit operator pointer() const;
operator pointer() const;

// Explicit conversion to a multi_ptr<ElementType>
// Available only when: (std::is_const_v<ElementType> || !std::is_const_v<VoidType>)
Expand Down Expand Up @@ -384,6 +401,14 @@ template <typename T, int Dimensions, access::placeholder IsPlaceholder>
multi_ptr(accessor<T, Dimensions, access_mode::read_write, target::device, IsPlaceholder>)
-> multi_ptr<T, access::address_space::global_space, access::decorated::no>;
gmlueck marked this conversation as resolved.
Show resolved Hide resolved

template <typename T, int Dimensions, access::placeholder IsPlaceholder>
multi_ptr(accessor<T, Dimensions, access_mode::read, target::constant_buffer, IsPlaceholder>)
-> multi_ptr<const T, access::address_space::constant_space, access::decorated::no>;

template <typename T, int Dimensions, access_mode Mode, access::placeholder IsPlaceholder>
multi_ptr(accessor<T, Dimensions, Mode, target::local, IsPlaceholder>)
-> multi_ptr<T, access::address_space::local_space, access::decorated::no>;

template <typename T, int Dimensions>
multi_ptr(local_accessor<T, Dimensions>)
-> multi_ptr<T, access::address_space::local_space, access::decorated::no>;
Expand Down
47 changes: 40 additions & 7 deletions adoc/headers/multipointerlegacy.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,34 @@ class [[deprecated]] multi_ptr<ElementType, Space, access::decorated::legacy> {
}
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<ElementType>, std::remove_const_t<AccDataT>>) &&
// (std::is_const_v<ElementType> ||
// !std::is_const_v<accessor<AccDataT, Dimensions, Mode, target::device,
// IsPlaceholder>::value_type>)
template <int Dimensions, access_mode Mode, access::placeholder IsPlaceholder>
multi_ptr(
accessor<ElementType, Dimensions, Mode, target::device, IsPlaceholder>);

// 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<ElementType>, std::remove_const_t<AccDataT>>) &&
// (std::is_const_v<ElementType> || !std::is_const_v<AccDataT>)
template <int Dimensions, access_mode Mode, access::placeholder IsPlaceholder>
multi_ptr(
accessor<ElementType, Dimensions, Mode, target::local, IsPlaceholder>);

// Available only when:
// (Space == access::address_space::local_space ||
// Space == access::address_space::generic_space) &&
// (std::is_same_v<std::remove_const_t<ElementType>, std::remove_const_t<AccDataT>>) &&
// (std::is_const_v<ElementType> || !std::is_const_v<AccDataT>)
template <typename AccDataT, int Dimensions>
multi_ptr(local_accessor<AccDataT, Dimensions>);

// Only if Space == constant_space
template <int Dimensions, access_mode Mode, access::placeholder IsPlaceholder>
multi_ptr(accessor<ElementType, Dimensions, Mode, target::constant_buffer,
Expand All @@ -69,11 +87,11 @@ class [[deprecated]] multi_ptr<ElementType, Space, access::decorated::legacy> {
operator ElementType*() const;

// Implicit conversion to a multi_ptr<void>
// Only available when ElementType is not const-qualified
// Available only when ElementType is not const-qualified
operator multi_ptr<void, Space, access::decorated::legacy>() const;

// Implicit conversion to a multi_ptr<const void>
// Only available when ElementType is const-qualified
// Available only when ElementType is const-qualified
operator multi_ptr<const void, Space, access::decorated::legacy>() const;

// Implicit conversion to multi_ptr<const ElementType, Space>
Expand Down Expand Up @@ -176,15 +194,30 @@ class [[deprecated]] multi_ptr<VoidType, Space, access::decorated::legacy> {
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<VoidType> ||
// !std::is_const_v<accessor<ElementType, Dimensions, Mode, target::device,
// IsPlaceholder>::value_type>)
template <typename ElementType, int Dimensions, access_mode Mode>
multi_ptr(accessor<ElementType, Dimensions, Mode, target::device>);

// Only if Space == local_space
// Available only when:
// (Space == access::address_space::local_space ||
// Space == access::address_space::generic_space) &&
// (std::is_const_v<VoidType> || !std::is_const_v<ElementType>)
template <typename ElementType, int Dimensions, access_mode Mode>
multi_ptr(accessor<ElementType, Dimensions, Mode, target::local>);

// Only if Space == constant_space
// Available only when:
// (Space == access::address_space::local_space ||
// Space == access::address_space::generic_space) &&
// (std::is_const_v<VoidType> || !std::is_const_v<ElementType>)
template <typename AccDataT, int Dimensions>
multi_ptr(local_accessor<AccDataT, Dimensions>);

// Only if Space == access::address_space::constant_space
template <typename ElementType, int Dimensions, access_mode Mode>
multi_ptr(accessor<ElementType, Dimensions, Mode, target::constant_buffer>);

Expand Down