Skip to content

Commit acae2f8

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: df4a2a2: Fix subroutine handling for intel_reqd_sub_group_size(32)
Previously, using `intel_reqd_sub_group_size(32)` on DG2 resulted in two redundant SIMD32 call instructions being generated in vISA, which could lead to unexpected issues. This change ensures that only a single SIMD32 call instruction is generated. All function arguments and return values are now correctly passed using two SIMD16 instructions, eliminating redundancy and improving
1 parent 7fd0952 commit acae2f8

File tree

3 files changed

+6
-58
lines changed

3 files changed

+6
-58
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -399,8 +399,9 @@ uint EmitPass::DecideInstanceAndSlice(const llvm::BasicBlock &blk, SDAG &sdag,
399399
}
400400

401401
if (CallInst *callInst = dyn_cast<CallInst>(sdag.m_root)) {
402-
// Disable slicing for function calls (stackcalls and subroutines)
403-
if (isUserFunctionCall(callInst)) {
402+
// Disable slicing for function calls
403+
Function *F = dyn_cast<Function>(IGCLLVM::getCalledValue(callInst));
404+
if (!F || F->hasFnAttribute("visaStackCall")) {
404405
numInstance = 1;
405406
slicing = false;
406407
}
@@ -11635,7 +11636,7 @@ void EmitPass::emitCall(llvm::CallInst *inst) {
1163511636
// When both symbols are the same, then this argument passing has been
1163611637
// lifted to use a global vISA variable, just skip the copy.
1163711638
if (Dst != Src) {
11638-
emitCopyAllInstances(Dst, Src, Arg.getType());
11639+
emitCopyAll(Dst, Src, Arg.getType());
1163911640
}
1164011641
}
1164111642
m_currFuncHasSubroutine = true;
@@ -11646,7 +11647,7 @@ void EmitPass::emitCall(llvm::CallInst *inst) {
1164611647
if (!inst->use_empty()) {
1164711648
CVariable *Dst = GetSymbol(inst);
1164811649
CVariable *Src = m_currShader->getOrCreateReturnSymbol(F);
11649-
emitCopyAllInstances(Dst, Src, inst->getType());
11650+
emitCopyAll(Dst, Src, inst->getType());
1165011651
}
1165111652
}
1165211653

@@ -11665,7 +11666,7 @@ void EmitPass::emitReturn(llvm::ReturnInst *inst) {
1166511666
if (!RetTy->isVoidTy()) {
1166611667
CVariable *Dst = m_currShader->getOrCreateReturnSymbol(F);
1166711668
CVariable *Src = GetSymbol(inst->getReturnValue());
11668-
emitCopyAllInstances(Dst, Src, RetTy);
11669+
emitCopyAll(Dst, Src, RetTy);
1166911670
}
1167011671

1167111672
m_encoder->SubroutineRet(nullptr, F);
@@ -21034,14 +21035,6 @@ void EmitPass::emitCopyAll(CVariable *Dst, CVariable *Src, llvm::Type *Ty) {
2103421035
}
2103521036
}
2103621037

21037-
void EmitPass::emitCopyAllInstances(CVariable *Dst, CVariable *Src,
21038-
llvm::Type *type) {
21039-
for (uint instance = 0; instance < Dst->GetNumberInstance(); instance++) {
21040-
m_encoder->SetSecondHalf(instance == 1 ? true : false);
21041-
emitCopyAll(Dst, Src, type);
21042-
}
21043-
}
21044-
2104521038
void EmitPass::emitSqrt(Instruction *inst) {
2104621039
GenIntrinsicInst *intrinCall = llvm::cast<GenIntrinsicInst>(inst);
2104721040
CVariable *src0 = GetSymbol(intrinCall->getArgOperand(0));

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,6 @@ class EmitPass : public llvm::FunctionPass
534534
bool allowLargerSIMDSize = false, CVariable* predicate = nullptr);
535535
void emitConstantVector(CVariable* Dst, uint64_t value = 0);
536536
void emitCopyAll(CVariable* Dst, CVariable* Src, llvm::Type* Ty);
537-
void emitCopyAllInstances(CVariable *Dst, CVariable *Src, llvm::Type *Ty);
538537

539538
void emitPredicatedVectorCopy(CVariable* Dst, CVariable* Src, CVariable* pred);
540539
void emitPredicatedVectorSelect(CVariable* Dst, CVariable* Src0,

IGC/ocloc_tests/features/reqd_sub_group_size/subroutine.cl

Lines changed: 0 additions & 44 deletions
This file was deleted.

0 commit comments

Comments
 (0)