This method bitcasts a DenseElementsAttr elementwise to one of the same
shape with a different element type.
Details
- Reviewers
rriddle - Commits
- rGe2c97d448446: [MLIR] Add a bitcast method to DenseElementsAttr
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This modifies the bitcast folders added in https://reviews.llvm.org/D105376, so is dependent on that patch.
mlir/lib/IR/BuiltinAttributes.cpp | ||
---|---|---|
1027 | This should be true on construction. | |
1044 | Is this necessary? It's used above. | |
1046–1047 | If we use getDenseElementBitWidth here, you could drop the isIntOrFloat checks and ideally support complex as well. | |
1049 | You'll should also probably assert that the number of elements match. | |
mlir/lib/IR/BuiltinTypes.cpp | ||
448–455 ↗ | (On Diff #364649) | This looks unrelated. |
mlir/lib/IR/BuiltinAttributes.cpp | ||
---|---|---|
1027 | It was intended to be a check for integer/float. Deleted though, per your comment below. | |
1044 | It's not. I was following the pattern in reshape, which I assumed was intended as defense against some future mistake (or just a general principle of putting void casts before asserts with anything they use. I'll delete this and the one above, if this isn't some pattern I'm supposed to be following. | |
1046–1047 | Done. | |
1049 | That's true by construction with clone (this accepts an element type not a ShapedType) | |
mlir/lib/IR/BuiltinTypes.cpp | ||
448–455 ↗ | (On Diff #364649) | This was something I added while debugging. I've split it into a separate patch: https://reviews.llvm.org/D107676. Better debug messages are generally helpful though, I think :-) |
This should be true on construction.