[mlir] Enable specifying querying function in ValueShapeRange
This enables querying shapes/values as shapes without mutating the IR directly (e.g., towards enabling doing inference in analysis & application steps, inferring function shape with constant from callsite, ...). Add a new ShapeAdaptor that abstracts over whether shape is from Type or ShapedTypeComponents or DenseIntElementsAttribute. This adds new accessors to ValueShapeRange to get Shape and value as shape, but doesn't restrict or remove the previous way of accessing Type via the Value for now, that does mean a less refined shape could be accidentally queried and will be restricted in follow up. Currently restricted Value query to what can be represented as Shape. So only supports cases where constant subgraph evaluation's output is a shape. I had considered making it more general, but without TBD extern attribute concept or some such a user cannot today uniformly avoid overhead. Update TOSA ops and also the shape inference pass. Differential Revision: https://reviews.llvm.org/D107768
Loading
Please register or sign in to comment