Skip to content

Commit b4e4cc3

Browse files
sys-igcigcbot
authored andcommitted
[Autobackout][FunctionalRegression]Revert of change: adca572: Support SPV_INTEL_maximum_registers extension
.
1 parent 2cd5bba commit b4e4cc3

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

@@ -139,14 +138,6 @@ template <typename Ty = llvm::Value> Ty *getValueAsMetadata(llvm::Metadata *M) {
139138
return nullptr;
140139
}
141140

142-
template <typename Ty = llvm::Value>
143-
Ty *getValueAsMetadata(const llvm::Metadata *M) {
144-
if (auto *VM = llvm::dyn_cast<llvm::ValueAsMetadata>(M))
145-
if (auto *V = llvm::dyn_cast<Ty>(VM->getValue()))
146-
return V;
147-
return nullptr;
148-
}
149-
150141
// Number of barriers can only be 0, 1, 2, 4, 8, 16, 24, 32.
151142
// Alignment here means choosing nearest overlapping legal number of barriers.
152143
static unsigned alignBarrierCnt(unsigned BarrierCnt) {
@@ -204,13 +195,6 @@ class KernelMetadata {
204195
Fixed = 4,
205196
};
206197

207-
// TODO: Use SPIR-V headers.
208-
enum class ExecutionMode {
209-
MaximumRegistersINTEL = 6461,
210-
MaximumRegistersIdINTEL = 6462,
211-
NamedMaximumRegistersINTEL = 6463
212-
};
213-
214198
private:
215199
const llvm::Function *F = nullptr;
216200
llvm::MDNode *ExternalNode = nullptr;
@@ -228,9 +212,6 @@ class KernelMetadata {
228212
std::vector<int> BTIs;
229213
ArgToImplicitLinearization Linearization;
230214

231-
// Optional SPIR-V execution mode.
232-
std::optional<unsigned> GRFSize;
233-
234215
public:
235216
// default constructor
236217
KernelMetadata() {}
@@ -258,8 +239,6 @@ class KernelMetadata {
258239
void updateBTIndicesMD(std::vector<int> &&BTIs);
259240
void updateSLMSizeMD(unsigned Size);
260241

261-
void parseExecutionMode(llvm::MDNode *SpirvExecutionMode);
262-
263242
bool hasArgLinearization(llvm::Argument *Arg) const {
264243
return Linearization.count(Arg);
265244
}
@@ -308,8 +287,6 @@ class KernelMetadata {
308287
return ArgTypeDescs[Idx];
309288
}
310289

311-
std::optional<unsigned> getGRFSize() const { return GRFSize; }
312-
313290
enum { AK_NORMAL, AK_SAMPLER, AK_SURFACE };
314291
RegCategory getArgCategory(unsigned Idx) const {
315292
switch (getArgKind(Idx) & 7) {

IGC/VectorCompiler/lib/GenXCodeGen/GenXCisaBuilder.cpp

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

926926
// Args:
927927
// HasBarrier - whether kernel has barrier or sbarrier
928-
static void addKernelAttrsFromMetadata(VISAKernel &Kernel,
929-
const vc::KernelMetadata &KM,
930-
const GenXSubtarget *Subtarget,
931-
const GenXBackendConfig *BC,
932-
bool HasBarrier) {
928+
void addKernelAttrsFromMetadata(VISAKernel &Kernel,
929+
const vc::KernelMetadata &KM,
930+
const GenXSubtarget *Subtarget,
931+
bool HasBarrier) {
933932
auto &Ctx = KM.getFunction()->getContext();
934933
unsigned SLMSizeInKb = divideCeil(KM.getSLMSize(), 1024);
935934
if (SLMSizeInKb > Subtarget->getMaxSlmSize())
@@ -955,21 +954,6 @@ static void addKernelAttrsFromMetadata(VISAKernel &Kernel,
955954
static_cast<uint8_t>(KM.getAlignedBarrierCnt(HasBarrier));
956955
Kernel.AddKernelAttribute("NBarrierCnt", sizeof(BarrierCnt), &BarrierCnt);
957956
}
958-
959-
// Default number of registers.
960-
unsigned NumGRF = 128;
961-
// Set by compile option.
962-
if (BC->isAutoLargeGRFMode())
963-
NumGRF = 0;
964-
if (BC->getGRFSize())
965-
NumGRF = BC->getGRFSize();
966-
// Set by kernel metadata.
967-
if (KM.getGRFSize()) {
968-
unsigned NumGRFPerKernel = *KM.getGRFSize();
969-
if (NumGRFPerKernel == 0 || Subtarget->isValidGRFSize(NumGRFPerKernel))
970-
NumGRF = NumGRFPerKernel;
971-
}
972-
Kernel.AddKernelAttribute("NumGRF", sizeof(NumGRF), &NumGRF);
973957
}
974958

975959
// Legalize name for using as filename or in visa asm
@@ -1028,8 +1012,7 @@ void GenXKernelBuilder::runOnKernel() {
10281012
IGC_ASSERT_MESSAGE(Kernel, "Kernel initialization failed!");
10291013
LLVM_DEBUG(dbgs() << "=== PROCESS KERNEL(" << KernelName << ") ===\n");
10301014

1031-
addKernelAttrsFromMetadata(*Kernel, TheKernelMetadata, Subtarget,
1032-
BackendConfig, HasBarrier);
1015+
addKernelAttrsFromMetadata(*Kernel, TheKernelMetadata, Subtarget, HasBarrier);
10331016

10341017
// Set CM target for all functions produced by VC.
10351018
// See visa spec for CMTarget value (section 4, Kernel).
@@ -5866,6 +5849,13 @@ collectFinalizerArgs(StringSaver &Saver, const GenXSubtarget &ST,
58665849
if (ST.needsWANoMaskFusedEU() && !DisableNoMaskWA)
58675850
addArgument("-noMaskWA");
58685851

5852+
unsigned GRFSize = BC.getGRFSize();
5853+
if (GRFSize > 0) {
5854+
addArgument("-TotalGRFNum");
5855+
addArgument(to_string(GRFSize));
5856+
} else if (BC.isAutoLargeGRFMode())
5857+
addArgument("-autoGRFSelection");
5858+
58695859
if (ST.hasFusedEU()) {
58705860
addArgument("-fusedCallWA");
58715861
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) {
@@ -368,32 +350,6 @@ void vc::KernelMetadata::updateSLMSizeMD(unsigned Size) {
368350
ValueAsMetadata::get(C));
369351
}
370352

371-
void vc::KernelMetadata::parseExecutionMode(MDNode *SpirvExecutionMode) {
372-
IGC_ASSERT(SpirvExecutionMode->getNumOperands() >= 3);
373-
374-
auto &EMode = SpirvExecutionMode->getOperand(1);
375-
auto &EModeVal = SpirvExecutionMode->getOperand(2);
376-
auto EModeId = static_cast<ExecutionMode>(extractConstantIntMD(EMode));
377-
switch (EModeId) {
378-
case ExecutionMode::MaximumRegistersINTEL:
379-
GRFSize = extractConstantIntMD(*(EModeVal.get()));
380-
return;
381-
case ExecutionMode::MaximumRegistersIdINTEL: {
382-
auto *GRFSizeNode = cast<MDNode>(EModeVal.get());
383-
GRFSize = extractConstantIntMD(*(GRFSizeNode->getOperand(0)));
384-
return;
385-
}
386-
case ExecutionMode::NamedMaximumRegistersINTEL: {
387-
auto *NamedExecMode = cast<MDString>(EModeVal.get());
388-
IGC_ASSERT_EXIT_MESSAGE(!NamedExecMode->getString().compare("AutoINTEL"),
389-
"Unhandled NamedMaximumRegisters value");
390-
GRFSize = 0;
391-
return;
392-
}
393-
}
394-
IGC_ASSERT_EXIT_MESSAGE(0, "Unhandled execution mode!");
395-
}
396-
397353
bool vc::hasKernel(const Module &M) {
398354
NamedMDNode *KernelsMD = M.getNamedMetadata(genx::FunctionMD::GenXKernels);
399355
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)