spirv-fuzz: Add replace linear algebra instruction transformation (#3402)

This PR implements a transformation that replaces
a linear algebra instruction with its mathematical definition.
This commit is contained in:
André Perez
2020-06-16 07:20:51 -03:00
committed by GitHub
parent 9275c398ec
commit 5e3e04273b
14 changed files with 919 additions and 0 deletions
+16
View File
@@ -650,6 +650,22 @@ bool spvOpcodeIsCommutativeBinaryOperator(SpvOp opcode) {
}
}
bool spvOpcodeIsLinearAlgebra(SpvOp opcode) {
switch (opcode) {
case SpvOpTranspose:
case SpvOpVectorTimesScalar:
case SpvOpMatrixTimesScalar:
case SpvOpVectorTimesMatrix:
case SpvOpMatrixTimesVector:
case SpvOpMatrixTimesMatrix:
case SpvOpOuterProduct:
case SpvOpDot:
return true;
default:
return false;
}
}
std::vector<uint32_t> spvOpcodeMemorySemanticsOperandIndices(SpvOp opcode) {
switch (opcode) {
case SpvOpMemoryBarrier: