Skip to content

Commit fcd7905

Browse files
scottp101igcbot
authored andcommitted
refactor preemption
refactor preemption. Mark movcr as uniform.
1 parent b871a9f commit fcd7905

File tree

6 files changed

+2
-84
lines changed

6 files changed

+2
-84
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3006,61 +3006,6 @@ namespace IGC
30063006
return RMEncoding::RoundToZero_int;
30073007
}
30083008

3009-
CEncoder::PreemptionEncoding CEncoder::getEncoderPreemptionMode(EPreemptionMode preemptionMode)
3010-
{
3011-
switch (preemptionMode)
3012-
{
3013-
default:
3014-
break;
3015-
case PREEMPTION_ENABLED:
3016-
return PreemptionEncoding::PreemptionEnabled;
3017-
case PREEMPTION_DISABLED:
3018-
return PreemptionEncoding::PreemptionDisabled;
3019-
}
3020-
3021-
return PreemptionEncoding::PreemptionEnabled;
3022-
}
3023-
3024-
void CEncoder::SetPreemptionMode(EPreemptionMode actualPreemptionMode, EPreemptionMode newPreemptionMode)
3025-
{
3026-
if (actualPreemptionMode != newPreemptionMode)
3027-
{
3028-
PreemptionEncoding actualPreemptionMode_en = getEncoderPreemptionMode(actualPreemptionMode);
3029-
PreemptionEncoding newPreemptionMode_en = getEncoderPreemptionMode(newPreemptionMode);
3030-
SetPreemptionMode(actualPreemptionMode_en, newPreemptionMode_en);
3031-
}
3032-
}
3033-
3034-
void CEncoder::SetPreemptionMode(PreemptionEncoding actualPreemptionMode, PreemptionEncoding newPreemptionMode)
3035-
{
3036-
IGC_ASSERT_MESSAGE(
3037-
(actualPreemptionMode != newPreemptionMode),
3038-
"Only setting PreemptionMode if the new PreemptionMode is different from the current PreemptionMode!");
3039-
3040-
VISA_VectorOpnd* src0_Opnd = nullptr;
3041-
VISA_VectorOpnd* src1_Opnd = nullptr;
3042-
VISA_VectorOpnd* dst_Opnd = nullptr;
3043-
VISA_GenVar* cr0_var = nullptr;
3044-
3045-
uint preemptionMode = actualPreemptionMode ^ newPreemptionMode;
3046-
3047-
IGC_ASSERT(nullptr != vKernel);
3048-
3049-
V(vKernel->GetPredefinedVar(cr0_var, PREDEFINED_CR0));
3050-
V(vKernel->CreateVISASrcOperand(src0_Opnd, cr0_var, MODIFIER_NONE, 0, 1, 0, 0, 0));
3051-
V(vKernel->CreateVISAImmediate(src1_Opnd, &preemptionMode, ISA_TYPE_UD));
3052-
V(vKernel->CreateVISADstOperand(dst_Opnd, cr0_var, 1, 0, 0));
3053-
V(vKernel->AppendVISAArithmeticInst(
3054-
ISA_XOR,
3055-
nullptr,
3056-
false,
3057-
vISA_EMASK_M1_NM,
3058-
EXEC_SIZE_1,
3059-
dst_Opnd,
3060-
src0_Opnd,
3061-
src1_Opnd));
3062-
}
3063-
30643009
VISA_LabelOpnd* CEncoder::GetLabel(uint label)
30653010
{
30663011
VISA_LabelOpnd* visaLabel = labelMap[label];

IGC/Compiler/CISACodeGen/CISABuilder.hpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,6 @@ namespace IGC
471471
void SetRoundingMode_FP(ERoundingMode actualRM, ERoundingMode newRM);
472472
void SetRoundingMode_FPCvtInt(ERoundingMode actualRM, ERoundingMode newRM);
473473

474-
void SetPreemptionMode(EPreemptionMode actualPreemptionMode, EPreemptionMode newPreemptionMode);
475-
476474
static uint GetCISADataTypeSize(VISA_Type type) {return CVariable::GetCISADataTypeSize(type);}
477475
static e_alignment GetCISADataTypeAlignment(VISA_Type type) {return CVariable::GetCISADataTypeAlignment(type);}
478476

@@ -671,17 +669,6 @@ namespace IGC
671669
// Get Encoding bit values for rounding mode
672670
RMEncoding getEncoderRoundingMode_FP(ERoundingMode FP_RM);
673671
RMEncoding getEncoderRoundingMode_FPCvtInt(ERoundingMode FCvtI_RM);
674-
675-
enum PreemptionEncoding
676-
{
677-
PreemptionDisabled = 0x000,
678-
PreemptionEnabled = 0x800
679-
};
680-
681-
PreemptionEncoding getEncoderPreemptionMode(EPreemptionMode preemptionMode);
682-
683-
void SetPreemptionMode(PreemptionEncoding actualPreemptionMode, PreemptionEncoding newPreemptionMode);
684-
685672
unsigned GetRawOpndSplitOffset(VISA_Exec_Size fromExecSize,
686673
VISA_Exec_Size toExecSize,
687674
unsigned thePart, CVariable* var) const;

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ EmitPass::EmitPass(CShaderProgram::KernelShaderMap& shaders, SIMDMode mode, bool
126126
m_canAbortOnSpill(canAbortOnSpill),
127127
m_roundingMode_FP(ERoundingMode::ROUND_TO_NEAREST_EVEN),
128128
m_roundingMode_FPCvtInt(ERoundingMode::ROUND_TO_ZERO),
129-
m_preemptionMode(EPreemptionMode::PREEMPTION_ENABLED),
130129
m_pSignature(pSignature),
131130
m_isDuplicate(false)
132131
{
@@ -1264,8 +1263,6 @@ bool EmitPass::runOnFunction(llvm::Function& F)
12641263
(m_currShader->GetContext()->m_instrTypes.numLoopInsts == 0) &&
12651264
(m_currShader->ProgramOutput()->m_InstructionCount < IGC_GET_FLAG_VALUE(MidThreadPreemptionDisableThreshold)))
12661265
{
1267-
m_preemptionMode = PREEMPTION_DISABLED;
1268-
12691266
if (m_currShader->GetShaderType() == ShaderType::COMPUTE_SHADER)
12701267
{
12711268
CComputeShader* csProgram = static_cast<CComputeShader*>(m_currShader);
@@ -16928,15 +16925,6 @@ void EmitPass::SetRoundingMode_FPCvtInt(ERoundingMode newRM_FPCvtInt)
1692816925
}
1692916926
}
1693016927

16931-
void EmitPass::SetPreemptionMode(EPreemptionMode newPreemptionMode)
16932-
{
16933-
if (newPreemptionMode != m_preemptionMode)
16934-
{
16935-
m_encoder->SetPreemptionMode(m_preemptionMode, newPreemptionMode);
16936-
m_preemptionMode = newPreemptionMode;
16937-
}
16938-
}
16939-
1694016928
// Return true if inst needs specific rounding mode; false otherwise.
1694116929
//
1694216930
// Currently, only gen intrinsic needs rounding mode other than the default.

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -813,8 +813,6 @@ class EmitPass : public llvm::FunctionPass
813813
ERoundingMode m_roundingMode_FP;
814814
ERoundingMode m_roundingMode_FPCvtInt;
815815

816-
EPreemptionMode m_preemptionMode;
817-
818816
uint m_currentBlock = (uint) -1;
819817

820818
bool m_currFuncHasSubroutine = false;
@@ -890,8 +888,6 @@ class EmitPass : public llvm::FunctionPass
890888
bool setRMExplicitly(llvm::Instruction* inst);
891889
void ResetRoundingMode(llvm::Instruction* inst);
892890

893-
void SetPreemptionMode(EPreemptionMode newPreemptionMode);
894-
895891
// returns true if the instruction does not care about the rounding mode settings
896892
bool ignoreRoundingMode(llvm::Instruction* inst) const;
897893

IGC/Compiler/CISACodeGen/RayTracingShaderLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ SPDX-License-Identifier: MIT
2020
#include "RayTracingShaderLowering.hpp"
2121
#include "AdaptorCommon/RayTracing/RTBuilder.h"
2222
#include "IGCPassSupport.h"
23+
#include "Compiler/CISACodeGen/EmitVISAPass.hpp"
2324
#include "common/LLVMWarningsPush.hpp"
2425
#include "llvm/IR/Function.h"
2526
#include "llvm/IR/Module.h"

IGC/Compiler/CISACodeGen/WIAnalysis.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1331,6 +1331,7 @@ WIAnalysis::WIDependancy WIAnalysisRunner::calculate_dep(const CallInst* inst)
13311331
GII_id == GenISAIntrinsic::GenISA_dual_subslice_id ||
13321332
GII_id == GenISAIntrinsic::GenISA_eu_id ||
13331333
GII_id == GenISAIntrinsic::GenISA_eu_thread_id ||
1334+
GII_id == GenISAIntrinsic::GenISA_movcr ||
13341335
GII_id == GenISAIntrinsic::GenISA_hw_thread_id ||
13351336
GII_id == GenISAIntrinsic::GenISA_hw_thread_id_alloca ||
13361337
GII_id == GenISAIntrinsic::GenISA_StackAlloca ||

0 commit comments

Comments
 (0)