File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -2947,7 +2947,7 @@ void MemVarInfo::migrateToDeviceGlobal(const VarDecl *MemVar) {
2947
2947
auto &Ctx = DpctGlobalInfo::getContext ();
2948
2948
auto &MacroArgMap = DpctGlobalInfo::getMacroArgRecordMap ();
2949
2949
auto TSI = MemVar->getTypeSourceInfo ();
2950
- auto OriginTL = TSI->getTypeLoc ();
2950
+ auto OriginTL = TSI->getTypeLoc (). getUnqualifiedLoc (). getAs <TypeLoc>() ;
2951
2951
auto TL = OriginTL;
2952
2952
auto BegLoc = MemVar->getBeginLoc ();
2953
2953
if (BegLoc.isMacroID ()) {
Original file line number Diff line number Diff line change @@ -809,7 +809,6 @@ void MemVarAnalysisRule::runRule(const MatchFinder::MatchResult &Result) {
809
809
auto MemVarRef = getNodeAsType<DeclRefExpr>(Result, " used" );
810
810
auto Func = getAssistNodeAsType<FunctionDecl>(Result, " func" );
811
811
auto Decl = getAssistNodeAsType<VarDecl>(Result, " decl" );
812
- DpctGlobalInfo &Global = DpctGlobalInfo::getInstance ();
813
812
if (MemVarRef && Func && Decl) {
814
813
if (isCubVar (Decl)) {
815
814
return ;
@@ -820,8 +819,11 @@ void MemVarAnalysisRule::runRule(const MatchFinder::MatchResult &Result) {
820
819
return ;
821
820
if (VD == nullptr )
822
821
return ;
823
-
824
- auto Var = Global.findMemVarInfo (VD);
822
+ std::string CanonicalType = VD->getType ().getCanonicalType ().getAsString ();
823
+ if (CanonicalType.find (" block_tile_memory" ) != std::string::npos) {
824
+ return ;
825
+ }
826
+ auto Var = MemVarInfo::buildMemVarInfo (VD);
825
827
if (Func->hasAttr <CUDAGlobalAttr>() || Func->hasAttr <CUDADeviceAttr>()) {
826
828
if (!(DpctGlobalInfo::useGroupLocalMemory () &&
827
829
VD->hasAttr <CUDASharedAttr>() &&
Original file line number Diff line number Diff line change
1
+ // RUN: dpct --format-range=none --use-experimental-features=device_global -in-root %S -out-root %T/device_global2 %S/device_global2.cu --cuda-include-path="%cuda-path/include" -- -std=c++14 -x cuda --cuda-host-only
2
+ // RUN: FileCheck --input-file %T/device_global2/device_global2.dp.cpp --match-full-lines %s
3
+
4
+ #include < cuda_runtime.h>
5
+ #include < iostream>
6
+ #include < vector>
7
+
8
+ // CHECK: static sycl::ext::oneapi::experimental::device_global<int> var_a;
9
+ __device__ int var_a;
10
+
11
+ // CHECK: static constexpr sycl::ext::oneapi::experimental::device_global<int8_t[2]> var_b {-1, -1};
12
+ static constexpr __device__ int8_t var_b[2 ] = {-1 , -1 };
13
+
14
+ template <typename T>
15
+ __global__ void kernel (T b) {
16
+ var_a;
17
+ var_b[0 ];
18
+ }
19
+
20
+ template __global__ void kernel<int >(int b);
You can’t perform that action at this time.
0 commit comments