@@ -483,37 +483,37 @@ namespace IGC
483483 assert (m_encoderState.m_flag .var == nullptr && " predicate not supported" );
484484 VISA_StateOpndHandle* pSurfStateOpndHandle = GetVISASurfaceOpnd (resource);
485485 VISA_PredOpnd* predOpnd = GetFlagOperand (m_encoderState.m_flag );
486- VISA_RawOpnd* pDst = GetRawDestination (dst);
487- VISA_RawOpnd* pElemOffset = GetRawSource (elem_offset);
488- VISA_RawOpnd* pSrc0 = GetRawSource (src0);
489- VISA_RawOpnd* pSrc1 = GetRawSource (src1);
490-
491- /*
492- So the problem is this - the message was added for SNB, and at the time it was implemented as
493- CMPXCHG : new = (old==src1) ? src0 : old
494-
495- In IVB this becomes untyped atomic, and it's implemented as
496- AOP_CMPWR (src0 == old_dst) ? src1 : old_dst old_dst
497-
498- Note that the source is swapped. Since we define CMPXCHG as the former in vISA, internally we
499- perform a swap for it. So I guess for now you'll need to swap the two source to follow the vISA
500- semantics. We may want to add a new vISA message to fix this issue.
501- */
502- if (atomic_op == EATOMIC_CMPXCHG) {
503- std::swap (pSrc0, pSrc1);
504- }
486+ VISA_RawOpnd* pDst = GetRawDestination (dst);
487+ VISA_RawOpnd* pElemOffset = GetRawSource (elem_offset);
488+ VISA_RawOpnd* pSrc0 = GetRawSource (src0);
489+ VISA_RawOpnd* pSrc1 = GetRawSource (src1);
505490
506- V (vKernel->AppendVISASurfAccessDwordAtomicInst (
507- predOpnd,
508- convertAtomicOpEnumToVisa (atomic_op),
509- is16Bit,
510- ConvertMaskToVisaType (m_encoderState.m_mask , m_encoderState.m_noMask ),
511- visaExecSize (m_encoderState.m_simdSize ),
512- pSurfStateOpndHandle,
513- pElemOffset,
514- pSrc0,
515- pSrc1,
516- pDst));
491+ /*
492+ So the problem is this - the message was added for SNB, and at the time it was implemented as
493+ CMPXCHG : new = (old==src1) ? src0 : old
494+
495+ In IVB this becomes untyped atomic, and it's implemented as
496+ AOP_CMPWR (src0 == old_dst) ? src1 : old_dst old_dst
497+
498+ Note that the source is swapped. Since we define CMPXCHG as the former in vISA, internally we
499+ perform a swap for it. So I guess for now you'll need to swap the two source to follow the vISA
500+ semantics. We may want to add a new vISA message to fix this issue.
501+ */
502+ if (atomic_op == EATOMIC_CMPXCHG) {
503+ std::swap (pSrc0, pSrc1);
504+ }
505+
506+ V (vKernel->AppendVISASurfAccessDwordAtomicInst (
507+ predOpnd,
508+ convertAtomicOpEnumToVisa (atomic_op),
509+ is16Bit,
510+ ConvertMaskToVisaType (m_encoderState.m_mask , m_encoderState.m_noMask ),
511+ visaExecSize (m_encoderState.m_simdSize ),
512+ pSurfStateOpndHandle,
513+ pElemOffset,
514+ pSrc0,
515+ pSrc1,
516+ pDst));
517517 }
518518
519519 void CEncoder::Cmp (e_predicate p, CVariable* dst, CVariable* src0, CVariable* src1)
0 commit comments