forked from OSchip/llvm-project
[OpenMP] Add Missing Runtime Call for Globalization Remarks
Summary: Add a missing runtime call to perform data globalization checks. Reviewers: jdoerfert Subscribers: guansong hiraditya llvm-commits sstefan1 yaxunl Tags: #LLVM #OpenMP Differential Revision: https://reviews.llvm.org/D88621
This commit is contained in:
parent
c1dcb573a8
commit
82453e759c
|
@ -705,24 +705,29 @@ private:
|
||||||
}
|
}
|
||||||
|
|
||||||
void analysisGlobalization() {
|
void analysisGlobalization() {
|
||||||
auto &RFI =
|
RuntimeFunction GlobalizationRuntimeIDs[] = {
|
||||||
OMPInfoCache.RFIs[OMPRTL___kmpc_data_sharing_coalesced_push_stack];
|
OMPRTL___kmpc_data_sharing_coalesced_push_stack,
|
||||||
|
OMPRTL___kmpc_data_sharing_push_stack};
|
||||||
|
|
||||||
auto checkGlobalization = [&](Use &U, Function &Decl) {
|
for (const auto GlobalizationCallID : GlobalizationRuntimeIDs) {
|
||||||
if (CallInst *CI = getCallIfRegularCall(U, &RFI)) {
|
auto &RFI = OMPInfoCache.RFIs[GlobalizationCallID];
|
||||||
auto Remark = [&](OptimizationRemarkAnalysis ORA) {
|
|
||||||
return ORA
|
|
||||||
<< "Found thread data sharing on the GPU. "
|
|
||||||
<< "Expect degraded performance due to data globalization.";
|
|
||||||
};
|
|
||||||
emitRemark<OptimizationRemarkAnalysis>(CI, "OpenMPGlobalization",
|
|
||||||
Remark);
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
auto CheckGlobalization = [&](Use &U, Function &Decl) {
|
||||||
};
|
if (CallInst *CI = getCallIfRegularCall(U, &RFI)) {
|
||||||
|
auto Remark = [&](OptimizationRemarkAnalysis ORA) {
|
||||||
|
return ORA
|
||||||
|
<< "Found thread data sharing on the GPU. "
|
||||||
|
<< "Expect degraded performance due to data globalization.";
|
||||||
|
};
|
||||||
|
emitRemark<OptimizationRemarkAnalysis>(CI, "OpenMPGlobalization",
|
||||||
|
Remark);
|
||||||
|
}
|
||||||
|
|
||||||
RFI.foreachUse(SCC, checkGlobalization);
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
RFI.foreachUse(SCC, CheckGlobalization);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ entry:
|
||||||
br i1 %.not, label %.non-spmd, label %.exit
|
br i1 %.not, label %.non-spmd, label %.exit
|
||||||
|
|
||||||
.non-spmd: ; preds = %entry
|
.non-spmd: ; preds = %entry
|
||||||
%1 = tail call i8* @__kmpc_data_sharing_coalesced_push_stack(i64 128, i16 0) #4, !dbg !31
|
%1 = tail call i8* @__kmpc_data_sharing_push_stack(i64 128, i16 0) #4, !dbg !31
|
||||||
%2 = bitcast i8* %1 to %struct._globalized_locals_ty*
|
%2 = bitcast i8* %1 to %struct._globalized_locals_ty*
|
||||||
br label %.exit
|
br label %.exit
|
||||||
|
|
||||||
|
@ -86,6 +86,8 @@ declare i8 @__kmpc_is_spmd_exec_mode() local_unnamed_addr
|
||||||
|
|
||||||
declare i8* @__kmpc_data_sharing_coalesced_push_stack(i64, i16) local_unnamed_addr
|
declare i8* @__kmpc_data_sharing_coalesced_push_stack(i64, i16) local_unnamed_addr
|
||||||
|
|
||||||
|
declare i8* @__kmpc_data_sharing_push_stack(i64, i16) local_unnamed_addr
|
||||||
|
|
||||||
; Function Attrs: nounwind readnone
|
; Function Attrs: nounwind readnone
|
||||||
declare i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1
|
declare i32 @llvm.nvvm.read.ptx.sreg.tid.x() #1
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue