Skip to content

Commit 16c0d72

Browse files
MrSidimsfda0
authored andcommitted
Fix TopologicalSort for Joint and Cooperative matrices (KhronosGroup#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]> (cherry picked from commit 436c497)
1 parent e781a91 commit 16c0d72

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
@@ -1116,6 +1116,10 @@ class SPIRVTypeJointMatrixINTEL : public SPIRVType {
11161116
return Args.size() > 5 ? Args[5] : nullptr;
11171117
return Args.size() > 4 ? Args[4] : nullptr;
11181118
}
1119+
1120+
std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
1121+
return std::vector<SPIRVEntry *>(1, CompType);
1122+
}
11191123
};
11201124

11211125
class SPIRVTypeCooperativeMatrixKHR : public SPIRVType {
@@ -1144,6 +1148,10 @@ class SPIRVTypeCooperativeMatrixKHR : public SPIRVType {
11441148
SPIRVValue *getRows() const { return Args[1]; }
11451149
SPIRVValue *getColumns() const { return Args[2]; }
11461150
SPIRVValue *getUse() const { return Args[3]; }
1151+
1152+
std::vector<SPIRVEntry *> getNonLiteralOperands() const override {
1153+
return std::vector<SPIRVEntry *>(1, CompType);
1154+
}
11471155
};
11481156

11491157
} // namespace SPIRV

0 commit comments

Comments
 (0)