File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -1465,10 +1465,8 @@ bool EmitPass::runOnFunction(llvm::Function& F)
14651465
14661466 if ((m_currShader->GetShaderType() == ShaderType::COMPUTE_SHADER ||
14671467 m_currShader->GetShaderType() == ShaderType::OPENCL_SHADER) &&
1468- m_currShader->m_Platform->supportDisableMidThreadPreemptionSwitch() &&
1469- IGC_IS_FLAG_ENABLED(EnableDisableMidThreadPreemptionOpt) &&
1470- (m_currShader->GetContext()->m_instrTypes.numLoopInsts == 0) &&
1471- (m_currShader->ProgramOutput()->m_InstructionCount < IGC_GET_FLAG_VALUE(MidThreadPreemptionDisableThreshold)))
1468+ m_currShader->m_State.shouldDisablePreemption(
1469+ m_currShader->ProgramOutput()->m_InstructionCount))
14721470 {
14731471
14741472 {
Original file line number Diff line number Diff line change @@ -107,6 +107,14 @@ namespace IGC
107107 CodeGenContext& Ctx;
108108
109109 CodeGenContext& GetContext () const { return Ctx; }
110+
111+ bool shouldDisablePreemption (unsigned NumInst) const
112+ {
113+ return (Ctx.platform .supportDisableMidThreadPreemptionSwitch () &&
114+ IGC_IS_FLAG_ENABLED (EnableDisableMidThreadPreemptionOpt) &&
115+ (Ctx.m_instrTypes .numLoopInsts == 0 ) &&
116+ (NumInst < IGC_GET_FLAG_VALUE (MidThreadPreemptionDisableThreshold)));
117+ }
110118 private:
111119 bool m_HasSample = false ;
112120 int m_BarrierNumber = 0 ;
You can’t perform that action at this time.
0 commit comments