Skip to content

Commit 17660da

Browse files
houjenkoigcbot
authored andcommitted
Propagate HasStackCall info in LTO
We need to mark the caller of invoke_simd target to be HasStackCall if in the context of callee it has stack calls. It is because we will convert the invoke_simd callsite to be inlined or a subroutine call. SSO must be inserted for accessing stack frames.
1 parent ea8c9f6 commit 17660da

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

visa/BuildCISAIR.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -746,6 +746,10 @@ class CISA_IR_Builder : public VISABuilder {
746746
std::list<std::list<vISA::G4_INST *>::iterator>>
747747
&callee2Callers);
748748

749+
// Propagate info from callee to callee
750+
void PropagateInfo(
751+
vISA::G4_Kernel *caller, vISA::G4_Kernel *callee);
752+
749753
// Perform LinkTimeOptimization for call related transformations
750754
void LinkTimeOptimization(
751755
std::unordered_map<vISA::G4_Kernel *,

visa/BuildCISAIRImpl.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,16 @@ void CISA_IR_Builder::ProcessSgInvokeList(
639639
}
640640
}
641641

642+
void CISA_IR_Builder::PropagateInfo(
643+
vISA::G4_Kernel *caller, vISA::G4_Kernel *callee) {
644+
// Need to propagate HasStackCall from the caller to callee after LTO
645+
bool callerHasStackCall =
646+
caller->fg.getHasStackCalls() ||
647+
callee->fg.getHasStackCalls();
648+
if (callerHasStackCall)
649+
caller->fg.setHasStackCalls();
650+
}
651+
642652
// #define DEBUG_LTO
643653
#ifdef DEBUG_LTO
644654
#define DEBUG_PRINT(msg) std::cerr << __LINE__ << " " << msg;
@@ -678,6 +688,8 @@ void CISA_IR_Builder::LinkTimeOptimization(
678688
bool removeStackArg = (options & (1U << Linker_RemoveStackArg)) && caller->fg.builder->hasInt64Add();
679689
bool removeStackFrame = (options & (1U << Linker_RemoveStackFrame));
680690

691+
PropagateInfo(caller, callee);
692+
681693
G4_INST *calleeLabel = *callee->fg.builder->instList.begin();
682694
vISA_ASSERT(calleeLabel->isLabel() == true, "Entry inst is not a label");
683695

0 commit comments

Comments
 (0)