Looking into this issue, I have tried implementing the verifier to check the zero-dim tensor in Tosa ops. Extending the verifier for ReshapeOp simply worked. But I’ve got two questions.
- Since the zero-dim tensor is not supported by the definition of TOSA, we want to share the zero-dim verification among all TOSA ops. Is there any mechanism to share such verification logic with all (or part of) dialect ops?
- I’ve found the
TosaValidation pass in the TOSA dialect. What is that pass for? Should the zero-dim tensor verification go to the TosaValidation pass instead of the op specific verification?
You can make it a constraint on the input tensor type, check to see how the TOSA tensor input already restricts input types.
Validation pass is for validating it conforms to some TOSA profile for export.
Thanks. I have found type definitions for the TOSA dialect. Can we use the custom verification with CPred like this for the custom type too?
Looks like we need to apply the predicate only if the type is statically shaped. Can we write if-then-else like condition here? Only expression seems to be allowed.
You can, but it can get rather ugly (one can even use a lambda and IIFE) compared to just having a utility function that wraps this.
Verification IMHO should flag what is invalid not what may be, so if it is dynamic you don’t have enough information to say if valid. Others go the opposite way and ensure at compile time it is valid (I would prefer that in a validate pass).
1 Like