2021-03-17 20:26:07 +08:00
|
|
|
// RUN: %clang_cc1 -triple spir64 -fsycl-is-device -verify -fsyntax-only %s
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsycl-is-device -fsyntax-only %s
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
|
|
|
|
typedef __float128 BIGTY;
|
|
|
|
|
|
|
|
template <class T>
|
|
|
|
class Z {
|
|
|
|
public:
|
|
|
|
// expected-note@+1 {{'field' defined here}}
|
|
|
|
T field;
|
|
|
|
// expected-note@+1 2{{'field1' defined here}}
|
|
|
|
__float128 field1;
|
|
|
|
using BIGTYPE = __float128;
|
|
|
|
// expected-note@+1 {{'bigfield' defined here}}
|
|
|
|
BIGTYPE bigfield;
|
|
|
|
};
|
|
|
|
|
|
|
|
void host_ok(void) {
|
|
|
|
__float128 A;
|
|
|
|
int B = sizeof(__float128);
|
|
|
|
Z<__float128> C;
|
|
|
|
C.field1 = A;
|
|
|
|
}
|
|
|
|
|
2021-11-03 17:08:39 +08:00
|
|
|
long double ld_func(long double arg);
|
|
|
|
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
void usage() {
|
|
|
|
// expected-note@+1 3{{'A' defined here}}
|
|
|
|
__float128 A;
|
|
|
|
Z<__float128> C;
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+3 2{{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
|
|
|
// expected-error@+2 {{'A' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
|
|
|
// expected-error@+1 {{'field1' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
C.field1 = A;
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+2 {{expression requires 128 bit size 'Z::BIGTYPE' (aka '__float128') type support, but target 'spir64' does not support it}}
|
|
|
|
// expected-error@+1 {{'bigfield' requires 128 bit size 'Z::BIGTYPE' (aka '__float128') type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
C.bigfield += 1.0;
|
|
|
|
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+1 {{'A' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
auto foo1 = [=]() {
|
|
|
|
__float128 AA;
|
|
|
|
// expected-note@+2 {{'BB' defined here}}
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+1 {{'A' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
auto BB = A;
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+2 {{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
|
|
|
// expected-error@+1 {{'BB' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
BB += 1;
|
2021-03-11 01:23:41 +08:00
|
|
|
|
|
|
|
float F1 = 0.1f;
|
|
|
|
float F2 = 0.1f;
|
|
|
|
// expected-error@+1 3{{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
|
|
|
float F3 = ((__float128)F1 * (__float128)F2) / 2.0f;
|
2021-11-03 17:08:39 +08:00
|
|
|
|
|
|
|
// assume that long double is supported
|
|
|
|
float F4 = ld_func(F3);
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// expected-note@+1 {{called by 'usage'}}
|
|
|
|
foo1();
|
|
|
|
}
|
|
|
|
|
|
|
|
template <typename t>
|
|
|
|
void foo2(){};
|
|
|
|
|
|
|
|
// expected-note@+3 {{'P' defined here}}
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+2 {{'P' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
// expected-note@+1 2{{'foo' defined here}}
|
|
|
|
__float128 foo(__float128 P) { return P; }
|
|
|
|
|
|
|
|
template <typename Name, typename Func>
|
|
|
|
__attribute__((sycl_kernel)) void kernel(Func kernelFunc) {
|
|
|
|
// expected-note@+1 5{{called by 'kernel}}
|
|
|
|
kernelFunc();
|
|
|
|
}
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
// expected-note@+1 {{'CapturedToDevice' defined here}}
|
|
|
|
__float128 CapturedToDevice = 1;
|
|
|
|
host_ok();
|
|
|
|
kernel<class variables>([=]() {
|
|
|
|
decltype(CapturedToDevice) D;
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+1 {{'CapturedToDevice' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
auto C = CapturedToDevice;
|
|
|
|
Z<__float128> S;
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+2 {{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
|
|
|
// expected-error@+1 {{'field1' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
S.field1 += 1;
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+2 {{expression requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
|
|
|
// expected-error@+1 {{'field' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
S.field = 1;
|
|
|
|
});
|
|
|
|
|
|
|
|
kernel<class functions>([=]() {
|
|
|
|
// expected-note@+1 2{{called by 'operator()'}}
|
|
|
|
usage();
|
|
|
|
// expected-note@+1 {{'BBBB' defined here}}
|
|
|
|
BIGTY BBBB;
|
|
|
|
// expected-note@+3 {{called by 'operator()'}}
|
2021-03-11 01:23:41 +08:00
|
|
|
// expected-error@+2 {{'BBBB' requires 128 bit size 'BIGTY' (aka '__float128') type support, but target 'spir64' does not support it}}
|
|
|
|
// expected-error@+1 2{{'foo' requires 128 bit size '__float128' type support, but target 'spir64' does not support it}}
|
[OpenMP][SYCL] Improve diagnosing of unsupported types usage
Summary:
Diagnostic is emitted if some declaration of unsupported type
declaration is used inside device code.
Memcpy operations for structs containing member with unsupported type
are allowed. Fixed crash on attempt to emit diagnostic outside of the
functions.
The approach is generalized between SYCL and OpenMP.
CUDA/OMP deferred diagnostic interface is going to be used for SYCL device.
Reviewers: rsmith, rjmccall, ABataev, erichkeane, bader, jdoerfert, aaron.ballman
Reviewed By: jdoerfert
Subscribers: guansong, sstefan1, yaxunl, mgorny, bader, ebevhan, Anastasia, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D74387
2020-05-29 20:41:37 +08:00
|
|
|
auto A = foo(BBBB);
|
|
|
|
});
|
|
|
|
|
|
|
|
kernel<class ok>([=]() {
|
|
|
|
Z<__float128> S;
|
|
|
|
foo2<__float128>();
|
|
|
|
auto A = sizeof(CapturedToDevice);
|
|
|
|
});
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|