Skip to content

Commit ac94b1e

Browse files
authored
[SYCL] Re-use OpenCL address space attributes for SYCL (#1581)
Today we re-use OpenCL parsed attributes, but have separate SYCL address space semantic attributes as current implementation of OpenCL semantics breaks valid C++. This patch enables re-use of OpenCL semantic attributes by allowing conversions between types qualified with OpenCL address spaces and type w/o address space qualifiers. Clang compiler (almost) always adds address space qualifiers in OpenCL mode, so it should not affect OpenCL mode. NOTE: this change also disables implicit conversion between the unqualified types and types qualified with `__attribute__((address_space(N)))`, enabled by one of the previous SYCL patches. Signed-off-by: Alexey Bader <alexey.bader@intel.com> Signed-off-by: Mariya Podchishchaeva <mariya.podchishchaeva@intel.com>
1 parent 77daa47 commit ac94b1e

File tree

20 files changed

+60
-224
lines changed

20 files changed

+60
-224
lines changed

clang/include/clang/AST/Type.h

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -488,15 +488,12 @@ class Qualifiers {
488488
/// Returns true if the address space in these qualifiers is equal to or
489489
/// a superset of the address space in the argument qualifiers.
490490
bool isAddressSpaceSupersetOf(Qualifiers other) const {
491-
492-
return
493-
isAddressSpaceSupersetOf(getAddressSpace(), other.getAddressSpace()) ||
494-
(!hasAddressSpace() &&
495-
(other.getAddressSpace() == LangAS::sycl_private ||
496-
other.getAddressSpace() == LangAS::sycl_local ||
497-
other.getAddressSpace() == LangAS::sycl_global ||
498-
other.getAddressSpace() == LangAS::sycl_constant ||
499-
other.getAddressSpace() == LangAS::sycl_generic));
491+
return isAddressSpaceSupersetOf(getAddressSpace(),
492+
other.getAddressSpace()) ||
493+
(!hasAddressSpace() &&
494+
(other.getAddressSpace() == LangAS::opencl_private ||
495+
other.getAddressSpace() == LangAS::opencl_local ||
496+
other.getAddressSpace() == LangAS::opencl_global));
500497
}
501498

502499
/// Determines if these qualifiers compatibly include another set.

clang/include/clang/Basic/AddressSpaces.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ enum class LangAS : unsigned {
4242
cuda_constant,
4343
cuda_shared,
4444

45-
sycl_global,
46-
sycl_local,
47-
sycl_constant,
48-
sycl_private,
49-
// Likely never used, but useful in the future to reserve the spot in the
50-
// enum.
51-
sycl_generic,
52-
5345
// Pointer size and extension address spaces.
5446
ptr32_sptr,
5547
ptr32_uptr,

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10671,8 +10671,6 @@ def err_builtin_launder_invalid_arg : Error<
1067110671
"'__builtin_launder' is not allowed">;
1067210672

1067310673
// SYCL-specific diagnostics
10674-
def err_sycl_attribute_address_space_invalid : Error<
10675-
"address space is outside the valid range of values">;
1067610674
def err_sycl_kernel_incorrectly_named : Error<
1067710675
"kernel %select{name is missing"
1067810676
"|needs to have a globally-visible name}0">;

clang/include/clang/Sema/ParsedAttr.h

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -617,24 +617,6 @@ class ParsedAttr final
617617
}
618618
}
619619

620-
/// If this is an OpenCL addr space attribute returns its SYCL representation
621-
/// in LangAS, otherwise returns default addr space.
622-
LangAS asSYCLLangAS() const {
623-
switch (getKind()) {
624-
case ParsedAttr::AT_OpenCLConstantAddressSpace:
625-
return LangAS::sycl_constant;
626-
case ParsedAttr::AT_OpenCLGlobalAddressSpace:
627-
return LangAS::sycl_global;
628-
case ParsedAttr::AT_OpenCLLocalAddressSpace:
629-
return LangAS::sycl_local;
630-
case ParsedAttr::AT_OpenCLPrivateAddressSpace:
631-
return LangAS::sycl_private;
632-
case ParsedAttr::AT_OpenCLGenericAddressSpace:
633-
default:
634-
return LangAS::Default;
635-
}
636-
}
637-
638620
AttributeCommonInfo::Kind getKind() const {
639621
return AttributeCommonInfo::Kind(Info.AttrKind);
640622
}

clang/lib/AST/ASTContext.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -928,11 +928,6 @@ static const LangASMap *getAddressSpaceMap(const TargetInfo &T,
928928
5, // cuda_device
929929
6, // cuda_constant
930930
7, // cuda_shared
931-
1, // sycl_global
932-
3, // sycl_local
933-
2, // sycl_constant
934-
0, // sycl_private
935-
4, // sycl_generic
936931
8, // ptr32_sptr
937932
9, // ptr32_uptr
938933
10 // ptr64

clang/lib/AST/TypePrinter.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1808,19 +1808,14 @@ std::string Qualifiers::getAddrSpaceAsString(LangAS AS) {
18081808
case LangAS::Default:
18091809
return "";
18101810
case LangAS::opencl_global:
1811-
case LangAS::sycl_global:
18121811
return "__global";
18131812
case LangAS::opencl_local:
1814-
case LangAS::sycl_local:
18151813
return "__local";
18161814
case LangAS::opencl_private:
1817-
case LangAS::sycl_private:
18181815
return "__private";
18191816
case LangAS::opencl_constant:
1820-
case LangAS::sycl_constant:
18211817
return "__constant";
18221818
case LangAS::opencl_generic:
1823-
case LangAS::sycl_generic:
18241819
return "__generic";
18251820
case LangAS::cuda_device:
18261821
return "__device__";

clang/lib/Basic/Targets/AMDGPU.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ const LangASMap AMDGPUTargetInfo::AMDGPUDefIsGenMap = {
4848
Global, // cuda_device
4949
Constant, // cuda_constant
5050
Local, // cuda_shared
51-
Global, // sycl_global
52-
Local, // sycl_local
53-
Constant, // sycl_constant
54-
Private, // sycl_private
55-
Generic, // sycl_generic
5651
Generic, // ptr32_sptr
5752
Generic, // ptr32_uptr
5853
Generic // ptr64
@@ -68,11 +63,6 @@ const LangASMap AMDGPUTargetInfo::AMDGPUDefIsPrivMap = {
6863
Global, // cuda_device
6964
Constant, // cuda_constant
7065
Local, // cuda_shared
71-
Global, // sycl_global
72-
Local, // sycl_local
73-
Constant, // sycl_constant
74-
Private, // sycl_private
75-
Generic, // sycl_generic
7666
Generic, // ptr32_sptr
7767
Generic, // ptr32_uptr
7868
Generic // ptr64

clang/lib/Basic/Targets/NVPTX.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,6 @@ static const unsigned NVPTXAddrSpaceMap[] = {
3333
1, // cuda_device
3434
4, // cuda_constant
3535
3, // cuda_shared
36-
1, // sycl_global
37-
3, // sycl_local
38-
4, // sycl_constant
39-
0, // sycl_private
40-
// FIXME: generic has to be added to the target
41-
0, // sycl_generic
4236
0, // ptr32_sptr
4337
0, // ptr32_uptr
4438
0 // ptr64

clang/lib/Basic/Targets/SPIR.h

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,6 @@ static const unsigned SPIRAddrSpaceMap[] = {
3333
0, // cuda_device
3434
0, // cuda_constant
3535
0, // cuda_shared
36-
1, // sycl_global
37-
3, // sycl_local
38-
2, // sycl_constant
39-
0, // sycl_private
40-
4, // sycl_generic
4136
0, // ptr32_sptr
4237
0, // ptr32_uptr
4338
0 // ptr64
@@ -53,11 +48,6 @@ static const unsigned SYCLAddrSpaceMap[] = {
5348
0, // cuda_device
5449
0, // cuda_constant
5550
0, // cuda_shared
56-
1, // sycl_global
57-
3, // sycl_local
58-
2, // sycl_constant
59-
0, // sycl_private
60-
4, // sycl_generic
6151
0, // ptr32_sptr
6252
0, // ptr32_uptr
6353
0 // ptr64
@@ -70,11 +60,9 @@ class LLVM_LIBRARY_VISIBILITY SPIRTargetInfo : public TargetInfo {
7060
TLSSupported = false;
7161
VLASupported = false;
7262
LongWidth = LongAlign = 64;
73-
if (Triple.getEnvironment() == llvm::Triple::SYCLDevice) {
74-
AddrSpaceMap = &SYCLAddrSpaceMap;
75-
} else {
76-
AddrSpaceMap = &SPIRAddrSpaceMap;
77-
}
63+
AddrSpaceMap = (Triple.getEnvironment() == llvm::Triple::SYCLDevice)
64+
? &SYCLAddrSpaceMap
65+
: &SPIRAddrSpaceMap;
7866
UseAddrSpaceMapMangling = true;
7967
HasLegalHalfType = true;
8068
HasFloat16 = true;

clang/lib/Basic/Targets/TCE.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@ static const unsigned TCEOpenCLAddrSpaceMap[] = {
4040
0, // cuda_device
4141
0, // cuda_constant
4242
0, // cuda_shared
43-
3, // sycl_global
44-
4, // sycl_local
45-
5, // sycl_constant
46-
0, // sycl_private
47-
// FIXME: generic has to be added to the target
48-
0, // sycl_generic
4943
0, // ptr32_sptr
5044
0, // ptr32_uptr
5145
0, // ptr64

clang/lib/Basic/Targets/X86.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ static const unsigned X86AddrSpaceMap[] = {
3232
0, // cuda_device
3333
0, // cuda_constant
3434
0, // cuda_shared
35-
0, // sycl_global
36-
0, // sycl_local
37-
0, // sycl_constant
38-
0, // sycl_private
39-
0, // sycl_generic
4035
270, // ptr32_sptr
4136
271, // ptr32_uptr
4237
272 // ptr64

clang/lib/Sema/SPIRVBuiltins.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class AddressSpace<string _AS> {
3535
// the one it will be lowered to.
3636
// This file assumes it will get lowered to generic or private.
3737
def DefaultAS : AddressSpace<"clang::LangAS::Default">;
38-
def PrivateAS : AddressSpace<"clang::LangAS::sycl_private">;
39-
def GlobalAS : AddressSpace<"clang::LangAS::sycl_global">;
40-
def ConstantAS : AddressSpace<"clang::LangAS::sycl_constant">;
41-
def LocalAS : AddressSpace<"clang::LangAS::sycl_local">;
42-
def GenericAS : AddressSpace<"clang::LangAS::sycl_generic">;
38+
def PrivateAS : AddressSpace<"clang::LangAS::opencl_private">;
39+
def GlobalAS : AddressSpace<"clang::LangAS::opencl_global">;
40+
def ConstantAS : AddressSpace<"clang::LangAS::opencl_constant">;
41+
def LocalAS : AddressSpace<"clang::LangAS::opencl_local">;
42+
def GenericAS : AddressSpace<"clang::LangAS::opencl_generic">;
4343

4444
// TODO: Manage capabilities. Unused for now.
4545
class AbstractExtension<string _Ext> {

clang/lib/Sema/SemaType.cpp

Lines changed: 3 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6118,35 +6118,14 @@ static bool BuildAddressSpaceIndex(Sema &S, LangAS &ASIdx,
61186118
llvm::APSInt max(addrSpace.getBitWidth());
61196119
max =
61206120
Qualifiers::MaxAddressSpace - (unsigned)LangAS::FirstTargetAddressSpace;
6121-
61226121
if (addrSpace > max) {
61236122
S.Diag(AttrLoc, diag::err_attribute_address_space_too_high)
61246123
<< (unsigned)max.getZExtValue() << AddrSpace->getSourceRange();
61256124
return false;
61266125
}
61276126

6128-
if (S.LangOpts.SYCLIsDevice && (addrSpace >= 4)) {
6129-
S.Diag(AttrLoc, diag::err_sycl_attribute_address_space_invalid)
6130-
<< AddrSpace->getSourceRange();
6131-
return false;
6132-
}
6133-
6134-
ASIdx = getLangASFromTargetAS(
6135-
static_cast<unsigned>(addrSpace.getZExtValue()));
6136-
6137-
if (S.LangOpts.SYCLIsDevice) {
6138-
ASIdx =
6139-
[](unsigned AS) {
6140-
switch (AS) {
6141-
case 0: return LangAS::sycl_private;
6142-
case 1: return LangAS::sycl_global;
6143-
case 2: return LangAS::sycl_constant;
6144-
case 3: return LangAS::sycl_local;
6145-
case 4: default: llvm_unreachable("Invalid SYCL AS");
6146-
}
6147-
}(static_cast<unsigned>(ASIdx) -
6148-
static_cast<unsigned>(LangAS::FirstTargetAddressSpace));
6149-
}
6127+
ASIdx =
6128+
getLangASFromTargetAS(static_cast<unsigned>(addrSpace.getZExtValue()));
61506129
return true;
61516130
}
61526131

@@ -6272,8 +6251,7 @@ static void HandleAddressSpaceTypeAttribute(QualType &Type,
62726251
Attr.setInvalid();
62736252
} else {
62746253
// The keyword-based type attributes imply which address space to use.
6275-
ASIdx = S.getLangOpts().SYCLIsDevice ?
6276-
Attr.asSYCLLangAS() : Attr.asOpenCLLangAS();
6254+
ASIdx = Attr.asOpenCLLangAS();
62776255
if (ASIdx == LangAS::Default)
62786256
llvm_unreachable("Invalid address space");
62796257

clang/test/CodeGenSYCL/address-space-parameter-conversions.cpp

Lines changed: 2 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void foo(int * Data) {}
99
// CHECK-DAG: define spir_func void @[[RAW_PTR:[a-zA-Z0-9_]+]](i32 addrspace(4)* %
1010
void foo2(int * Data) {}
1111
// CHECK-DAG: define spir_func void @[[RAW_PTR2:[a-zA-Z0-9_]+]](i32 addrspace(4)* %
12-
void foo(__attribute__((address_space(3))) int * Data) {}
12+
void foo(__attribute__((opencl_local)) int *Data) {}
1313
// CHECK-DAG: define spir_func void [[LOC_PTR:@[a-zA-Z0-9_]+]](i32 addrspace(3)* %
1414

1515
template<typename T>
@@ -18,12 +18,11 @@ void tmpl(T t){}
1818

1919
void usages() {
2020
// CHECK-DAG: [[GLOB:%[a-zA-Z0-9]+]] = alloca i32 addrspace(1)*
21-
__attribute__((address_space(1))) int *GLOB;
21+
__attribute__((opencl_global)) int *GLOB;
2222
// CHECK-DAG: [[LOC:%[a-zA-Z0-9]+]] = alloca i32 addrspace(3)*
2323
__attribute__((opencl_local)) int *LOC;
2424
// CHECK-DAG: [[NoAS:%[a-zA-Z0-9]+]] = alloca i32 addrspace(4)*
2525
int *NoAS;
26-
2726
// CHECK-DAG: [[PRIV:%[a-zA-Z0-9]+]] = alloca i32*
2827
__attribute__((opencl_private)) int *PRIV;
2928

@@ -94,57 +93,23 @@ void usages() {
9493
// CHECK-DAG: define linkonce_odr spir_func void [[GEN_TMPL]](i32 addrspace(4)* %
9594

9695
void usages2() {
97-
__attribute__((address_space(0))) int *PRIV_NUM;
98-
// CHECK-DAG: [[PRIV_NUM:%[a-zA-Z0-9_]+]] = alloca i32*
99-
__attribute__((address_space(0))) int *PRIV_NUM2;
100-
// CHECK-DAG: [[PRIV_NUM2:%[a-zA-Z0-9_]+]] = alloca i32*
10196
__attribute__((opencl_private)) int *PRIV;
10297
// CHECK-DAG: [[PRIV:%[a-zA-Z0-9_]+]] = alloca i32*
103-
__attribute__((address_space(1))) int *GLOB_NUM;
104-
// CHECK-DAG: [[GLOB_NUM:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(1)*
10598
__attribute__((opencl_global)) int *GLOB;
10699
// CHECK-DAG: [[GLOB:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(1)*
107-
__attribute__((address_space(2))) int *CONST_NUM;
108-
// CHECK-DAG: [[CONST_NUM:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(2)*
109100
__attribute__((opencl_constant)) int *CONST;
110101
// CHECK-DAG: [[CONST:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(2)*
111-
__attribute__((address_space(3))) int *LOCAL_NUM;
112-
// CHECK-DAG: [[LOCAL_NUM:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(3)*
113102
__attribute__((opencl_local)) int *LOCAL;
114103
// CHECK-DAG: [[LOCAL:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(3)*
115104

116-
bar(*PRIV_NUM);
117-
// CHECK-DAG: [[PRIV_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32*, i32** [[PRIV_NUM]]
118-
// CHECK-DAG: [[PRIV_NUM_ASCAST:%[a-zA-Z0-9]+]] = addrspacecast i32* [[PRIV_NUM_LOAD]] to i32 addrspace(4)*
119-
// CHECK-DAG: call spir_func void @[[RAW_REF]](i32 addrspace(4)* dereferenceable(4) [[PRIV_NUM_ASCAST]])
120-
bar(*PRIV_NUM2);
121-
// CHECK-DAG: [[PRIV_NUM2_LOAD:%[a-zA-Z0-9]+]] = load i32*, i32** [[PRIV_NUM2]]
122-
// CHECK-DAG: [[PRIV_NUM2_ASCAST:%[a-zA-Z0-9]+]] = addrspacecast i32* [[PRIV_NUM2_LOAD]] to i32 addrspace(4)*
123-
// CHECK-DAG: call spir_func void @[[RAW_REF]](i32 addrspace(4)* dereferenceable(4) [[PRIV_NUM2_ASCAST]])
124105
bar(*PRIV);
125106
// CHECK-DAG: [[PRIV_LOAD:%[a-zA-Z0-9]+]] = load i32*, i32** [[PRIV]]
126107
// CHECK-DAG: [[PRIV_ASCAST:%[a-zA-Z0-9]+]] = addrspacecast i32* [[PRIV_LOAD]] to i32 addrspace(4)*
127108
// CHECK-DAG: call spir_func void @[[RAW_REF]](i32 addrspace(4)* dereferenceable(4) [[PRIV_ASCAST]])
128-
bar(*GLOB_NUM);
129-
// CHECK-DAG: [[GLOB_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB_NUM]]
130-
// CHECK-DAG: [[GLOB_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_NUM_LOAD]] to i32 addrspace(4)*
131-
// CHECK-DAG: call spir_func void @[[RAW_REF]](i32 addrspace(4)* dereferenceable(4) [[GLOB_NUM_CAST]])
132109
bar(*GLOB);
133110
// CHECK-DAG: [[GLOB_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB]]
134111
// CHECK-DAG: [[GLOB_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(1)* [[GLOB_LOAD]] to i32 addrspace(4)*
135112
// CHECK-DAG: call spir_func void @[[RAW_REF]](i32 addrspace(4)* dereferenceable(4) [[GLOB_CAST]])
136-
bar(*CONST_NUM);
137-
// CHECK-DAG: [[CONST_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(2)*, i32 addrspace(2)** [[CONST_NUM]]
138-
// CHECK-DAG: [[CONST_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(2)* [[CONST_NUM_LOAD]] to i32 addrspace(4)*
139-
// CHECK-DAG: call spir_func void @[[RAW_REF]](i32 addrspace(4)* dereferenceable(4) [[CONST_NUM_CAST]])
140-
bar(*CONST);
141-
// CHECK-DAG: [[CONST_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(2)*, i32 addrspace(2)** [[CONST]]
142-
// CHECK-DAG: [[CONST_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(2)* [[CONST_LOAD]] to i32 addrspace(4)*
143-
// CHECK-DAG: call spir_func void @[[RAW_REF]](i32 addrspace(4)* dereferenceable(4) [[CONST_CAST]])
144-
bar2(*LOCAL_NUM);
145-
// CHECK-DAG: [[LOCAL_NUM_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(3)*, i32 addrspace(3)** [[LOCAL_NUM]]
146-
// CHECK-DAG: [[LOCAL_NUM_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOCAL_NUM_LOAD]] to i32 addrspace(4)*
147-
// CHECK-DAG: call spir_func void @[[RAW_REF2]](i32 addrspace(4)* dereferenceable(4) [[LOCAL_NUM_CAST]])
148113
bar2(*LOCAL);
149114
// CHECK-DAG: [[LOCAL_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(3)*, i32 addrspace(3)** [[LOCAL]]
150115
// CHECK-DAG: [[LOCAL_CAST:%[a-zA-Z0-9]+]] = addrspacecast i32 addrspace(3)* [[LOCAL_LOAD]] to i32 addrspace(4)*

clang/test/SemaOpenCLCXX/address-space-lambda.cl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,10 @@ __kernel void test_qual() {
3131
//CHECK: |-CXXMethodDecl {{.*}} constexpr operator() 'void () {{.*}}const __generic'
3232
auto priv2 = []() __generic {};
3333
priv2();
34-
auto priv3 = []() __global {}; //expected-note{{candidate function not viable: 'this' object is in address space '__private', but method expects object in address space '__global'}} //expected-note{{conversion candidate of type 'void (*)()'}}
35-
priv3(); //expected-error{{no matching function for call to object of type}}
34+
// This test case is disabled due to
35+
// https://bugs.llvm.org/show_bug.cgi?id=45472
36+
auto priv3 = []() __global {}; //ex pected-note{{candidate function not viable: 'this' object is in address space '__private', but method expects object in address space '__global'}} //ex pected-note{{conversion candidate of type 'void (*)()'}}
37+
priv3(); //ex pected-error{{no matching function for call to object of type}}
3638

3739
__constant auto const1 = []() __private{}; //expected-note{{candidate function not viable: 'this' object is in address space '__constant', but method expects object in address space '__private'}} //expected-note{{conversion candidate of type 'void (*)()'}}
3840
const1(); //expected-error{{no matching function for call to object of type '__constant (lambda at}}

clang/test/SemaSYCL/address-space-parameter-conversions.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ void tmpl(T *t){}
1313
void usages() {
1414
__attribute__((opencl_global)) int *GLOB;
1515
__attribute__((opencl_private)) int *PRIV;
16-
__attribute__((address_space(3))) int *LOC;
16+
__attribute__((opencl_local)) int *LOC;
1717
int *NoAS;
1818

1919
bar(*GLOB);
@@ -53,10 +53,6 @@ void usages() {
5353

5454
// expected-error@+1{{address space is negative}}
5555
__attribute__((address_space(-1))) int *TooLow;
56-
// expected-error@+1{{address space is outside the valid range of values}}
57-
__attribute__((address_space(6))) int *TooHigh;
58-
// expected-error@+1{{address space is outside the valid range of values}}
59-
__attribute__((address_space(4))) int *TriedGeneric;
6056
// expected-error@+1{{unknown type name '__generic'}}
6157
__generic int *IsGeneric;
6258

clang/test/SemaSYCL/intel-fpga-local.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ void attr_on_func_arg([[intelfpga::private_copies(8)]] int pc) {}
551551

552552
//expected-error@+1{{attribute only applies to constant variables, local variables, static variables, slave memory arguments, and non-static data members}}
553553
[[intelfpga::force_pow2_depth(0)]]
554-
__attribute__((opencl_constant)) unsigned int ocl_const_force_p2d[64] = {1, 2, 3};
554+
__attribute__((opencl_global)) unsigned int ocl_glob_force_p2d[64] = {1, 2, 3};
555555

556556
//expected-no-error@+1
557557
void force_p2d_attr_on_func_arg([[intelfpga::force_pow2_depth(0)]] int pc) {}

0 commit comments

Comments
 (0)