Skip to content

Commit

Permalink
Minor refactoring change
Browse files Browse the repository at this point in the history
Minor refactoring change
  • Loading branch information
pratikashar authored and igcbot committed Jan 30, 2025
1 parent 4b7254d commit 4e31572
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 13 deletions.
1 change: 1 addition & 0 deletions visa/HWCaps.inc
Original file line number Diff line number Diff line change
Expand Up @@ -939,4 +939,5 @@ bool needTGMDoubleFenceWA() const {
bool useDynamicAddrForExDesc() const {
return getOption(vISA_dynamicAddrForExDescInLscSend);
}

// end HW capabilities
3 changes: 2 additions & 1 deletion visa/Optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,8 @@ int Optimizer::optimization() {
return VISA_SPILL;
}



runPass(PI_removeLifetimeOps);

// HW workaround after RA
Expand Down Expand Up @@ -1321,7 +1323,6 @@ void Optimizer::removePseudoMov() {
}
}
}

void Optimizer::FoldAddrImmediate() {
AddrSubReg_Node *addrRegInfo =
new AddrSubReg_Node[builder.getNumAddrRegisters()];
Expand Down
32 changes: 20 additions & 12 deletions visa/VisaToG4/TranslateSend3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,19 +195,21 @@ int IR_Builder::translateVISASampleInfoInst(VISA_Exec_Size executionSize,
bool preEmption = forceSamplerHeader();
bool forceSplitSend = shouldForceSplitSend(surface);
bool useHeader = true;
bool forceHeader = false;
// SAMPLEINFO has 0 parameters so its only header

unsigned int numRows = 1;

G4_Declare *msg = NULL;
G4_SrcRegRegion *m0 = NULL;

if (!useFakeHeader || forceSplitSend || preEmption) {
if (!useFakeHeader || forceSplitSend || preEmption || forceHeader) {
msg = getSamplerHeader(false /*isBindlessSampler*/,
false /*samperIndexGE16*/);

unsigned int secondDword = chMask.getHWEncoding() << 12;


G4_Imm *immOpndSecondDword = createImm(secondDword, Type_UD);

// mov (1) msg(0,2) immOpndSecondDword
Expand Down Expand Up @@ -321,6 +323,7 @@ int IR_Builder::translateVISAResInfoInst(
unsigned int secondDword = 0;
secondDword |= (chMask.getHWEncoding() << 12);


G4_Imm *immOpndSecondDword = createImm(secondDword, Type_UD);

// mov (1) msg(0,2) immOpndSecondDword
Expand Down Expand Up @@ -1763,17 +1766,21 @@ static G4_Operand *createSampleHeader(IR_Builder *builder, G4_Declare *header,
unsigned int secondDword = createSampleHeader0Dot2(
actualop, pixelNullMask, aoffimmiVal, srcChannel, builder);


G4_Imm *immOpndSecondDword = builder->createImm(secondDword, Type_UD);
G4_DstRegRegion *payloadDstRgn =
builder->createDst(header->getRegVar(), 0, 2, 1, Type_UD);
G4_INST *headerInst = nullptr;
if (aoffimmi->isImm()) {
// mov (1) payload(0,2) immOpndSecondDword
builder->createMov(g4::SIMD1, payloadDstRgn, immOpndSecondDword,
InstOpt_WriteEnable, true);
headerInst =
builder->createMov(g4::SIMD1, payloadDstRgn, immOpndSecondDword,
InstOpt_WriteEnable, true);
} else {
// or (1) payload(0,2) aoffimmi<0;1,0>:uw immOpndSeconDword
builder->createBinOp(G4_or, g4::SIMD1, payloadDstRgn, aoffimmi,
immOpndSecondDword, InstOpt_WriteEnable, true);
headerInst =
builder->createBinOp(G4_or, g4::SIMD1, payloadDstRgn, aoffimmi,
immOpndSecondDword, InstOpt_WriteEnable, true);
}

if (sampler != nullptr) {
Expand Down Expand Up @@ -2364,10 +2371,10 @@ int IR_Builder::translateVISASampler3DInst(
bool nonZeroAoffImmi =
!(aoffimmi->isImm() && aoffimmi->asImm()->getInt() == 0);
bool simd16HFReturn = FP16Return && execSize == 16;
if (needSamplerHeader(this, pixelNullMask, nonZeroAoffImmi,
if (useHeader ||
needSamplerHeader(this, pixelNullMask, nonZeroAoffImmi,
needHeaderForChannels, isBindlessSampler(sampler),
!pairedSurface->isNullReg(),
simd16HFReturn) ||
!pairedSurface->isNullReg(), simd16HFReturn) ||
samplerHeaderPreemptionWA()) {
useHeader = true;
++numRows;
Expand Down Expand Up @@ -2503,10 +2510,10 @@ int IR_Builder::translateVISALoad3DInst(
bool nonZeroAoffImmi =
!(aoffimmi->isImm() && aoffimmi->asImm()->getInt() == 0);
bool simd16HFReturn = halfReturn && execSize == 16;
if (needSamplerHeader(this, pixelNullMask, nonZeroAoffImmi,
if (useHeader ||
needSamplerHeader(this, pixelNullMask, nonZeroAoffImmi,
needHeaderForChannels, false,
!pairedSurface->isNullReg(),
simd16HFReturn)) {
!pairedSurface->isNullReg(), simd16HFReturn)) {
useHeader = true;
++numRows;
}
Expand Down Expand Up @@ -2612,7 +2619,8 @@ int IR_Builder::translateVISAGather3dInst(
channelMask.getSingleChannel() != VISA_3D_GATHER4_CHANNEL_R;
bool simd16HFReturn = FP16Return && execSize == 16;

if (needSamplerHeader(this, pixelNullMask, nonZeroAoffImmi,
if (useHeader ||
needSamplerHeader(this, pixelNullMask, nonZeroAoffImmi,
needHeaderForChannels, isBindlessSampler(sampler),
!pairedSurface->isNullReg(), simd16HFReturn) ||
samplerHeaderPreemptionWA()) {
Expand Down

0 comments on commit 4e31572

Please sign in to comment.