Skip to content

Commit bb946ee

Browse files
fda0igcbot
authored andcommitted
Set both dst and src types for GenISA_srnd
Set dst and src types to these expected by vISA documentation.
1 parent 3bd1d5e commit bb946ee

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8601,7 +8601,7 @@ void EmitPass::EmitGenIntrinsicMessage(llvm::GenIntrinsicInst* inst)
86018601
break;
86028602
case GenISAIntrinsic::GenISA_srnd_ftohf:
86038603
case GenISAIntrinsic::GenISA_srnd_hftobf8:
8604-
emitsrnd(inst);
8604+
emitSrnd(inst);
86058605
break;
86068606
case GenISAIntrinsic::GenISA_uavSerializeAll:
86078607
case GenISAIntrinsic::GenISA_uavSerializeOnResID:
@@ -21647,7 +21647,7 @@ void EmitPass::emitfcvt(llvm::GenIntrinsicInst* GII)
2164721647
}
2164821648
}
2164921649

21650-
void EmitPass::emitsrnd(llvm::GenIntrinsicInst* GII)
21650+
void EmitPass::emitSrnd(llvm::GenIntrinsicInst* GII)
2165121651
{
2165221652
CVariable* dst = m_destination;
2165321653
CVariable* src0 = GetSymbol(GII->getOperand(0));
@@ -21656,18 +21656,30 @@ void EmitPass::emitsrnd(llvm::GenIntrinsicInst* GII)
2165621656
bool isSat = CI->getValue().getBoolValue();
2165721657
GenISAIntrinsic::ID GID = GII->getIntrinsicID();
2165821658

21659-
switch (GID)
21659+
// set dst types
21660+
if (GID == GenISAIntrinsic::GenISA_srnd_ftohf)
2166021661
{
21661-
case GenISAIntrinsic::GenISA_srnd_hftobf8:
21662+
if (dst->GetType() != ISA_TYPE_HF)
21663+
dst = m_currShader->GetNewAlias(dst, ISA_TYPE_HF, 0, 0);
21664+
}
21665+
if (GID == GenISAIntrinsic::GenISA_srnd_hftobf8
21666+
)
2166221667
{
21663-
if (dst->GetType() != ISA_TYPE_UB)
21664-
{ // Use UB for bf8
21668+
if (dst->GetType() != ISA_TYPE_UB) // Use UB for bf8
2166521669
dst = m_currShader->GetNewAlias(dst, ISA_TYPE_UB, 0, 0);
21666-
}
21667-
break;
2166821670
}
21669-
default:
21670-
break;
21671+
21672+
// set src types
21673+
if (GID == GenISAIntrinsic::GenISA_srnd_ftohf)
21674+
{
21675+
if (src0->GetType() != ISA_TYPE_F)
21676+
src0 = m_currShader->GetNewAlias(src0, ISA_TYPE_F, 0, 0);
21677+
}
21678+
if (GID == GenISAIntrinsic::GenISA_srnd_hftobf8
21679+
)
21680+
{
21681+
if (src0->GetType() != ISA_TYPE_HF)
21682+
src0 = m_currShader->GetNewAlias(src0, ISA_TYPE_HF, 0, 0);
2167121683
}
2167221684

2167321685
uint16_t nsimdsize = numLanes(m_currShader->m_SIMDSize);

IGC/Compiler/CISACodeGen/EmitVISAPass.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,7 @@ class EmitPass : public llvm::FunctionPass
642642
bool shouldGenerateLSC(llvm::Instruction* vectorLdStInst = nullptr, bool isTGM = false);
643643
bool forceCacheCtrl(llvm::Instruction* vectorLdStInst = nullptr);
644644
uint32_t totalBytesToStoreOrLoad(llvm::Instruction* vectorLdStInst);
645-
void emitsrnd(llvm::GenIntrinsicInst* GII);
645+
void emitSrnd(llvm::GenIntrinsicInst* GII);
646646
void emitStaticConstantPatchValue(
647647
llvm::StaticConstantPatchIntrinsic* staticConstantPatch32);
648648
// Debug Built-Ins

0 commit comments

Comments
 (0)