Skip to content

Commit 481cb25

Browse files
ichenkaiigcbot
authored andcommitted
Allow atomic inc/dec for SLM operation
The atomic inc/dec for SLM is blocked by HDC coalesce flag due to legacy platform limitation, which also affects the new generation platforms. This is to enable the atomic inc/dec for SLM on new platforms.
1 parent fbd98bb commit 481cb25

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

IGC/Compiler/CISACodeGen/Platform.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ class CPlatform {
390390
hasNoInt64Inst();
391391
}
392392

393-
bool HDCCoalesceSLMAtomicINCWithNoReturn() const { return m_platformInfo.eRenderCoreFamily >= IGFX_GEN12_CORE; }
393+
bool HDCCoalesceSLMAtomicINCWithNoReturn() const { return m_platformInfo.eRenderCoreFamily == IGFX_GEN12_CORE; }
394394

395395
int LSCCachelineSize() const { return 64; }
396396

IGC/Compiler/CustomSafeOptPass.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -526,9 +526,6 @@ void CustomSafeOptPass::visitIntAtomicIAddToIncOrDec(CallInst *I) {
526526
// %14 = call i32 @llvm.genx.GenISA.intatomicrawA64.i32.p3i32.p3i32(i32 addrspace(3)* %12, i32 addrspace(3)* %12, i32 poison, i32 3)
527527
// clang-format on
528528
if (id == GenISAIntrinsic::GenISA_intatomicraw || id == GenISAIntrinsic::GenISA_intatomicrawA64) {
529-
if (instr->getOperand(0)->getType()->getPointerAddressSpace() == ADDRESS_SPACE_LOCAL)
530-
return;
531-
532529
// for immediate 1 or -1
533530
if (auto *constInt1 = llvm::dyn_cast<llvm::ConstantInt>(instr->getOperand(2))) {
534531
// for atomic_iadd

IGC/Compiler/tests/CustomSafeOptPass/eatomic_iadd_to_inc_dec.ll

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
;============================ end_copyright_notice =============================
88

99
; REQUIRES: llvm-14-plus
10-
; RUN: igc_opt --opaque-pointers --platformdg2 -igc-custom-safe-opt -S < %s --dce | FileCheck %s
10+
; RUN: igc_opt --opaque-pointers --platformbmg -igc-custom-safe-opt -S < %s --dce | FileCheck %s
1111

1212
target datalayout = "e-p:64:64:64-p3:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:32-v128:32:32-a0:0:32-n8:16:32-S32"
1313
target triple = "dxil-ms-dx"
@@ -44,8 +44,8 @@ define void @main(<8 x i32> %r0) {
4444
; CHECK-NEXT: [[TMP10:%.*]] = call i32 @llvm.genx.GenISA.intatomicraw.i32.p2490369v4f32(ptr addrspace(2490369) [[U0]], i32 [[TMP9]], i32 poison, i32 2)
4545
; CHECK-NEXT: [[TMP11:%.*]] = call i32 @llvm.genx.GenISA.intatomicraw.i32.p2490369v4f32(ptr addrspace(2490369) [[U0]], i32 [[TMP9]], i32 poison, i32 3)
4646
; CHECK-NEXT: [[TMP12:%.*]] = getelementptr [32 x i32], ptr addrspace(3) null, i32 0, i32 [[THREADIDX]]
47-
; CHECK-NEXT: [[TMP13:%.*]] = call i32 @llvm.genx.GenISA.intatomicrawA64.i32.p3i32.p3i32(ptr addrspace(3) [[TMP12]], ptr addrspace(3) [[TMP12]], i32 1, i32 0)
48-
; CHECK-NEXT: [[TMP14:%.*]] = call i32 @llvm.genx.GenISA.intatomicrawA64.i32.p3i32.p3i32(ptr addrspace(3) [[TMP12]], ptr addrspace(3) [[TMP12]], i32 -1, i32 0)
47+
; CHECK-NEXT: [[TMP13:%.*]] = call i32 @llvm.genx.GenISA.intatomicrawA64.i32.p3i32.p3i32(ptr addrspace(3) [[TMP12]], ptr addrspace(3) [[TMP12]], i32 poison, i32 2)
48+
; CHECK-NEXT: [[TMP14:%.*]] = call i32 @llvm.genx.GenISA.intatomicrawA64.i32.p3i32.p3i32(ptr addrspace(3) [[TMP12]], ptr addrspace(3) [[TMP12]], i32 poison, i32 3)
4949
; CHECK-NEXT: [[TMP15:%.*]] = load i32, ptr addrspace(3) [[TMP12]], align 4, !tbaa !18
5050
; CHECK-NEXT: [[TMP16:%.*]] = insertelement <1 x i32> undef, i32 [[TMP15]], i64 0
5151
; CHECK-NEXT: call void @llvm.genx.GenISA.storerawvector.indexed.p2490369v4f32.v1i32(ptr addrspace(2490369) [[U0]], i32 0, <1 x i32> [[TMP16]], i32 4, i1 false)

0 commit comments

Comments
 (0)