Skip to content

Commit

Permalink
Remove the function optimizeDecorates
Browse files Browse the repository at this point in the history
This is to port the upstream change:
KhronosGroup/SPIRV-LLVM-Translator@fd04d44.
  • Loading branch information
amdrexu committed Dec 12, 2023
1 parent 7dbe263 commit 84105a3
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 41 deletions.
40 changes: 0 additions & 40 deletions llpc/translator/lib/SPIRV/libSPIRV/SPIRVModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,6 @@ class SPIRVModuleImpl : public SPIRVModule {
// Module changing functions
bool importBuiltinSet(const std::string &, SPIRVId *) override;
bool importBuiltinSetWithId(const std::string &, SPIRVId) override;
void optimizeDecorates() override;
void setAddressingModel(SPIRVAddressingModelKind AM) override { AddrModel = AM; }
void postProcessExecutionModeId();
void setMemoryModel(SPIRVMemoryModelKind MM) override { MemoryModel = MM; }
Expand Down Expand Up @@ -357,44 +356,6 @@ void SPIRVModuleImpl::setCurrentLine(const SPIRVLine *Line) {
CurrentLine = Line;
}

// Creates decoration group and group decorates from decorates shared by
// multiple targets.
void SPIRVModuleImpl::optimizeDecorates() {
for (auto I = DecorateSet.begin(), E = DecorateSet.end(); I != E;) {
auto D = *I;
if (D->getOpCode() == OpMemberDecorate) {
++I;
continue;
}
auto ER = DecorateSet.equal_range(D);
if (std::distance(ER.first, ER.second) < 2) {
I = ER.second;
continue;
}
auto G = add(new SPIRVDecorationGroup(this, getId()));
std::vector<SPIRVId> Targets;
Targets.push_back(D->getTargetId());
const_cast<SPIRVDecorateGeneric *>(D)->setTargetId(G->getId());
G->getDecorations().insert(D);
for (I = ER.first; I != ER.second; ++I) {
auto E = *I;
if (*E == *D)
continue;
Targets.push_back(E->getTargetId());
}

// WordCount is only 16 bits. We can only have 65535 - FixedWC targets per
// group.
// For now, just skip using a group if the number of targets to too big
if (Targets.size() < 65530) {
DecorateSet.erase(ER.first, ER.second);
auto GD = add(new SPIRVGroupDecorate(G, Targets));
DecGroupVec.push_back(G);
GroupDecVec.push_back(GD);
}
}
}

void SPIRVModuleImpl::postProcessExecutionModeId() {
for (auto ExecModeId : ExecModeIdVec) {
SPIRVExecutionModeId *E = static_cast<SPIRVExecutionModeId *>(ExecModeId);
Expand Down Expand Up @@ -1127,7 +1088,6 @@ std::istream &operator>>(std::istream &I, SPIRVModule &M) {
Decoder.getEntry();

MI.postProcessExecutionModeId();
MI.optimizeDecorates();
MI.resolveUnknownStructFields();
MI.createForwardPointers();
return I;
Expand Down
1 change: 0 additions & 1 deletion llpc/translator/lib/SPIRV/libSPIRV/SPIRVModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ class SPIRVModule {
virtual void setSourceLanguage(SourceLanguage, SPIRVWord) = 0;
virtual void setSourceFile(SPIRVId) = 0;
virtual SPIRVString *getSourceFile(uint32_t FileId) const = 0;
virtual void optimizeDecorates() = 0;
virtual void setAutoAddCapability(bool E) { AutoAddCapability = E; }
virtual void setValidateCapability(bool E) { ValidateCapability = E; }
virtual void setGeneratorId(unsigned short) = 0;
Expand Down

0 comments on commit 84105a3

Please sign in to comment.