File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -4823,6 +4823,8 @@ DeviceFunctionDecl::DeviceFunctionDecl(
4823
4823
FuncInfo(getFuncInfo(FD)) {
4824
4824
if (FD->isFunctionTemplateSpecialization ()) {
4825
4825
SourceRange ReturnTypeRange = FD->getReturnTypeSourceRange ();
4826
+ ReturnTypeRange = clang::dpct::getDefinitionRange (
4827
+ ReturnTypeRange.getBegin (), ReturnTypeRange.getEnd ());
4826
4828
OffsetForAttr =
4827
4829
DpctGlobalInfo::getLocInfo (ReturnTypeRange.getBegin ()).second ;
4828
4830
}
@@ -4859,6 +4861,11 @@ DeviceFunctionDecl::DeviceFunctionDecl(
4859
4861
FuncInfo(getFuncInfo(Specialization)) {
4860
4862
IsDefFilePathNeeded = false ;
4861
4863
4864
+ auto ReturnLoc = FTL.getReturnLoc ();
4865
+ auto ReturnRange = clang::dpct::getDefinitionRange (ReturnLoc.getBeginLoc (),
4866
+ ReturnLoc.getEndLoc ());
4867
+ OffsetForAttr = DpctGlobalInfo::getLocInfo (ReturnRange.getBegin ()).second ;
4868
+
4862
4869
buildReplaceLocInfo (FTL, Attrs);
4863
4870
buildTextureObjectParamsInfo (FTL.getParams ());
4864
4871
if (Specialization->hasAttr <CUDAGlobalAttr>()) {
Original file line number Diff line number Diff line change @@ -10,6 +10,15 @@ __global__ void Reset_kernel_parameters(void)
10
10
g_mutex=0 ;
11
11
}
12
12
13
+ // CHECK: template <typename T> SYCL_EXTERNAL void template_test(T v) {};
14
+ // CHECK: #define FUNC(T) template SYCL_EXTERNAL void template_test<T>(T v);
15
+ // CHECK: FUNC(int)
16
+ template <typename T> __global__ void template_test (T v) {};
17
+
18
+ #define FUNC (T ) template __global__ void template_test<T>(T v);
19
+
20
+ FUNC (int )
21
+
13
22
// CHECK: SYCL_EXTERNAL void kernel_extern(const sycl::nd_item<3> &item_ct1, int *a) {
14
23
__global__ void kernel_extern() {
15
24
__shared__ int a[360 ];
Original file line number Diff line number Diff line change 5
5
// CHECK: SYCL_EXTERNAL void Reset_kernel_parameters(volatile int &g_mutex);
6
6
__global__ void Reset_kernel_parameters (void );
7
7
8
+ // CHECK: template <typename T> SYCL_EXTERNAL void template_test(T v);
9
+ template <typename T> __global__ void template_test (T v);
10
+
8
11
// CHECK: SYCL_EXTERNAL void test_foo();
9
12
__device__ void test_foo (void );
10
13
Original file line number Diff line number Diff line change @@ -77,6 +77,9 @@ void test() {
77
77
// CHECK-NEXT: });
78
78
// CHECK-NEXT: }
79
79
test_fp<<<1 , 1 >>> ();
80
+
81
+ template_test<int ><<<1 , 1 >>> (0 );
82
+
80
83
}
81
84
82
85
You can’t perform that action at this time.
0 commit comments