Skip to content

[SYCL] Disable double underscore AS keywords #358

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
Jul 23, 2019
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
8 changes: 4 additions & 4 deletions clang/include/clang/Basic/TokenKinds.def
Original file line number Diff line number Diff line change
Expand Up @@ -541,10 +541,10 @@ KEYWORD(__unaligned , KEYMS)
KEYWORD(__super , KEYMS)

// OpenCL address space qualifiers
KEYWORD(__global , KEYOPENCLC | KEYOPENCLCXX | KEYSYCL)
KEYWORD(__local , KEYOPENCLC | KEYOPENCLCXX | KEYSYCL)
KEYWORD(__constant , KEYOPENCLC | KEYOPENCLCXX | KEYSYCL)
KEYWORD(__private , KEYOPENCLC | KEYOPENCLCXX | KEYSYCL)
KEYWORD(__global , KEYOPENCLC | KEYOPENCLCXX)
KEYWORD(__local , KEYOPENCLC | KEYOPENCLCXX)
KEYWORD(__constant , KEYOPENCLC | KEYOPENCLCXX)
KEYWORD(__private , KEYOPENCLC | KEYOPENCLCXX)
KEYWORD(__generic , KEYOPENCLC | KEYOPENCLCXX)
ALIAS("global", __global , KEYOPENCLC | KEYOPENCLCXX)
ALIAS("local", __local , KEYOPENCLC | KEYOPENCLCXX)
Expand Down
6 changes: 1 addition & 5 deletions clang/test/CodeGenSYCL/Inputs/sycl.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
#pragma once

#ifndef __SYCL_DEVICE_ONLY__
#define __global
#endif

#define ATTR_SYCL_KERNEL __attribute__((sycl_kernel))

// Dummy runtime classes to model SYCL API.
Expand Down Expand Up @@ -137,7 +133,7 @@ class accessor {
_ImplT<dimensions> impl;

private:
void __init(__global dataT *Ptr, range<dimensions> AccessRange,
void __init(__attribute__((ocl_global)) dataT *Ptr, range<dimensions> AccessRange,
range<dimensions> MemRange, id<dimensions> Offset) {}
};

Expand Down
14 changes: 7 additions & 7 deletions clang/test/CodeGenSYCL/address-space-parameter-conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ void bar(int & Data) {}
void bar2(int & Data) {}
// CHECK-OLD-DAG: define spir_func void @[[RAW_REF2:[a-zA-Z0-9_]+]](i32* dereferenceable(4) %
// CHECK-NEW-DAG: define spir_func void @[[RAW_REF2:[a-zA-Z0-9_]+]](i32 addrspace(4)* dereferenceable(4) %
void bar(__local int &Data) {}
void bar(__attribute__((ocl_local)) int &Data) {}
// CHECK-DAG: define spir_func void [[LOC_REF:@[a-zA-Z0-9_]+]](i32 addrspace(3)* dereferenceable(4) %
void foo(int * Data) {}
// CHECK-OLD-DAG: define spir_func void @[[RAW_PTR:[a-zA-Z0-9_]+]](i32* %
Expand All @@ -25,13 +25,13 @@ void usages() {
// CHECK-DAG: [[GLOB:%[a-zA-Z0-9]+]] = alloca i32 addrspace(1)*
__attribute__((address_space(1))) int *GLOB;
// CHECK-DAG: [[LOC:%[a-zA-Z0-9]+]] = alloca i32 addrspace(3)*
__local int *LOC;
__attribute__((ocl_local)) int *LOC;
// CHECK-OLD-DAG: [[NoAS:%[a-zA-Z0-9]+]] = alloca i32*
// CHECK-NEW-DAG: [[NoAS:%[a-zA-Z0-9]+]] = alloca i32 addrspace(4)*
int *NoAS;

// CHECK-DAG: [[PRIV:%[a-zA-Z0-9]+]] = alloca i32*
__private int *PRIV;
__attribute__((ocl_private)) int *PRIV;

bar(*GLOB);
// CHECK-DAG: [[GLOB_LOAD:%[a-zA-Z0-9]+]] = load i32 addrspace(1)*, i32 addrspace(1)** [[GLOB]]
Expand Down Expand Up @@ -121,19 +121,19 @@ void usages2() {
// CHECK-DAG: [[PRIV_NUM:%[a-zA-Z0-9_]+]] = alloca i32*
__attribute__((address_space(0))) int *PRIV_NUM2;
// CHECK-DAG: [[PRIV_NUM2:%[a-zA-Z0-9_]+]] = alloca i32*
__private int *PRIV;
__attribute__((ocl_private)) int *PRIV;
// CHECK-DAG: [[PRIV:%[a-zA-Z0-9_]+]] = alloca i32*
__attribute__((address_space(1))) int *GLOB_NUM;
// CHECK-DAG: [[GLOB_NUM:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(1)*
__global int *GLOB;
__attribute__((ocl_global)) int *GLOB;
// CHECK-DAG: [[GLOB:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(1)*
__attribute__((address_space(2))) int *CONST_NUM;
// CHECK-DAG: [[CONST_NUM:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(2)*
__constant int *CONST;
__attribute__((ocl_constant)) int *CONST;
// CHECK-DAG: [[CONST:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(2)*
__attribute__((address_space(3))) int *LOCAL_NUM;
// CHECK-DAG: [[LOCAL_NUM:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(3)*
__local int *LOCAL;
__attribute__((ocl_local)) int *LOCAL;
// CHECK-DAG: [[LOCAL:%[a-zA-Z0-9_]+]] = alloca i32 addrspace(3)*

bar(*PRIV_NUM);
Expand Down
10 changes: 3 additions & 7 deletions clang/test/SemaSYCL/Inputs/sycl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@

// Shared code for SYCL tests

#ifndef __SYCL_DEVICE_ONLY__
#define __global
#endif

namespace cl {
namespace sycl {
namespace access {
Expand Down Expand Up @@ -61,17 +57,17 @@ struct DeviceValueType;

template <typename dataT>
struct DeviceValueType<dataT, access::target::global_buffer> {
using type = __global dataT;
using type = __attribute__((ocl_global)) dataT;
};

template <typename dataT>
struct DeviceValueType<dataT, access::target::constant_buffer> {
using type = __constant dataT;
using type = __attribute__((ocl_constant)) dataT;
};

template <typename dataT>
struct DeviceValueType<dataT, access::target::local> {
using type = __local dataT;
using type = __attribute__((ocl_local)) dataT;
};

template <typename dataT, int dimensions, access::mode accessmode,
Expand Down
8 changes: 4 additions & 4 deletions clang/test/SemaSYCL/address-space-parameter-conversions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

void bar(int & Data) {}
void bar2(int & Data) {}
void bar(__private int & Data) {}
void bar(__attribute__((ocl_private)) int & Data) {}
void foo(int * Data) {}
void foo2(int * Data) {}
void foo(__private int * Data) {}
void foo(__attribute__((ocl_private)) int * Data) {}

template<typename T>
void tmpl(T *t){}

void usages() {
__global int *GLOB;
__private int *PRIV;
__attribute__((ocl_global)) int *GLOB;
__attribute__((ocl_private)) int *PRIV;
__attribute__((address_space(3))) int *LOC;
int *NoAS;

Expand Down
2 changes: 1 addition & 1 deletion clang/test/SemaSYCL/intel-fpga-local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ void foo1()

//expected-error@+1{{attribute only applies to local non-const variables and non-static data members}}
[[intelfpga::max_private_copies(8)]]
__constant unsigned int ext_two[64] = { 1, 2, 3 };
__attribute__((ocl_constant)) unsigned int ext_two[64] = { 1, 2, 3 };

void other2()
{
Expand Down