-
Notifications
You must be signed in to change notification settings - Fork 68
[Feature][IR][Dataflow] Keep meta_if / meta_else in IR to preserve 'singel df.kernel' program structure #523
Copy link
Copy link
Open
Description
Motivation and Expected Behavior
This is a pre-task for #510.
Currently, Allo dataflow IR creates multiple code variants after lowering meta_if / meta_elif / meta_else. However, Shardy enforces a strict SPMD model. Directly lowering meta control flow in Allo IR before integrating Shardy would break this, leading to compatibility issues.
To integrate Shardy into Allo dataflow, we need to preserve meta control flow in the IR first.
We may introduce new MLIR operations in Allo to support meta control flow.
Related resources
related dialects:
Reactions are currently unavailable
Pinned by Fangtangtang
Pinned comment options
💡another proposal for handling
wid.
An example:
source code
@spmw.unit()
def top(A: int32[1024], B: int32[1024]):
@spmw.work(mapping=[4], inputs=[A], outputs=[B])
def core(local_A: int32[1024] @ [S(0)], local_B: int32[1024] @ [S(0)]):
pi: ConstExpr[index] = spmw.get_wid() # can also be: pi = spmw.get_wid()
local_B[:] = local_A + pi- the results of
spmw.get_wid()areConstExpr[index]. - since it can have multiple return values, the type annotations can be omitted.
preprocessed AST
@spmw.unit()
def top(A: __allo__[i32, (1024,), None], B: __allo__[i32, (1024,), None]):
__top__core(A, B)
return
@spmw.work(mapping=[4], inputs=[A], outputs=[B])
def __top__core…Metadata
Metadata
Assignees
Labels
No labels