File tree Expand file tree Collapse file tree 13 files changed +78
-45
lines changed
sycl/test-e2e/DeviceDependencies Expand file tree Collapse file tree 13 files changed +78
-45
lines changed Original file line number Diff line number Diff line change @@ -12372,7 +12372,6 @@ def err_sycl_restrict : Error<
12372
12372
"|call through a function pointer"
12373
12373
"|allocate storage"
12374
12374
"|use inline assembly"
12375
- "|call a dllimport function"
12376
12375
"|call a variadic function"
12377
12376
"|call an undefined function without SYCL_EXTERNAL attribute"
12378
12377
"|use a const static or global variable that is neither zero-initialized "
Original file line number Diff line number Diff line change @@ -308,7 +308,6 @@ class SemaSYCL : public SemaBase {
308
308
KernelCallFunctionPointer,
309
309
KernelAllocateStorage,
310
310
KernelUseAssembly,
311
- KernelCallDllimportFunction,
312
311
KernelCallVariadicFunction,
313
312
KernelCallUndefinedFunction,
314
313
KernelConstStaticVariable
Original file line number Diff line number Diff line change @@ -598,18 +598,6 @@ class DiagDeviceFunction : public RecursiveASTVisitor<DiagDeviceFunction> {
598
598
<< SemaSYCL::KernelCallRecursiveFunction;
599
599
}
600
600
601
- if (auto const *FD = dyn_cast<FunctionDecl>(Callee)) {
602
- // FIXME: We need check all target specified attributes for error if
603
- // that function with attribute can not be called from sycl kernel. The
604
- // info is in ParsedAttr. We don't have to map from Attr to ParsedAttr
605
- // currently. Erich is currently working on that in LLVM, once that is
606
- // committed we need to change this".
607
- if (FD->hasAttr <DLLImportAttr>()) {
608
- SemaSYCLRef.Diag (e->getExprLoc (), diag::err_sycl_restrict)
609
- << SemaSYCL::KernelCallDllimportFunction;
610
- SemaSYCLRef.Diag (FD->getLocation (), diag::note_callee_decl) << FD;
611
- }
612
- }
613
601
// Specifically check if the math library function corresponding to this
614
602
// builtin is supported for SYCL
615
603
unsigned BuiltinID = Callee->getBuiltinID ();
Original file line number Diff line number Diff line change @@ -36,14 +36,13 @@ int zoo() __attribute__((dllimport));
36
36
37
37
#else
38
38
39
- // emit error if dllimport function is called in sycl kernel
40
39
int __declspec (dllexport) foo(int a) {
41
40
return a;
42
41
}
43
- // expected-note@+1 {{'bar' declared here}}
42
+
44
43
SYCL_EXTERNAL int __declspec (dllimport) bar();
45
44
// expected-note@+1 {{previous declaration is here}}
46
- int __declspec (dllimport) foobar(); // expected-note {{'foobar' declared here}}
45
+ int __declspec (dllimport) foobar();
47
46
int foobar () // expected-warning {{'foobar' redeclared without 'dllimport' attribute: 'dllexport' attribute added}}
48
47
{
49
48
return 10 ;
@@ -59,8 +58,8 @@ int main() {
59
58
bar (); // expected-no-error
60
59
kernel_single_task<class fake_kernel >([]() {
61
60
foo (10 );// expected-no-error
62
- bar (); // expected-error {{SYCL kernel cannot call a dllimport function}}
63
- foobar (); // expected-error {{SYCL kernel cannot call a dllimport function}}
61
+ bar ();
62
+ foobar ();
64
63
});
65
64
bar (); // expected-no-error
66
65
return 0 ;
Original file line number Diff line number Diff line change 1
- #include < iostream >
1
+ #define A_EXPORT
2
2
#include " a.hpp"
3
3
#include " b.hpp"
4
+ #include < iostream>
4
5
5
- SYCL_EXTERNAL int levelA (int val) {
6
+ A_DECLSPEC SYCL_EXTERNAL int levelA (int val) {
6
7
#ifndef __SYCL_DEVICE_ONLY__
7
8
std::cerr << " Host symbol used" << std::endl;
8
- return 0 ;
9
+ val ^= 0x1234 ;
9
10
#endif
10
11
val=levelB (val);
11
12
return val|=(0xA <<0 );
12
13
}
13
-
Original file line number Diff line number Diff line change 1
1
#include < sycl/detail/core.hpp>
2
2
3
- SYCL_EXTERNAL int levelA (int val);
3
+ #if defined(MAKE_DLL)
4
+ #ifdef A_EXPORT
5
+ #define A_DECLSPEC __declspec (dllexport)
6
+ #else
7
+ #define A_DECLSPEC __declspec (dllimport)
8
+ #endif
9
+ #else
10
+ #define A_DECLSPEC
11
+ #endif
12
+
13
+ A_DECLSPEC SYCL_EXTERNAL int levelA (int val);
Original file line number Diff line number Diff line change 1
- #include < iostream >
1
+ #define B_EXPORT
2
2
#include " b.hpp"
3
3
#include " c.hpp"
4
+ #include < iostream>
4
5
5
- SYCL_EXTERNAL int levelB (int val) {
6
+ B_DECLSPEC SYCL_EXTERNAL int levelB (int val) {
6
7
#ifndef __SYCL_DEVICE_ONLY__
7
8
std::cerr << " Host symbol used" << std::endl;
8
- return 0 ;
9
+ val ^= 0x2345 ;
9
10
#endif
10
11
val=levelC (val);
11
12
return val|=(0xB <<4 );
12
13
}
13
-
Original file line number Diff line number Diff line change 1
1
#include < sycl/detail/core.hpp>
2
2
3
- SYCL_EXTERNAL int levelB (int val);
3
+ #if defined(MAKE_DLL)
4
+ #ifdef B_EXPORT
5
+ #define B_DECLSPEC __declspec (dllexport)
6
+ #else
7
+ #define B_DECLSPEC __declspec (dllimport)
8
+ #endif
9
+ #else
10
+ #define B_DECLSPEC
11
+ #endif
12
+
13
+ B_DECLSPEC SYCL_EXTERNAL int levelB (int val);
Original file line number Diff line number Diff line change 1
- #include < iostream >
1
+ #define C_EXPORT
2
2
#include " c.hpp"
3
3
#include " d.hpp"
4
+ #include < iostream>
4
5
5
- SYCL_EXTERNAL int levelC (int val) {
6
+ C_DECLSPEC SYCL_EXTERNAL int levelC (int val) {
6
7
#ifndef __SYCL_DEVICE_ONLY__
7
8
std::cerr << " Host symbol used" << std::endl;
8
- return 0 ;
9
+ val ^= 0x3456 ;
9
10
#endif
10
11
val=levelD (val);
11
12
return val|=(0xC <<8 );
12
13
}
13
-
Original file line number Diff line number Diff line change 1
1
#include < sycl/detail/core.hpp>
2
2
3
- SYCL_EXTERNAL int levelC (int val);
3
+ #if defined(MAKE_DLL)
4
+ #ifdef C_EXPORT
5
+ #define C_DECLSPEC __declspec (dllexport)
6
+ #else
7
+ #define C_DECLSPEC __declspec (dllimport)
8
+ #endif
9
+ #else
10
+ #define C_DECLSPEC
11
+ #endif
12
+
13
+ C_DECLSPEC SYCL_EXTERNAL int levelC (int val);
You can’t perform that action at this time.
0 commit comments