Skip to content

Commit 7adfd76

Browse files
MaciejKalinskiZuul
authored andcommitted
GenISA_WaveClustered implementation fix for 8-bit integers.
It sets up correct identity value for the cases when 8-bit integer operations are performed, after conversion, on 16-bit integer data types. Change-Id: Ia18556dfece0085b13ea36040586748f709282bf
1 parent d9ed861 commit 7adfd76

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10725,9 +10725,11 @@ void EmitPass::emitReductionClustered(const e_opcode op, const uint64_t identity
1072510725
VISA_Type tmpType = type;
1072610726
CVariable* tmpSrc = src;
1072710727
CVariable* tmpDst = dst;
10728+
uint64_t tmpIdentityValue = identityValue;
1072810729
if (type == VISA_Type::ISA_TYPE_B || type == VISA_Type::ISA_TYPE_UB)
1072910730
{
10730-
tmpType = type == VISA_Type::ISA_TYPE_B ? VISA_Type::ISA_TYPE_W : VISA_Type::ISA_TYPE_UW;
10731+
const bool isSigned = type == VISA_Type::ISA_TYPE_B;
10732+
tmpType = isSigned ? VISA_Type::ISA_TYPE_W : VISA_Type::ISA_TYPE_UW;
1073110733
tmpSrc = m_currShader->GetNewVariable(
1073210734
src->GetNumberElement(),
1073310735
tmpType,
@@ -10742,9 +10744,25 @@ void EmitPass::emitReductionClustered(const e_opcode op, const uint64_t identity
1074210744
tmpType,
1074310745
IGC::EALIGN_DWORD,
1074410746
false);
10747+
switch (op)
10748+
{
10749+
case EOPCODE_MAX:
10750+
tmpIdentityValue = isSigned ? std::numeric_limits<int16_t>::min() :
10751+
std::numeric_limits<uint16_t>::min();
10752+
break;
10753+
case EOPCODE_MIN:
10754+
tmpIdentityValue = isSigned ? std::numeric_limits<int16_t>::max() :
10755+
std::numeric_limits<uint16_t>::max();
10756+
break;
10757+
case EOPCODE_AND:
10758+
tmpIdentityValue = 0xFFFF;
10759+
break;
10760+
default:
10761+
break;
10762+
}
1074510763
}
1074610764

10747-
CVariable* temp = ScanReducePrepareSrc(tmpType, identityValue, negate, secondHalf, tmpSrc, nullptr);
10765+
CVariable* temp = ScanReducePrepareSrc(tmpType, tmpIdentityValue, negate, secondHalf, tmpSrc, nullptr);
1074810766

1074910767
SIMDMode simd = secondHalf ? SIMDMode::SIMD16 : m_currShader->m_SIMDSize;
1075010768

IGC/Compiler/CISACodeGen/WIAnalysis.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ WIAnalysis::WIDependancy WIAnalysisRunner::calculate_dep(const CallInst* inst)
11551155
constexpr unsigned maxSimdSize = 32;
11561156
if (clusterSize == maxSimdSize)
11571157
{
1158-
// TODO: do the same for SIMD8 and SIM16 if possible.
1158+
// TODO: do the same for SIMD8 and SIMD16 if possible.
11591159
return WIAnalysis::UNIFORM;
11601160
}
11611161
}

0 commit comments

Comments
 (0)