Break/continue in IRBuilder loops

I’m building functions which uses the IRBuilder via the Python API. I’m trying to do some data dependent loop exiting.

For example, here’s some code with a nested for loop. If some condition is not met in the inner loop, we break early, and go to the next iteration of the outer loop.

irb = tvm.tir.ir_builder.create()
data_ptr = irb.buffer_ptr(data)
with irb.for_range(0, outer, for_type="vectorize", name='i') as i:
  with irb.for_range(0, inner, for_type="vectorize", name='j') as j:
    with irb.if_scope(condition):
      do_thing()
    with irb.else_scope():
      break

However, break here is the Python keyword and not part of the syntax of the IRBuilder. I’ve looked in the definition of ir_builder.py, however didn’t see a way of breaking from a for loop early.

Is there something I’m missing?

Breaking loops early is not supported by TIR or by IRBuilder. Also, the vectorize loop will execute multiple iterations simultaneously (assuming it is lowered to vector intrinsics), so break does not really make sense here.