Map variadic types

Hi, is there a way to map between variadics? I.e., something like this:

trait MyTrait:
    alias DataT: Intable
struct TestMapper[*Ts: MyTrait]:
    alias _type_old = __mlir_type[`!kgen.variadic<`, MyTrait, `>`]
    alias _type_new = __mlir_type[`!kgen.variadic<`, Intable, `>`] 
    alias MyTraits: _type_old = Ts
    alias Intables: _type_new = ??? [T.DataT for T in Ts]

I’m familiar with patterns like Origin.cast_from, but I haven’t found a way to use it. If anyone could point me to the relevant information on the kgen dialect, I would love to try contributing by adding this feature!

1 Like

Can’t you just rebind your way out of this one?

If that’s possible it would be great, but how would you do so?
I want to use Intables as a parameter in other structs and functions. Where Intables can be [Float32, Int, Int] for example.

This is something @billyzhu is working on, but it requires a lot of design work. It’s gonna take us a little time to hash it out though.

2 Likes

Thank you for the update!
This is a blocking issue for my work, so can I ask if you have a rough idea if we are talking days, weeks months or years before this is implemented @billyzhu? I totally get it if that’s not possible :blush:

Lukas is right. It definitely isn’t days. I would guess that later this year is likely, so in the “months away” range.

4 Likes

Thanks for answering!

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.