Skip to content

[SYCL] Allow const device_global #8642

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

Merged
merged 1 commit into from
Mar 21, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ template <typename T, typename PropertyListT, typename = void>
class device_global_base {
protected:
using pointer_t = typename decorated_global_ptr<T>::pointer;
pointer_t usmptr;
pointer_t usmptr{};
pointer_t get_ptr() noexcept { return usmptr; }
const pointer_t get_ptr() const noexcept { return usmptr; }

Expand Down
11 changes: 11 additions & 0 deletions sycl/test/regression/device_global_const.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// RUN: %clangxx -fsycl -fsyntax-only -Xclang -verify %s
// expected-no-diagnostics

#include <sycl/sycl.hpp>

namespace experimental = sycl::ext::oneapi::experimental;

const experimental::device_global<int> DeviceGlobal;
const experimental::device_global<int, decltype(experimental::properties{
experimental::device_image_scope})>
ScopedDeviceGlobal;