Failed to legalize operation 'tosa.gather'
What happened?
When importing fsaf-cppe5_1.tflite, getting the error:
fsaf-cppe5_1.tflite:0:0: error: 'tosa.gather' op operand #1 must be 2D tensor of 32-bit signless integer values, but got 'tensor<1x1000xi64>'
fsaf-cppe5_1.tflite:0:0: note: see current operation: %7253 = "tosa.gather"(%7252, %7251) : (tensor<1x3800x4xf32>, tensor<1x1000xi64>) -> tensor<1x1000x4xf32>
This model is very similar to the RetinaNet-ResNeXT50 800x800 in our performance focus set.
Steps to reproduce your issue
iree-import-tflite [path to tflite file] -o [path to mlir file]
TFLite file: https://storage.googleapis.com/iree-model-artifacts/fsaf-cppe5_1.tflite Original source: https://tfhub.dev/rishit-dagli/fsaf-cppe5/1
What component(s) does this issue relate to?
Frontends
Ah okay, I see the failure. Technically we only support gathers on i32 values at most. This is a TOSA limitation. There are actually other failures as well (e.g. topk has no lowering). There are a bunch of other issues in this model so it will be quite a long time until we can find a solution.
It is possible we can fix it by making a bunch of changes to the quantized lowerings but it will be significant work.
gather 1x1000xi64 is odd - does it actually need to be 64-bit? (that's very rare) of course it'd be good to support as-is but if we want to flush out other issues maybe fixing the model to not have i64 gathers would help reveal other latent issues
There is a decent amount of "why does this model do X". I doubt i64s actually matter. There are also some issues where we assume an operation runs on floats and mess-up on the integer case. Determining how to handle the i64 case is going to be much more frustrating.