Skip to content

Commit c67d0a3

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: 693cfe5: Coalescing of uniform values
IGCVectorizer can vectorize uniform values. Then they exist bundled into a vector, now vector emission supports coalescing. We emit single wide instruction to cover multiple uniform values that were processed one by one before.
1 parent 34e038c commit c67d0a3

File tree

5 files changed

+5
-237
lines changed

5 files changed

+5
-237
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 4 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4677,6 +4677,7 @@ void EmitPass::FPTrunc(const SSource sources[2], const DstModifier& modifier) {
46774677
}
46784678
}
46794679

4680+
46804681
void EmitPass::Add(const SSource sources[2], const DstModifier& modifier)
46814682
{
46824683
CVariable* src[2];
@@ -4692,21 +4693,6 @@ void EmitPass::Add(const SSource sources[2], const DstModifier& modifier)
46924693
IGC_ASSERT_EXIT_MESSAGE(numLanes(m_encoder->GetSimdSize()) == 16, "As of now Vector Emission is only supported for SIMD16");
46934694
unsigned VectorSize = getVectorSize(sources[0].value);
46944695

4695-
bool AllUniform = src[0]->IsUniform() && src[1]->IsUniform() && m_destination->IsUniform();
4696-
// cannot emit 16 SIMD if SIMD SIZE is set to 8, but can emit 4
4697-
// simple ALU instructions has the same possible width as SIMD, "math" pipeline instructions
4698-
// has reduced width
4699-
bool CanEmitThisSize = VectorSize <= numLanes(m_currShader->m_SIMDSize);
4700-
4701-
if (IGC_IS_FLAG_ENABLED(VectorizerUniformValueVectorizationEnabled) && AllUniform && CanEmitThisSize) {
4702-
m_encoder->SetSrcRegion(0, 1, 1, 0);
4703-
m_encoder->SetSrcRegion(1, 1, 1, 0);
4704-
m_encoder->SetUniformSIMDSize(lanesToSIMDMode(VectorSize));
4705-
m_encoder->Add(m_destination, src[0], src[1]);
4706-
m_encoder->Push();
4707-
return;
4708-
}
4709-
47104696
for (unsigned i = 0; i < VectorSize; ++i) {
47114697
SetSourceModifiers(0, sources[0]);
47124698
SetSourceModifiers(1, sources[1]);
@@ -4740,30 +4726,13 @@ void EmitPass::Mul(const SSource sources[2], const DstModifier& modifier)
47404726
src[i] = GetSrcVariable(sources[i]);
47414727
}
47424728

4743-
unsigned SIMDSize = numLanes(m_currShader->m_SIMDSize);
4744-
47454729
if (IGC_IS_FLAG_ENABLED(EnableVectorEmitter) &&
47464730
sources[0].value->getType()->isVectorTy() &&
47474731
sources[1].value->getType()->isVectorTy()) {
47484732

47494733
IGC_ASSERT_EXIT_MESSAGE(numLanes(m_encoder->GetSimdSize()) == 16, "As of now Vector Emission is only supported for SIMD16");
47504734
unsigned VectorSize = getVectorSize(sources[0].value);
47514735

4752-
bool AllUniform = src[0]->IsUniform() && src[1]->IsUniform() && m_destination->IsUniform();
4753-
// cannot emit 16 SIMD if SIMD SIZE is set to 8, but can emit 4
4754-
// simple ALU instructions has the same possible width as SIMD, "math" pipeline instructions
4755-
// has reduced width
4756-
bool CanEmitThisSize = VectorSize <= SIMDSize;
4757-
4758-
if (IGC_IS_FLAG_ENABLED(VectorizerUniformValueVectorizationEnabled) && AllUniform && CanEmitThisSize) {
4759-
m_encoder->SetSrcRegion(0, 1, 1, 0);
4760-
m_encoder->SetSrcRegion(1, 1, 1, 0);
4761-
m_encoder->SetUniformSIMDSize(lanesToSIMDMode(VectorSize));
4762-
m_encoder->Mul(m_destination, src[0], src[1]);
4763-
m_encoder->Push();
4764-
return;
4765-
}
4766-
47674736
for (unsigned i = 0; i < VectorSize; ++i) {
47684737
SetSourceModifiers(0, sources[0]);
47694738
SetSourceModifiers(1, sources[1]);
@@ -4881,27 +4850,6 @@ void EmitPass::VectorMad(const SSource sources[3], const DstModifier& modifier)
48814850

48824851
unsigned VectorSize = getVectorSize(sources[0].value);
48834852

4884-
bool AllUniform = src[0]->IsUniform() &&
4885-
src[1]->IsUniform() && src[2]->IsUniform() &&
4886-
m_destination->IsUniform();
4887-
4888-
// cannot emit 16 SIMD if SIMD SIZE is set to 8, but can emit 4
4889-
// simple ALU instructions has the same possible width as SIMD, "math" pipeline instructions
4890-
// has reduced width
4891-
bool CanEmitThisSize = VectorSize <= numLanes(m_currShader->m_SIMDSize);
4892-
4893-
if (IGC_IS_FLAG_ENABLED(VectorizerUniformValueVectorizationEnabled) && AllUniform && CanEmitThisSize) {
4894-
// regioning must be updated by hand, DO NOT COPY for fptrunc
4895-
m_encoder->SetSrcRegion(0, 1, 1, 0);
4896-
m_encoder->SetSrcRegion(1, 1, 1, 0);
4897-
m_encoder->SetSrcRegion(2, 1, 1, 0);
4898-
// this will force no_mask and proper uniform SIMD SIZE
4899-
m_encoder->SetUniformSIMDSize(lanesToSIMDMode(VectorSize));
4900-
m_encoder->Mad(m_destination, src[0], src[1], src[2]);
4901-
m_encoder->Push();
4902-
return;
4903-
}
4904-
49054853
for (unsigned i = 0; i < VectorSize; ++i) {
49064854

49074855
SetSourceModifiers(0, sources[0]);
@@ -4915,8 +4863,10 @@ void EmitPass::VectorMad(const SSource sources[3], const DstModifier& modifier)
49154863
if (src[2]->IsUniform()) m_encoder->SetSrcSubReg(2, i);
49164864
else m_encoder->SetSrcSubVar(2, i);
49174865

4866+
bool AllAreUniform = src[0]->IsUniform() &&
4867+
src[1]->IsUniform() && src[2]->IsUniform();
49184868

4919-
if (AllUniform) m_encoder->SetDstSubReg(i);
4869+
if (AllAreUniform) m_encoder->SetDstSubReg(i);
49204870
else m_encoder->SetDstSubVar(i);
49214871

49224872
m_encoder->Mad(m_destination, src[0], src[1], src[2]);

IGC/Compiler/tests/EmitVISAPass/vectorizer-vector-emission-fmad-uniform.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
; UNSUPPORTED: system-windows
22
; REQUIRES: regkeys
33

4-
; RUN: igc_opt -S -dce -platformpvc -rev-id B -has-emulated-64-bit-insts -igc-emit-visa --regkey=DumpVISAASMToConsole=1 --regkey=VectorizerUniformValueVectorizationEnabled=0 -simd-mode 16 < %s | FileCheck %s
4+
; RUN: igc_opt -S -dce -platformpvc -rev-id B -has-emulated-64-bit-insts -igc-emit-visa --regkey=DumpVISAASMToConsole=1 -simd-mode 16 < %s | FileCheck %s
55

66
; CHECK: .decl vectorized_phi1095 v_type=G type=f num_elts=8 align=dword
77
; CHECK: .decl vectorized_phi1116 v_type=G type=f num_elts=8 align=dword

IGC/Compiler/tests/IGCVectorizer/vectorizer-test-ugly-chain.ll

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

IGC/Compiler/tests/IGCVectorizer/vectorizer-test-wider-data.ll

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

IGC/common/igc_flags.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,6 @@ DECLARE_IGC_REGKEY(bool, VectorizerAllowFPTRUNC, true, "Allow FPTRUNC instructio
533533
DECLARE_IGC_REGKEY(bool, VectorizerAllowFDIV, true, "Allow FDIV instructions inside vectorizer", true)
534534
DECLARE_IGC_REGKEY(bool, VectorizerAllowFADD, true, "Allow FADD instructions inside vectorizer", true)
535535
DECLARE_IGC_REGKEY(bool, VectorizerAllowFMADMatching, true, "Allow FADD and FMUL instructions to be matched later in the pattern match pass", true)
536-
DECLARE_IGC_REGKEY(bool, VectorizerUniformValueVectorizationEnabled, true, "Vector Emitter emits vectorized instruction for uniform values", true)
537536
DECLARE_IGC_REGKEY(bool, DisableOCLScalarizer, false, "Disable ScalarizeFunction pass in OCL pipeline", true)
538537
DECLARE_IGC_REGKEY(bool, DisablePHIScalarization, false, "Disable scalarization of PHINode instructions", true)
539538
DECLARE_IGC_REGKEY(bool, EnableSelectiveScalarizer, false, "enable selective scalarizer on GPGPU path", true)

0 commit comments

Comments
 (0)