Is there an op in the calyx dialect that maps invoke?

Hi!I would like to implement a systolic array using the calyx dialect.Then convert mlir to the intermediate representation of calyx and then convert to Verilog,but I didn’t find an op maps invoke in the calyx dialect.
Can anyone give me some advice?I need a method to run systolic array.Thanks!

Hey @linuxlonelyeagle, there is an issue open to add invoke operator into the Calyx dialect in CIRCT. If you’re interested in adding it to the dialect, ping us on the issue and we can help. Without it, you can still structurally call another component by setting its go-done signals:

group inv {
  pe.go = 1'd1;
  pe.in1 = ...; pe.in2 = ....; 
  inv[done] = pe.done;
}

Note that the native Calyx compiler can take these kinds of groups and turn them into invoke operations using the group2invoke pass and apply all optimization applicable to invocations.

Also, note that we have a systolic array generator in Calyx that you could consider extending.

1 Like

I know that there is already a systolic array here, I want to convert the systolic array to circt, and then to verilog, I am looking for more opportunities to optimize ir in circt, this is the reason why I am asking this question, it seems that the systolic array cannot be converted to circt.

[fud] ERROR: `/home/sen/calyx/target/debug/futil -l /home/sen/calyx -b mlir -p well-formed -p lower-guards' failed:
=====STDERR=====
thread 'main' panicked at 'not yet implemented: invoke operator for MLIR backend', src/backend/mlir.rs:327:17
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Ah, got it. Try running the compile-invoke pass that removes all invocations:

/home/sen/calyx/target/debug/futil -l /home/sen/calyx -b mlir -p well-formed -p compile-invoke -p lower-guards

Or if you’re using fud, add the following:

fud e ... -s futil.flags ' -p well-formed -p compile-invoke -p lower-guards'

This should compile away all invoke statements in the program and allow the MLIR backend to generate the code

1 Like

RE systolic arrays: we do have an op in the MSFT dialect for them (and exposed through PyCDE, though it is very, very preliminary. I spoke about these “high-level constructs” at this year’s LATTE workshop (“Using CIRCT for FPGA Physical Design” https://capra.cs.cornell.edu/latte22/).

2 Likes

I have successfully converted the systolic array!Thanks!

Thank you for your advice!