Similar to operation handles, merging parameters can be useful to
avoid repetition of common transformations across a set of parameters.
For example, forming a list of static values for comparison rather than
comparing the parameters one at a time.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Note that AnyHandleOrParamType also allows for value handles, but the implementation doesn't support them. Please either restrict the type to not allow for value handle or add support for those in the implementation. Looks good otherwise.
Thanks, I've been a bit confused by the terminology surrounding handles and parameters. Related, transform.replicate seems to be missing support for value handles as well: https://github.com/llvm/llvm-project/blob/4b6d41cd1d73a72403679ec21732df3610fc0964/mlir/lib/Dialect/Transform/IR/TransformOps.cpp#L1472.
Thanks!
mlir/lib/Dialect/Transform/IR/TransformOps.cpp | ||
---|---|---|
1259 | Nit: I don't remember if there is a check somewhere that we have more than one operand so .front() wouldn't crash here, better to double-check and return failure if there no verifier. |
Value handles are newer than many operations and are not widely used, so there are probably more operations that could be updated but haven't because there was no need.
For terminology, parameters are a kind of "attribute handles" if you wish.
mlir/lib/Dialect/Transform/IR/TransformOps.cpp | ||
---|---|---|
1259 | The SameOperandsAndResultType OpTrait seems to check for at least one operand: https://github.com/llvm/llvm-project/blob/58669354bf1f8eef39979e31915b1e212a3985c9/mlir/lib/IR/Operation.cpp#L1024 (verified by trying it anyway) If wanted I can add a test. error: unexpected error: 'transform.merge_handles' op expected 1 or more operands, but found 0 transform.merge_handles : !transform.any_value |
Value handles are newer than many operations and are not widely used, so there are probably more operations that could be updated but haven't because there was no need.
For terminology, parameters are a kind of "attribute handles" if you wish.
Ah makes sense, thanks for the note.
mlir/lib/Dialect/Transform/IR/TransformOps.cpp | ||
---|---|---|
1259 | Thanks for checking! There's no need to test that. |
Nit: I don't remember if there is a check somewhere that we have more than one operand so .front() wouldn't crash here, better to double-check and return failure if there no verifier.