mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-27 07:31:28 +00:00
[mlir][Toy] Remove unnecessary transpose from chapter 1 example
The call to 'multiply_transpose' in the initialization of the variable 'f' was intended to have a shape mismatch. However the variable 'a' has shape <2, 3> and the variable 'c' has shape <3, 2>, so the arguments 'transpose(a)' and 'c' have in fact compatible shapes (<3, 2> both), the opposite of what is wanted here. This commit removes the transpose so that arguments 'a' and 'c' have incompatible shapes <2, 3> and <3, 2>, respectively. Reviewed By: mehdi_amini Differential Revision: https://reviews.llvm.org/D151897
This commit is contained in:
parent
f007bcbc3c
commit
444bb1f1bb
@ -61,9 +61,9 @@ def main() {
|
||||
# trigger another specialization of `multiply_transpose`.
|
||||
var e = multiply_transpose(c, d);
|
||||
|
||||
# Finally, calling into `multiply_transpose` with incompatible shape will
|
||||
# trigger a shape inference error.
|
||||
var f = multiply_transpose(transpose(a), c);
|
||||
# Finally, calling into `multiply_transpose` with incompatible shapes
|
||||
# (<2, 3> and <3, 2>) will trigger a shape inference error.
|
||||
var f = multiply_transpose(a, c);
|
||||
}
|
||||
```
|
||||
|
||||
@ -74,7 +74,7 @@ The AST from the above code is fairly straightforward; here is a dump of it:
|
||||
```
|
||||
Module:
|
||||
Function
|
||||
Proto 'multiply_transpose' @test/Examples/Toy/Ch1/ast.toy:4:1'
|
||||
Proto 'multiply_transpose' @test/Examples/Toy/Ch1/ast.toy:4:1
|
||||
Params: [a, b]
|
||||
Block {
|
||||
Return
|
||||
@ -87,7 +87,7 @@ Module:
|
||||
]
|
||||
} // Block
|
||||
Function
|
||||
Proto 'main' @test/Examples/Toy/Ch1/ast.toy:8:1'
|
||||
Proto 'main' @test/Examples/Toy/Ch1/ast.toy:8:1
|
||||
Params: []
|
||||
Block {
|
||||
VarDecl a<> @test/Examples/Toy/Ch1/ast.toy:11:3
|
||||
@ -111,10 +111,8 @@ Module:
|
||||
]
|
||||
VarDecl f<> @test/Examples/Toy/Ch1/ast.toy:28:3
|
||||
Call 'multiply_transpose' [ @test/Examples/Toy/Ch1/ast.toy:28:11
|
||||
Call 'transpose' [ @test/Examples/Toy/Ch1/ast.toy:28:30
|
||||
var: a @test/Examples/Toy/Ch1/ast.toy:28:40
|
||||
]
|
||||
var: c @test/Examples/Toy/Ch1/ast.toy:28:44
|
||||
var: a @test/Examples/Toy/Ch1/ast.toy:28:30
|
||||
var: c @test/Examples/Toy/Ch1/ast.toy:28:33
|
||||
]
|
||||
} // Block
|
||||
```
|
||||
|
@ -23,9 +23,9 @@ def main() {
|
||||
# A new call with `<3, 2>` for both dimension will trigger another
|
||||
# specialization of `multiply_transpose`.
|
||||
var e = multiply_transpose(c, d);
|
||||
# Finally, calling into `multiply_transpose` with incompatible shape will
|
||||
# trigger a shape inference error.
|
||||
var f = multiply_transpose(transpose(a), c);
|
||||
# Finally, calling into `multiply_transpose` with incompatible shapes
|
||||
# (<2, 3> and <3, 2>) will trigger a shape inference error.
|
||||
var f = multiply_transpose(a, c);
|
||||
}
|
||||
|
||||
|
||||
@ -68,9 +68,7 @@ def main() {
|
||||
# CHECK-NEXT: ]
|
||||
# CHECK-NEXT: VarDecl f<> @{{.*}}ast.toy:28:3
|
||||
# CHECK-NEXT: Call 'multiply_transpose' [ @{{.*}}ast.toy:28:11
|
||||
# CHECK-NEXT: Call 'transpose' [ @{{.*}}ast.toy:28:30
|
||||
# CHECK-NEXT: var: a @{{.*}}ast.toy:28:40
|
||||
# CHECK-NEXT: ]
|
||||
# CHECK-NEXT: var: c @{{.*}}ast.toy:28:44
|
||||
# CHECK-NEXT: var: a @{{.*}}ast.toy:28:30
|
||||
# CHECK-NEXT: var: c @{{.*}}ast.toy:28:33
|
||||
# CHECK-NEXT: ]
|
||||
|
||||
# CHECK-NEXT: } // Block
|
||||
|
Loading…
Reference in New Issue
Block a user