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) {
29472947 auto &Ctx = DpctGlobalInfo::getContext ();
29482948 auto &MacroArgMap = DpctGlobalInfo::getMacroArgRecordMap ();
29492949 auto TSI = MemVar->getTypeSourceInfo ();
2950- auto OriginTL = TSI->getTypeLoc ();
2950+ auto OriginTL = TSI->getTypeLoc (). getUnqualifiedLoc (). getAs <TypeLoc>() ;
29512951 auto TL = OriginTL;
29522952 auto BegLoc = MemVar->getBeginLoc ();
29532953 if (BegLoc.isMacroID ()) {
Original file line number Diff line number Diff line change @@ -809,7 +809,6 @@ void MemVarAnalysisRule::runRule(const MatchFinder::MatchResult &Result) {
809809 auto MemVarRef = getNodeAsType<DeclRefExpr>(Result, " used" );
810810 auto Func = getAssistNodeAsType<FunctionDecl>(Result, " func" );
811811 auto Decl = getAssistNodeAsType<VarDecl>(Result, " decl" );
812- DpctGlobalInfo &Global = DpctGlobalInfo::getInstance ();
813812 if (MemVarRef && Func && Decl) {
814813 if (isCubVar (Decl)) {
815814 return ;
@@ -820,8 +819,11 @@ void MemVarAnalysisRule::runRule(const MatchFinder::MatchResult &Result) {
820819 return ;
821820 if (VD == nullptr )
822821 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);
825827 if (Func->hasAttr <CUDAGlobalAttr>() || Func->hasAttr <CUDADeviceAttr>()) {
826828 if (!(DpctGlobalInfo::useGroupLocalMemory () &&
827829 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