Fixes #59703.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
It's strange that this is even allowed by the op verifier. Can we (also) change the verifier of tensor.generate to disallow this case?
[mlir][Tensor] Disallow negative dimensions in verifier of tensor.generate
Instead of refusing to transform negative dimensions, the compiler will now crash
which is probably the right thing to do. Thanks to Alex Zinenko for pointing this out.
Thank you! Please run clang-format.
I'll mark this as "changes requested" so I don't forget to get back to this.
mlir/lib/Dialect/Tensor/IR/TensorOps.cpp | ||
---|---|---|
1114 | It is usually undesirable to return SmallVector as it may copy a lot. Instead, you can pass a SmallVectorImpl<...> & into the function. | |
1115 | Please declare auxiliary functions as static and document them. | |
1116 | Nit: do not specify the number of stack-allocated vector elements unless there is a strong reason to pick a number, just SmallVector<Value> will do here. | |
1208–1213 | Please expand auto to be the proper type unless the type is obvious from local context (e.g., the RHS has a cast) or difficult/impossible to spell (iterators, lambdas). |
Incorporate reviewer comments
Thanks again for the review Alex. The comments were easy to understand and implement!
It is usually undesirable to return SmallVector as it may copy a lot. Instead, you can pass a SmallVectorImpl<...> & into the function.