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

Add shorthand aliases for address spaces #633

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions adoc/chapters/what_changed.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
* The overload with a fallback/secondary queue parameter of the
[code]#submit()# member function of [code]#sycl::queue# was deprecated.

* Added shorthand aliases for address spaces to reduce verbosity, enabling
(for example) [code]#sycl::access::address_space::global_space# to be
replaced with [code]#sycl::addrspace_global#.

== What has changed from SYCL 1.2.1 to SYCL 2020

The SYCL runtime moved from namespace [code]#cl::sycl# provided by
Expand Down
7 changes: 7 additions & 0 deletions adoc/headers/multipointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ enum class decorated : /* unspecified */ {

} // namespace access

// Shorthand aliases for address spaces
using addrspace = access::address_space;
constexpr inline addrspace addrspace_global = addrspace::global_space;
constexpr inline addrspace addrspace_local = addrspace::local_space;
constexpr inline addrspace addrspace_private = addrspace::private_space;
constexpr inline addrspace addrspace_generic = addrspace::generic_space;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is no longer constrained by namespace hierarchy, why not following English like
constexpr inline addrspace generic_addrspace = addrspace::generic_space;
?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AerialMantis' suggestion was that we should always use enum_value, because that's the precedent elsewhere (e.g., memory_order_relaxed, memory_scope_device).


template <typename T> struct remove_decoration {
using type = /* ... */;
};
Expand Down