We don't support for loops, #2, but while loops work when using the following pattern:
num_tiles = ct.num_tiles(...)
i = Int32(1)
while i <= n
# ...
i += Int32(1)
end
Even this breaks down when using mixed types:
num_tiles = ct.num_tiles(...)::Int32
i = 1
while i <= n
# ...
i += 1
end
This requires more than just making sure Core.sext_int is recognizes (and emitted by cuTile.jl instead of the Tile IR equivalent); The pattern matching in try_detect_for_loop() requires bounds to be loop-invariant, so the loop falls back to LoopOp instead of ForOp.
This probably needs a hoisting pass that identifies type conversions in loop headers with loop-invariant inputs.