Skip to content

Commit 61f31fa

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: 69efb32: Support SPV_INTEL_maximum_registers extension
.
1 parent fc58546 commit 61f31fa

File tree

7 files changed

+13
-205
lines changed

7 files changed

+13
-205
lines changed

IGC/VectorCompiler/include/vc/Utils/GenX/KernelInfo.h

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ SPDX-License-Identifier: MIT
2626
#include "llvm/GenXIntrinsics/GenXMetadata.h"
2727

2828
#include <cstdint>
29-
#include <optional>
3029
#include <type_traits>
3130
#include <unordered_map>
3231

@@ -117,14 +116,6 @@ template <typename Ty = llvm::Value> Ty *getValueAsMetadata(llvm::Metadata *M) {
117116
return nullptr;
118117
}
119118

120-
template <typename Ty = llvm::Value>
121-
Ty *getValueAsMetadata(const llvm::Metadata *M) {
122-
if (auto *VM = llvm::dyn_cast<llvm::ValueAsMetadata>(M))
123-
if (auto *V = llvm::dyn_cast<Ty>(VM->getValue()))
124-
return V;
125-
return nullptr;
126-
}
127-
128119
// Number of barriers can only be 0, 1, 2, 4, 8, 16, 24, 32.
129120
// Alignment here means choosing nearest overlapping legal number of barriers.
130121
static unsigned alignBarrierCnt(unsigned BarrierCnt) {
@@ -187,13 +178,6 @@ class KernelMetadata {
187178
Fixed = 4,
188179
};
189180

190-
// TODO: Use SPIR-V headers.
191-
enum class ExecutionMode {
192-
MaximumRegistersINTEL = 6461,
193-
MaximumRegistersIdINTEL = 6462,
194-
NamedMaximumRegistersINTEL = 6463
195-
};
196-
197181
private:
198182
const llvm::Function *F = nullptr;
199183
llvm::MDNode *ExternalNode = nullptr;
@@ -211,9 +195,6 @@ class KernelMetadata {
211195
std::vector<int> BTIs;
212196
ArgToImplicitLinearization Linearization;
213197

214-
// Optional SPIR-V execution mode.
215-
std::optional<unsigned> GRFSize;
216-
217198
public:
218199
// default constructor
219200
KernelMetadata() {}
@@ -240,8 +221,6 @@ class KernelMetadata {
240221
void updateBTIndicesMD(std::vector<int> &&BTIs);
241222
void updateSLMSizeMD(unsigned Size);
242223

243-
void parseExecutionMode(llvm::MDNode *SpirvExecutionMode);
244-
245224
bool hasArgLinearization(llvm::Argument *Arg) const {
246225
return Linearization.count(Arg);
247226
}
@@ -290,8 +269,6 @@ class KernelMetadata {
290269
return ArgTypeDescs[Idx];
291270
}
292271

293-
std::optional<unsigned> getGRFSize() const { return GRFSize; }
294-
295272
enum { AK_NORMAL, AK_SAMPLER, AK_SURFACE };
296273
RegCategory getArgCategory(unsigned Idx) const {
297274
switch (getArgKind(Idx) & 7) {

IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -907,11 +907,10 @@ static bool isExtOperandBaled(Use &U, const GenXBaling *Baling) {
907907

908908
// Args:
909909
// HasBarrier - whether kernel has barrier or sbarrier
910-
static void addKernelAttrsFromMetadata(VISAKernel &Kernel,
911-
const vc::KernelMetadata &KM,
912-
const GenXSubtarget *Subtarget,
913-
const GenXBackendConfig *BC,
914-
bool HasBarrier) {
910+
void addKernelAttrsFromMetadata(VISAKernel &Kernel,
911+
const vc::KernelMetadata &KM,
912+
const GenXSubtarget *Subtarget,
913+
bool HasBarrier) {
915914
unsigned SLMSizeInKb = divideCeil(KM.getSLMSize(), 1024);
916915
if (SLMSizeInKb > Subtarget->getMaxSlmSize())
917916
report_fatal_error("SLM size exceeds target limits");
@@ -944,21 +943,6 @@ static void addKernelAttrsFromMetadata(VISAKernel &Kernel,
944943
static_cast<uint8_t>(KM.getAlignedBarrierCnt(HasBarrier));
945944
Kernel.AddKernelAttribute("NBarrierCnt", sizeof(BarrierCnt), &BarrierCnt);
946945
}
947-
948-
// Default number of registers.
949-
unsigned NumGRF = 128;
950-
// Set by compile option.
951-
if (BC->isAutoLargeGRFMode())
952-
NumGRF = 0;
953-
if (BC->getGRFSize())
954-
NumGRF = BC->getGRFSize();
955-
// Set by kernel metadata.
956-
if (KM.getGRFSize()) {
957-
unsigned NumGRFPerKernel = *KM.getGRFSize();
958-
if (NumGRFPerKernel == 0 || Subtarget->isValidGRFSize(NumGRFPerKernel))
959-
NumGRF = NumGRFPerKernel;
960-
}
961-
Kernel.AddKernelAttribute("NumGRF", sizeof(NumGRF), &NumGRF);
962946
}
963947

964948
// Legalize name for using as filename or in visa asm
@@ -1017,8 +1001,7 @@ void GenXKernelBuilder::runOnKernel() {
10171001
IGC_ASSERT_MESSAGE(Kernel, "Kernel initialization failed!");
10181002
LLVM_DEBUG(dbgs() << "=== PROCESS KERNEL(" << KernelName << ") ===\n");
10191003

1020-
addKernelAttrsFromMetadata(*Kernel, TheKernelMetadata, Subtarget,
1021-
BackendConfig, HasBarrier);
1004+
addKernelAttrsFromMetadata(*Kernel, TheKernelMetadata, Subtarget, HasBarrier);
10221005

10231006
// Set CM target for all functions produced by VC.
10241007
// See visa spec for CMTarget value (section 4, Kernel).
@@ -5835,6 +5818,13 @@ collectFinalizerArgs(StringSaver &Saver, const GenXSubtarget &ST,
58355818
if (ST.needsWANoMaskFusedEU() && !DisableNoMaskWA)
58365819
addArgument("-noMaskWA");
58375820

5821+
unsigned GRFSize = BC.getGRFSize();
5822+
if (GRFSize > 0) {
5823+
addArgument("-TotalGRFNum");
5824+
addArgument(to_string(GRFSize));
5825+
} else if (BC.isAutoLargeGRFMode())
5826+
addArgument("-autoGRFSelection");
5827+
58385828
if (ST.hasFusedEU()) {
58395829
addArgument("-fusedCallWA");
58405830
addArgument("1");

IGC/VectorCompiler/lib/GenXCodeGen/GenXSubtarget.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ SPDX-License-Identifier: MIT
2727
#include "Probe/Assertion.h"
2828
#include "common/StringMacros.hpp"
2929

30-
#include <unordered_set>
31-
3230
using namespace llvm;
3331

3432
#define DEBUG_TYPE "subtarget"
@@ -276,18 +274,3 @@ bool GenXSubtarget::isInternalIntrinsicSupported(unsigned ID) const {
276274

277275
return true;
278276
}
279-
280-
bool GenXSubtarget::isValidGRFSize(unsigned Size) const {
281-
switch (TargetId) {
282-
case GenXSubtarget::XeHP:
283-
case GenXSubtarget::XeHPG:
284-
case GenXSubtarget::XeLPG:
285-
case GenXSubtarget::XeLPGPlus:
286-
case GenXSubtarget::XeHPC:
287-
case GenXSubtarget::XeHPCVG:
288-
case GenXSubtarget::Xe2:
289-
return Size == 128 || Size == 256;
290-
default:
291-
return Size == 128; // platforms <= TGL
292-
}
293-
}

IGC/VectorCompiler/lib/GenXCodeGen/GenXSubtarget.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,6 @@ class GenXSubtarget final : public GenXGenSubtargetInfo {
457457
PreDefined_Surface stackSurface() const { return StackSurf; }
458458

459459
bool isIntrinsicSupported(unsigned ID) const;
460-
bool isValidGRFSize(unsigned Size) const;
461460
};
462461

463462
} // namespace llvm

IGC/VectorCompiler/lib/Utils/GenX/KernelInfo.cpp

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*========================== begin_copyright_notice ============================
22
3-
Copyright (C) 2021-2024 Intel Corporation
3+
Copyright (C) 2021-2022 Intel Corporation
44
55
SPDX-License-Identifier: MIT
66
@@ -47,12 +47,6 @@ static MDNode *findExternalNode(const Function &F) {
4747
genx::KernelMDOp::ArgTypeDescs);
4848
}
4949

50-
static MDNode *findSpirvExecutionModeNode(const Function &F) {
51-
constexpr unsigned FunctionRef = 0;
52-
constexpr unsigned MinNumOps = 3;
53-
return findNode(F, "spirv.ExecutionMode", FunctionRef, MinNumOps);
54-
};
55-
5650
void vc::internal::createInternalMD(Function &F) {
5751
IGC_ASSERT_MESSAGE(!findInternalNode(F),
5852
"Internal node has already been created!");
@@ -110,13 +104,6 @@ static RetTy extractConstantIntMD(const MDOperand &Op) {
110104
return static_cast<RetTy>(V->getZExtValue());
111105
}
112106

113-
template <typename RetTy = unsigned>
114-
static RetTy extractConstantIntMD(const Metadata &Op) {
115-
const auto *V = getValueAsMetadata<ConstantInt>(&Op);
116-
IGC_ASSERT_MESSAGE(V, "Unexpected null value in metadata");
117-
return static_cast<RetTy>(V->getZExtValue());
118-
}
119-
120107
template <typename Cont>
121108
static void extractConstantsFromMDNode(const MDNode *N, Cont &C) {
122109
if (!N)
@@ -260,11 +247,6 @@ vc::KernelMetadata::KernelMetadata(const Function *F) {
260247
}
261248
if (LinearizationNode)
262249
Linearization = extractLinearizationMD(*F, LinearizationNode);
263-
264-
MDNode *SpirvExecutionMode = findSpirvExecutionModeNode(*F);
265-
if (!SpirvExecutionMode)
266-
return;
267-
parseExecutionMode(SpirvExecutionMode);
268250
}
269251

270252
static MDNode *createArgLinearizationMD(const ImplicitLinearizationInfo &Info) {
@@ -357,32 +339,6 @@ void vc::KernelMetadata::updateSLMSizeMD(unsigned Size) {
357339
ValueAsMetadata::get(C));
358340
}
359341

360-
void vc::KernelMetadata::parseExecutionMode(MDNode *SpirvExecutionMode) {
361-
IGC_ASSERT(SpirvExecutionMode->getNumOperands() >= 3);
362-
363-
auto &EMode = SpirvExecutionMode->getOperand(1);
364-
auto &EModeVal = SpirvExecutionMode->getOperand(2);
365-
auto EModeId = static_cast<ExecutionMode>(extractConstantIntMD(EMode));
366-
switch (EModeId) {
367-
case ExecutionMode::MaximumRegistersINTEL:
368-
GRFSize = extractConstantIntMD(*(EModeVal.get()));
369-
return;
370-
case ExecutionMode::MaximumRegistersIdINTEL: {
371-
auto *GRFSizeNode = cast<MDNode>(EModeVal.get());
372-
GRFSize = extractConstantIntMD(*(GRFSizeNode->getOperand(0)));
373-
return;
374-
}
375-
case ExecutionMode::NamedMaximumRegistersINTEL: {
376-
auto *NamedExecMode = cast<MDString>(EModeVal.get());
377-
IGC_ASSERT_EXIT_MESSAGE(!NamedExecMode->getString().compare("AutoINTEL"),
378-
"Unhandled NamedMaximumRegisters value");
379-
GRFSize = 0;
380-
return;
381-
}
382-
}
383-
IGC_ASSERT_EXIT_MESSAGE(0, "Unhandled execution mode!");
384-
}
385-
386342
bool vc::hasKernel(const Module &M) {
387343
NamedMDNode *KernelsMD = M.getNamedMetadata(genx::FunctionMD::GenXKernels);
388344
if (!KernelsMD)

IGC/VectorCompiler/test/CisaBuilder/exec_mode.ll

Lines changed: 0 additions & 30 deletions
This file was deleted.

IGC/VectorCompiler/test/CisaBuilder/grf_size.ll

Lines changed: 0 additions & 67 deletions
This file was deleted.

0 commit comments

Comments
 (0)