@@ -3926,25 +3926,7 @@ void EmitPass::emitLdInstruction(llvm::Instruction* inst)
3926
3926
{
3927
3927
if (feedbackEnable)
3928
3928
{
3929
- CVariable* flag = m_currShader->GetNewVariable(numLanes(m_currShader->m_dispatchSize), ISA_TYPE_BOOL, EALIGN_BYTE);
3930
- uint subvar = numLanes(simdSize) / (getGRFSize() >> 2) * 4;
3931
-
3932
- if (needPacking)
3933
- {
3934
- subvar /= 2;
3935
- }
3936
-
3937
- m_encoder->SetSrcSubVar(0, subvar);
3938
- m_encoder->SetSrcRegion(0, 0, 1, 0);
3939
- CVariable* newdestination = m_currShader->BitCast(dst, ISA_TYPE_UD);
3940
- m_encoder->SetP(flag, newdestination);
3941
- m_encoder->Push();
3942
-
3943
- CVariable* pred = m_currShader->ImmToVariable(0xFFFFFFFF, dst->GetType());
3944
- CVariable* zero = m_currShader->ImmToVariable(0x0, dst->GetType());
3945
- m_encoder->SetDstSubVar(subvar);
3946
- m_encoder->Select(flag, dst, pred, zero);
3947
- m_encoder->Push();
3929
+ emitFeedbackEnable(false);
3948
3930
}
3949
3931
3950
3932
if (m_destination->IsUniform())
@@ -6757,6 +6739,31 @@ void EmitPass::emitSurfaceInfo(GenIntrinsicInst* inst)
6757
6739
ResetVMask(false);
6758
6740
}
6759
6741
6742
+ void EmitPass::emitFeedbackEnable(bool isHFPacked)
6743
+ {
6744
+ // if feedback is enabled we always return all 4 channels
6745
+ CVariable* flag = m_currShader->GetNewVariable(numLanes(m_currShader->m_dispatchSize), ISA_TYPE_BOOL, EALIGN_BYTE);
6746
+ uint typeSize = CEncoder::GetCISADataTypeSize(m_destination->GetType());
6747
+ uint subvar = (numLanes(m_currShader->m_SIMDSize) * typeSize * 4) / getGRFSize();
6748
+ if (!isHFPacked)
6749
+ {
6750
+ // if HF destination is not packed yet, each channel takes at least 1 GRF.
6751
+ subvar = std::max(4u, subvar);
6752
+ }
6753
+
6754
+ m_encoder->SetSrcSubVar(0, subvar);
6755
+ m_encoder->SetSrcRegion(0, 0, 1, 0);
6756
+ CVariable* newdestination = m_currShader->BitCast(m_destination, ISA_TYPE_UD);
6757
+ m_encoder->SetP(flag, newdestination);
6758
+ m_encoder->Push();
6759
+
6760
+ CVariable* pred = m_currShader->ImmToVariable(0xFFFFFFFF, m_destination->GetType());
6761
+ CVariable* zero = m_currShader->ImmToVariable(0x0, m_destination->GetType());
6762
+ m_encoder->SetDstSubVar(subvar);
6763
+ m_encoder->Select(flag, m_destination, pred, zero);
6764
+ m_encoder->Push();
6765
+ }
6766
+
6760
6767
void EmitPass::emitGather4Instruction(SamplerGatherIntrinsic* inst)
6761
6768
{
6762
6769
EOPCODE opCode = GetOpCode(inst);
@@ -6844,28 +6851,9 @@ void EmitPass::emitGather4Instruction(SamplerGatherIntrinsic* inst)
6844
6851
PackSIMD8HFRet(dst);
6845
6852
}
6846
6853
6847
-
6848
6854
if (feedbackEnable)
6849
6855
{
6850
- CVariable* flag = m_currShader->GetNewVariable(numLanes(m_currShader->m_dispatchSize), ISA_TYPE_BOOL, EALIGN_BYTE);
6851
- uint subvar = numLanes(m_currShader->m_SIMDSize) / (getGRFSize() >> 2) * 4;
6852
-
6853
- if (simd8HFRet)
6854
- {
6855
- subvar /= 2;
6856
- }
6857
-
6858
- m_encoder->SetSrcSubVar(0, subvar);
6859
- m_encoder->SetSrcRegion(0, 0, 1, 0);
6860
- CVariable* newdestination = m_currShader->BitCast(m_destination, ISA_TYPE_UD);
6861
- m_encoder->SetP(flag, newdestination);
6862
- m_encoder->Push();
6863
-
6864
- CVariable* pred = m_currShader->ImmToVariable(0xFFFFFFFF, m_destination->GetType());
6865
- CVariable* zero = m_currShader->ImmToVariable(0x0, m_destination->GetType());
6866
- m_encoder->SetDstSubVar(subvar);
6867
- m_encoder->Select(flag, m_destination, pred, zero);
6868
- m_encoder->Push();
6856
+ emitFeedbackEnable(true);
6869
6857
}
6870
6858
}
6871
6859
}
@@ -6942,25 +6930,7 @@ void EmitPass::emitLdmsInstruction(llvm::Instruction* inst)
6942
6930
6943
6931
if (feedbackEnable)
6944
6932
{
6945
- CVariable* flag = m_currShader->GetNewVariable(numLanes(m_currShader->m_dispatchSize), ISA_TYPE_BOOL, EALIGN_BYTE);
6946
- uint subvar = numLanes(m_currShader->m_SIMDSize) / (getGRFSize() >> 2) * 4;
6947
-
6948
- if (simd8HFRet)
6949
- {
6950
- subvar /= 2;
6951
- }
6952
-
6953
- m_encoder->SetSrcSubVar(0, subvar);
6954
- m_encoder->SetSrcRegion(0, 0, 1, 0);
6955
- CVariable* newdestination = m_currShader->BitCast(m_destination, ISA_TYPE_UD);
6956
- m_encoder->SetP(flag, newdestination);
6957
- m_encoder->Push();
6958
-
6959
- CVariable* pred = m_currShader->ImmToVariable(0xFFFFFFFF, m_destination->GetType());
6960
- CVariable* zero = m_currShader->ImmToVariable(0x0, m_destination->GetType());
6961
- m_encoder->SetDstSubVar(subvar);
6962
- m_encoder->Select(flag, m_destination, pred, zero);
6963
- m_encoder->Push();
6933
+ emitFeedbackEnable(true);
6964
6934
}
6965
6935
}
6966
6936
0 commit comments