Skip to content

Commit 9a68f3c

Browse files
ppogotovpszymich
authored andcommitted
[Autobackout][FuncReg]Revert of change: b796a87
Applied EmitScalarAtomics for 64 bit uniform atomics 3rd try 3rd try Extended EmitScalarAtomics function for atomics with 64 bit type
1 parent f6d9d44 commit 9a68f3c

File tree

1 file changed

+5
-36
lines changed

1 file changed

+5
-36
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -12726,10 +12726,6 @@ void EmitPass::emitScalarAtomics(
1272612726
{
1272712727
case EATOMIC_IADD:
1272812728
case EATOMIC_SUB:
12729-
case EATOMIC_IADD64:
12730-
case EATOMIC_SUB64:
12731-
case EATOMIC_FADD64:
12732-
case EATOMIC_FSUB64:
1273312729
case EATOMIC_INC:
1273412730
case EATOMIC_DEC:
1273512731
case EATOMIC_FADD:
@@ -12775,18 +12771,13 @@ void EmitPass::emitScalarAtomics(
1277512771
{
1277612772
type = ISA_TYPE_F;
1277712773
}
12778-
else if (atomic_op == EATOMIC_FADD64 || atomic_op == EATOMIC_FSUB64)
12779-
{
12780-
type = ISA_TYPE_DF;
12781-
}
1278212774
else
1278312775
{
1278412776
type =
1278512777
bitWidth == 16 ? ISA_TYPE_W :
1278612778
bitWidth == 32 ? ISA_TYPE_D :
1278712779
ISA_TYPE_Q;
1278812780
}
12789-
1279012781
IGC_ASSERT_MESSAGE((bitWidth == 16) || (bitWidth == 32) || (bitWidth == 64), "invalid bitsize");
1279112782
if (atomic_op == EATOMIC_INC || atomic_op == EATOMIC_DEC)
1279212783
{
@@ -12980,7 +12971,7 @@ void EmitPass::emitScalarAtomics(
1298012971
m_encoder->Add(pSrcsArr[i], pSrcsArr[i], pReturnVal);
1298112972
m_encoder->Push();
1298212973

12983-
if (atomic_op == EATOMIC_IADD || atomic_op == EATOMIC_IADD64)
12974+
if (atomic_op == EATOMIC_IADD)
1298412975
{
1298512976
m_encoder->SetSrcModifier(1, EMOD_NEG);
1298612977
}
@@ -13110,32 +13101,14 @@ bool EmitPass::IsUniformAtomic(llvm::Instruction* pInst)
1311013101
{
1311113102
Function* F = pInst->getParent()->getParent();
1311213103
//We cannot optimize float atomics if the flag "unsafe-fp-math" was not passed.
13113-
if (id == GenISAIntrinsic::GenISA_floatatomicrawA64)
13114-
{
13115-
if (!F->hasFnAttribute("unsafe-fp-math") || !(F->getFnAttribute("unsafe-fp-math").getValueAsString() == "true"))
13116-
{
13104+
if (id == GenISAIntrinsic::GenISA_floatatomicrawA64) {
13105+
if (pInst->getType()->getScalarSizeInBits() != 32) {
1311713106
return false;
1311813107
}
13119-
}
13120-
13121-
if (pInst->getType()->getScalarSizeInBits() == 64)
13122-
{
13123-
AtomicOp atomic_op = static_cast<AtomicOp>(llvm::cast<llvm::ConstantInt>(pInst->getOperand(3))->getZExtValue());
13124-
13125-
if ((atomic_op == EATOMIC_IADD64 || atomic_op == EATOMIC_SUB64) && m_currShader->m_Platform->hasInt64Add())
13126-
{
13127-
return true;
13128-
}
13129-
else if ((atomic_op == EATOMIC_FADD64 || atomic_op == EATOMIC_FSUB64) && m_currShader->m_Platform->hasFP64GlobalAtomicAdd())
13130-
{
13131-
return true;
13132-
}
13133-
else
13134-
{
13108+
if (!F->hasFnAttribute("unsafe-fp-math") || !(F->getFnAttribute("unsafe-fp-math").getValueAsString() == "true")) {
1313513109
return false;
1313613110
}
1313713111
}
13138-
1313913112
if (IGC_IS_FLAG_ENABLED(DisableScalarAtomics) ||
1314013113
F->hasFnAttribute("KMPLOCK") ||
1314113114
m_currShader->m_DriverInfo->WASLMPointersDwordUnit())
@@ -13152,10 +13125,6 @@ bool EmitPass::IsUniformAtomic(llvm::Instruction* pInst)
1315213125

1315313126
bool isAtomicAdd =
1315413127
atomic_op == EATOMIC_IADD ||
13155-
atomic_op == EATOMIC_IADD64 ||
13156-
atomic_op == EATOMIC_SUB64 ||
13157-
atomic_op == EATOMIC_FADD64 ||
13158-
atomic_op == EATOMIC_FSUB64 ||
1315913128
atomic_op == EATOMIC_INC ||
1316013129
atomic_op == EATOMIC_SUB ||
1316113130
atomic_op == EATOMIC_DEC ||
@@ -13324,7 +13293,7 @@ void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst* pInsn)
1332413293
CVariable* pDstAddr = GetSymbol(pllDstAddr);
1332513294
// If DisableScalarAtomics regkey is enabled or DisableIGCOptimizations regkey is enabled then
1332613295
// don't enable scalar atomics, also do not enable for 64 bit
13327-
if (IsUniformAtomic(pInsn))
13296+
if (IsUniformAtomic(pInsn) && bitwidth != 64)
1332813297
{
1332913298
PointerType* PtrTy = dyn_cast<PointerType>(pllDstAddr->getType());
1333013299
bool isA64 = PtrTy && isA64Ptr(PtrTy, m_currShader->GetContext());

0 commit comments

Comments
 (0)