Skip to content

Commit ae2b64d

Browse files
aratajewigcbot
authored andcommitted
Disable immediate global base offset optimization in VISA
Immediate global base offset generation is now completely disabled in VISA, regardless of message type.
1 parent af6195d commit ae2b64d

File tree

3 files changed

+13
-22
lines changed

3 files changed

+13
-22
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5395,8 +5395,11 @@ namespace IGC
53955395
SaveOption(vISA_IncSpillCostAllAddrTaken, false);
53965396
}
53975397

5398-
if ((IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 0 && m_program->m_DriverInfo->supportsLSCImmediateGlobalBaseOffsetForA32()) ||
5399-
IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 1) {
5398+
5399+
bool enableLscImmOffsMatch =
5400+
IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 1;
5401+
5402+
if (enableLscImmOffsMatch) {
54005403
auto val = IGC_GET_FLAG_VALUE(LscImmOffsVisaOpts);
54015404
SaveOption(vISA_lscEnableImmOffsFor, val);
54025405
} else {

IGC/Compiler/CISACodeGen/DriverInfo.hpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,6 @@ namespace IGC
370370
// Specifies alignment of indirect data
371371
virtual unsigned getCrossThreadDataAlignment() const { return 32; }
372372

373-
// Informs if LSC immediate global offset for A64 is supported
374-
virtual bool supportsLSCImmediateGlobalBaseOffsetForA64() const { return true; }
375-
376-
// Informs if LSC immediate global offset for A32 is supported
377-
virtual bool supportsLSCImmediateGlobalBaseOffsetForA32() const { return true; }
378-
379373
// If enabled IGC must not hoist convergent instructions.
380374
virtual bool DisableConvergentInstructionsHoisting() const { return false; }
381375

IGC/Compiler/CISACodeGen/PatternMatchPass.cpp

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -420,10 +420,7 @@ namespace IGC
420420

421421
bool CodeGenPatternMatch::supportsLSCImmediateGlobalBaseOffset()
422422
{
423-
bool res = IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 1 ||
424-
(m_Platform.matchImmOffsetsLSC() &&
425-
(m_ctx->m_DriverInfo.supportsLSCImmediateGlobalBaseOffsetForA64() ||
426-
m_ctx->m_DriverInfo.supportsLSCImmediateGlobalBaseOffsetForA32()));
423+
bool res = IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 1 || m_Platform.matchImmOffsetsLSC();
427424
return res;
428425
}
429426

@@ -2764,14 +2761,6 @@ namespace IGC
27642761
bool isA64AddressingModel = addInstType->isPointerTy() &&
27652762
IGC::isA64Ptr(cast<PointerType>(addInstType), m_ctx);
27662763

2767-
bool isSupportedCase =
2768-
(isA64AddressingModel && m_ctx->m_DriverInfo.supportsLSCImmediateGlobalBaseOffsetForA64()) ||
2769-
(!isA64AddressingModel && m_ctx->m_DriverInfo.supportsLSCImmediateGlobalBaseOffsetForA32()) ||
2770-
IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 1;
2771-
if (!isSupportedCase)
2772-
{
2773-
return false;
2774-
}
27752764
llvm::Instruction* intToPtrInst = nullptr;
27762765
if (addSubInst->getOpcode() == llvm::Instruction::IntToPtr) {
27772766
intToPtrInst = addSubInst;
@@ -2804,8 +2793,13 @@ namespace IGC
28042793
// HW does an early bounds check on varOffset for A32 messages. Thus, if varOffset
28052794
// is negative, then the bounds check fails early even though the immediate offset
28062795
// would bring the final calculation to a positive number.
2807-
if (!isA64AddressingModel && !UsedWithoutImmInMemInst(varOffset) && !valueIsPositive(varOffset, m_DL) && IGC_GET_FLAG_VALUE(LscImmOffsMatch) < 3)
2808-
return false;
2796+
bool disableA32ImmediateGlobalBaseOffset =
2797+
!isA64AddressingModel &&
2798+
!UsedWithoutImmInMemInst(varOffset) &&
2799+
!valueIsPositive(varOffset, m_DL) &&
2800+
IGC_GET_FLAG_VALUE(LscImmOffsMatch) < 3;
2801+
2802+
if(disableA32ImmediateGlobalBaseOffset) return false;
28092803

28102804
MarkAsSource(varOffset, IsSourceOfSample(&I));
28112805

0 commit comments

Comments
 (0)