Skip to content

Commit 436c497

Browse files
authored
Fix TopologicalSort for Joint and Cooperative matrices (#2143)
visit method of the sort relies on getNonLiteralOperands method of the SPIRVType which is being inserted in the module. Without it dependent types can be inserted in the module in incorrect order. For example: TypeCooperativeMatrixKHR %ID% TypeStruct ... %ID% is the correct order, but without the patch in some cases the translator could generate the opposite order. Signed-off-by: Sidorov, Dmitry <[email protected]>
1 parent 8701279 commit 436c497

File tree

3 files changed

+881
-0
lines changed

3 files changed

+881
-0
lines changed

lib/SPIRV/libSPIRV/SPIRVType.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,10 @@ class SPIRVTypeJointMatrixINTEL : public SPIRVType {
11141114
return Args.size() > 5 ? Args[5] : nullptr;
11151115
return Args.size() > 4 ? Args[4] : nullptr;
11161116
}
1117+
1118+
std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
1119+
return std::vector<SPIRVEntry *>(1, CompType);
1120+
}
11171121
};
11181122

11191123
class SPIRVTypeCooperativeMatrixKHR : public SPIRVType {
@@ -1142,6 +1146,10 @@ class SPIRVTypeCooperativeMatrixKHR : public SPIRVType {
11421146
SPIRVValue *getRows() const { return Args[1]; }
11431147
SPIRVValue *getColumns() const { return Args[2]; }
11441148
SPIRVValue *getUse() const { return Args[3]; }
1149+
1150+
std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
1151+
return std::vector<SPIRVEntry *>(1, CompType);
1152+
}
11451153
};
11461154

11471155
} // namespace SPIRV

0 commit comments

Comments
 (0)