Rewriting LinalgGenericOp

Hi everyone. I have a further question with the same dialect I mentioned here. For the following code snippet, if I want to do further lowering I should firstly convert the !mytype into i64.

#map0 = affine_map<(d0) -> (d0)>

!scalar = !mydialect.mytype

module {
    func.func @test(%a: tensor<2x!scalar>) -> tensor<2x!scalar> {
        %0 = linalg.generic {
            indexing_maps = [#map0, #map0],
            iterator_types = ["parallel"]
        } ins (%a : tensor<2x!scalar>) outs (%a : tensor<2x!scalar>) {
                %1 = mydialect.myop %in, %in ( %c11_i8, %c52_i8, %c1023_i32, %true, %true, %true, %true, %c0_i8 ) : !scalar
                linalg.yield %1 : !scalar
          } -> tensor<2x!scalar>
        return %0 : tensor<2x!scalar>

The rewriting of mydialect.myop and linalg.yield is simple, it’s already done using a TypeConverter. The !mytype in the func.func as argument can also be converted. So the problem is if it’s possible to rewrite the linalg.generic operation, to convert the !mytype in ins(), outs() and the returns. What if are there in the compute payload a lot of other operations? How can I keep them unchanged?

Actually it’s not necessary to rewrite everything for my own dialect, I can firstly lower the linalg.generic into loops and then apply my own pass to convert the types. It’s a easy fix but kinda tricky;)