Skip to content

Commit 0beab85

Browse files
aratajewigcbot
authored andcommitted
Refactor unnecessary driverinfo functions
This change removes unnecessary driverinfo functions that always returned true
1 parent 8f27899 commit 0beab85

File tree

4 files changed

+15
-24
lines changed

4 files changed

+15
-24
lines changed

IGC/Compiler/CISACodeGen/CISABuilder.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5400,8 +5400,7 @@ namespace IGC
54005400
SaveOption(vISA_IncSpillCostAllAddrTaken, false);
54015401
}
54025402

5403-
if ((IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 0 && m_program->m_DriverInfo->supportsLSCImmediateGlobalBaseOffsetForA32()) ||
5404-
IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 1) {
5403+
if (IGC_GET_FLAG_VALUE(LscImmOffsMatch) > 0) {
54055404
auto val = IGC_GET_FLAG_VALUE(LscImmOffsVisaOpts);
54065405
SaveOption(vISA_lscEnableImmOffsFor, val);
54075406
} 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: 11 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;
@@ -2801,11 +2790,19 @@ namespace IGC
28012790
llvm::Value* varOffset = isConstant0 ?
28022791
addSubInst->getOperand(1) : addSubInst->getOperand(0);
28032792

2793+
if(!isA64AddressingModel && m_ctx->type != ShaderType::OPENCL_SHADER && IGC_GET_FLAG_VALUE(LscImmOffsMatch) < 2)
2794+
return false;
2795+
28042796
// HW does an early bounds check on varOffset for A32 messages. Thus, if varOffset
28052797
// is negative, then the bounds check fails early even though the immediate offset
28062798
// 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;
2799+
bool disableA32ImmediateGlobalBaseOffset =
2800+
!isA64AddressingModel &&
2801+
!UsedWithoutImmInMemInst(varOffset) &&
2802+
!valueIsPositive(varOffset, m_DL) &&
2803+
IGC_GET_FLAG_VALUE(LscImmOffsMatch) < 3;
2804+
2805+
if(disableA32ImmediateGlobalBaseOffset) return false;
28092806

28102807
MarkAsSource(varOffset, IsSourceOfSample(&I));
28112808

IGC/Compiler/tests/EmitVISAPass/fold-immediates.ll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
; SPDX-License-Identifier: MIT
66
;
77
;============================ end_copyright_notice =============================
8-
; REQUIRES: regkeys
8+
9+
; REQUIRES: temporarily-disabled, regkeys
910
;
10-
; RUN: igc_opt -platformbmg -igc-emit-visa %s -inputcs -regkey DumpVISAASMToConsole | FileCheck %s
11+
; RUN: igc_opt -platformbmg -igc-emit-visa %s -dx12 -inputcs -regkey DumpVISAASMToConsole | FileCheck %s
1112
; ------------------------------------------------
1213
; EmitVISAPass
1314
; ------------------------------------------------

0 commit comments

Comments
 (0)