Skip to content

Commit b3a9426

Browse files
authored
[SYCL] Fix mismatch between sub_group headers (#1215)
sub_group::store took T& for host and const T& for device. Signed-off-by: John Pennycook <[email protected]>
1 parent 1853516 commit b3a9426

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

sycl/include/CL/sycl/intel/sub_group_host.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct sub_group {
136136
}
137137

138138
template <typename T, access::address_space Space>
139-
void store(multi_ptr<T, Space> dst, T &x) const {
139+
void store(multi_ptr<T, Space> dst, const T &x) const {
140140
throw runtime_error("Subgroups are not supported on host device. ");
141141
}
142142

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// RUN: %clangxx -I %sycl_include -fsyntax-only -Xclang -verify %s
2+
// expected-no-diagnostics
3+
//
4+
//==-- sub-group-store-const-ref.cpp ---------------------------------------==//
5+
//
6+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
7+
// See https://llvm.org/LICENSE.txt for license information.
8+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
9+
//
10+
//===----------------------------------------------------------------------===//
11+
// This test checks that sub_group::store supports const reference.
12+
//===----------------------------------------------------------------------===//
13+
#include <CL/sycl.hpp>
14+
using namespace sycl;
15+
16+
void test(intel::sub_group sg, global_ptr<int> ptr) { sg.store(ptr, 1); }

0 commit comments

Comments
 (0)