@@ -13329,10 +13329,6 @@ void EmitPass::emitScalarAtomics(
1332913329 {
1333013330 case EATOMIC_IADD:
1333113331 case EATOMIC_SUB:
13332- case EATOMIC_IADD64:
13333- case EATOMIC_SUB64:
13334- case EATOMIC_FADD64:
13335- case EATOMIC_FSUB64:
1333613332 case EATOMIC_INC:
1333713333 case EATOMIC_DEC:
1333813334 case EATOMIC_FADD:
@@ -13378,18 +13374,13 @@ void EmitPass::emitScalarAtomics(
1337813374 {
1337913375 type = ISA_TYPE_F;
1338013376 }
13381- else if (atomic_op == EATOMIC_FADD64 || atomic_op == EATOMIC_FSUB64)
13382- {
13383- type = ISA_TYPE_DF;
13384- }
1338513377 else
1338613378 {
1338713379 type =
1338813380 bitWidth == 16 ? ISA_TYPE_W :
1338913381 bitWidth == 32 ? ISA_TYPE_D :
1339013382 ISA_TYPE_Q;
1339113383 }
13392-
1339313384 IGC_ASSERT_MESSAGE((bitWidth == 16) || (bitWidth == 32) || (bitWidth == 64), "invalid bitsize");
1339413385 if (atomic_op == EATOMIC_INC || atomic_op == EATOMIC_DEC)
1339513386 {
@@ -13415,22 +13406,6 @@ void EmitPass::emitScalarAtomics(
1341513406 negateSrc = true;
1341613407 uniformAtomicOp = EATOMIC_IADD;
1341713408 }
13418- else if (atomic_op == EATOMIC_SUB64)
13419- {
13420- negateSrc = true;
13421- uniformAtomicOp = EATOMIC_IADD64;
13422- }
13423- else if (atomic_op == EATOMIC_FSUB)
13424- {
13425- negateSrc = true;
13426- uniformAtomicOp = EATOMIC_FADD;
13427- }
13428- else if (atomic_op == EATOMIC_FSUB64)
13429- {
13430- negateSrc = true;
13431- uniformAtomicOp = EATOMIC_FADD64;
13432- }
13433-
1343413409 bool returnsImmValue = (!pInst->use_empty());
1343513410 CVariable* pFinalAtomicSrcVal;
1343613411 CVariable* pSrcsArr[2] = { nullptr, nullptr };
@@ -13555,27 +13530,9 @@ void EmitPass::emitScalarAtomics(
1355513530 m_encoder->SetSimdSize(SIMDMode::SIMD1);
1355613531 m_encoder->SetNoMask();
1355713532
13558- VISA_Type pReturnValType;
13559- if (type == ISA_TYPE_Q)
13560- {
13561- pReturnValType = ISA_TYPE_UQ;
13562- }
13563- else if (type == ISA_TYPE_DF)
13564- {
13565- pReturnValType = ISA_TYPE_DF;
13566- }
13567- else if (type == ISA_TYPE_F)
13568- {
13569- pReturnValType = ISA_TYPE_F;
13570- }
13571- else
13572- {
13573- pReturnValType = ISA_TYPE_UD;
13574- }
13575-
1357613533 CVariable* pReturnVal = returnsImmValue ?
1357713534 m_currShader->GetNewVariable(
13578- 1, pReturnValType , EALIGN_GRF, true, CName::NONE) :
13535+ 1, ISA_TYPE_UD , EALIGN_GRF, true, CName::NONE) :
1357913536 nullptr;
1358013537
1358113538 if (bitWidth == 16)
@@ -13621,7 +13578,7 @@ void EmitPass::emitScalarAtomics(
1362113578 m_encoder->Add(pSrcsArr[i], pSrcsArr[i], pReturnVal);
1362213579 m_encoder->Push();
1362313580
13624- if (atomic_op == EATOMIC_IADD || atomic_op == EATOMIC_IADD64 || atomic_op == EATOMIC_FADD || atomic_op == EATOMIC_FADD64 )
13581+ if (atomic_op == EATOMIC_IADD)
1362513582 {
1362613583 m_encoder->SetSrcModifier(1, EMOD_NEG);
1362713584 }
@@ -13751,30 +13708,14 @@ bool EmitPass::IsUniformAtomic(llvm::Instruction* pInst)
1375113708 {
1375213709 Function* F = pInst->getParent()->getParent();
1375313710 //We cannot optimize float atomics if the flag "unsafe-fp-math" was not passed.
13754-
13755- unsigned short bitwidth = pInst->getType()->getScalarSizeInBits();
13756- //We cannot optimize float and double atomics if the flag "unsafe-fp-math" was not passed.
13757- if (id == GenISAIntrinsic::GenISA_floatatomicrawA64)
13758- {
13759- if (!F->hasFnAttribute("unsafe-fp-math") || !(F->getFnAttribute("unsafe-fp-math").getValueAsString() == "true") || bitwidth == 16)
13760- {
13711+ if (id == GenISAIntrinsic::GenISA_floatatomicrawA64) {
13712+ if (pInst->getType()->getScalarSizeInBits() != 32) {
1376113713 return false;
1376213714 }
13763- }
13764-
13765- if (bitwidth == 64)
13766- {
13767- AtomicOp atomic_op = static_cast<AtomicOp>(llvm::cast<llvm::ConstantInt>(pInst->getOperand(3))->getZExtValue());
13768-
13769- bool is_i64 = (atomic_op == EATOMIC_IADD64 || atomic_op == EATOMIC_SUB64);
13770- bool is_f64 = (atomic_op == EATOMIC_FADD64 || atomic_op == EATOMIC_FSUB64);
13771-
13772- if ((!is_i64 || !m_currShader->m_Platform->hasInt64Add()) && (!is_f64 || !m_currShader->m_Platform->hasFP64GlobalAtomicAdd()))
13773- {
13715+ if (!F->hasFnAttribute("unsafe-fp-math") || !(F->getFnAttribute("unsafe-fp-math").getValueAsString() == "true")) {
1377413716 return false;
1377513717 }
1377613718 }
13777-
1377813719 if (IGC_IS_FLAG_ENABLED(DisableScalarAtomics) ||
1377913720 F->hasFnAttribute("KMPLOCK") ||
1378013721 m_currShader->m_DriverInfo->WASLMPointersDwordUnit())
@@ -13791,10 +13732,6 @@ bool EmitPass::IsUniformAtomic(llvm::Instruction* pInst)
1379113732
1379213733 bool isAtomicAdd =
1379313734 atomic_op == EATOMIC_IADD ||
13794- atomic_op == EATOMIC_IADD64 ||
13795- atomic_op == EATOMIC_SUB64 ||
13796- atomic_op == EATOMIC_FADD64 ||
13797- atomic_op == EATOMIC_FSUB64 ||
1379813735 atomic_op == EATOMIC_INC ||
1379913736 atomic_op == EATOMIC_SUB ||
1380013737 atomic_op == EATOMIC_DEC ||
@@ -13962,8 +13899,8 @@ void EmitPass::emitAtomicRaw(llvm::GenIntrinsicInst* pInsn)
1396213899 // Dst address in bytes.
1396313900 CVariable* pDstAddr = GetSymbol(pllDstAddr);
1396413901 // If DisableScalarAtomics regkey is enabled or DisableIGCOptimizations regkey is enabled then
13965- // don't enable scalar atomics
13966- if (IsUniformAtomic(pInsn))
13902+ // don't enable scalar atomics, also do not enable for 64 bit
13903+ if (IsUniformAtomic(pInsn) && bitwidth != 64 )
1396713904 {
1396813905 PointerType* PtrTy = dyn_cast<PointerType>(pllDstAddr->getType());
1396913906 bool isA64 = PtrTy && isA64Ptr(PtrTy, m_currShader->GetContext());
0 commit comments