[SCFToCalyx] Issue with lowering scf::parallel
to Calyx when there is scf::if
in it
#8086
Labels
Calyx
The Calyx dialect
We lower
scf::parallel
in SCFToCalyx by assuming constant loop bounds and strides, which enables us to unroll the parallel loop manually: #7830The issue is that, if
scf::parallel
containsscf::if
, whose condition variable depends on some constants andscf::parallel
's loop induction variables, those condition variables will be eventually evaluated to constanttrue/false
automatically even if we never implement this sort of "canonicalization" pass manually inSCFToCalyx.cpp
(I guess it's done by some underling MLIR mechanisms?).For example, if we begin with:
will turn into:
And in each basic block:
will be folded to constants automatically, turning the
scf::if
op to:If they were to be lowered to Calyx, it'll become:
but it's not allowed by Calyx' grammar: https://github.com/calyxir/calyx/blob/2e18d555ff00339f46c99cc9d8b698ee27ce25ad/calyx-frontend/src/syntax.pest#L348
Any idea on how to tackle this? @rachitnigam @cgyurgyik @andrewb1999 @mikeurbach Thanks!
The text was updated successfully, but these errors were encountered: