Summarizing a significant amount of conversation with @stellaraccident on this:
a) Bit-accurate verification of the TOSA form (using the TOSA reference model) needs a shape-resolved pure TOSA form to feed the ref model.
b) Code generation can pass through dynamic shapes when working from a frontend (e.g. TF and TFLite currently).
Originally, we primarily focused on (a), but now that we have a stable infrastructure (b) is increasingly important. So far we’ve depended on the model conditioning offering static shaped networks, or used --tf-enable-shape-inference-on-import together with known input shapes to fully resolve the network prior to legalization to TOSA.
@stellaraccident mentioned that it’s undesirable to fix shapes at the frontend level, and that’s something we agree with. Until recently, TOSA dialect form was more restrictive than the spec mandate, something I’d fixed in https://reviews.llvm.org/D102958 .
I’ll start a separate thread on the TOSA spec mlplatform to discuss whether additional ops are worth freeing up, but the current set of changes should be relatively flexible for a lot of cases, e.g. there are no constraints on eltwise ops.
The legalizations may need local patches to fix corner cases where we don’t handle dynamic shaped content cleanly - there was at least one network that failed as a result. This would be on the TensorFlow side, at least for the TF/TFL to TOSA legalizations.
Having said this, we might be able to satisfy both (a) and (b) requirements above from a TOSA form containing dynamic shapes, with a shape inference pass ilke the TF infer shape pass, that takes input and output node information and in the input shapes in order to generate a shape resolved form. Thus:
Path 1: Resolve shapes at frontend, carry through into TOSA (current mode),
Path 2: Ensure legalizations can convey dynamic shapes to general TOSA form, implement pass that can take input shapes and generate shape resolved TOSA form where needed. This can be used to drive the TOSA regression/conformance testing. In a more dynamic e2e stack this resolution might be deferred to a combination of static and dynamic resolution.