xls
xls copied to clipboard
Lower arrays of channels from DSLX into IR
DSLX currently supports declaring and using arrays of channels, e.g., let (ps, cs) = chan<u32>[4];
, but these aren't currently lowerable to IR. Sadly, it's not a trivial task to do this. In XLS IR, channels are top-level package constructs, and they're referenced by literal ID in send/recv nodes. The former can be handled during IR conversion, but the latter cannot.
The only workaround would be to emit conditional sends/recvs for every item in the array, and predicate off the undesired operations, but that's horrible and seriously pollutes the IR. Hopefully we can work something out such that send/recv channel IDs can be BValues and not literals. This'll take some discussion, though.
Are there any plans to provide support for arrays of channels shortly? Would it be possible to flatten the array of channels when converting DSLX to IR, so that each channel in the array gets a separate ID?
@meheff @grebe will https://google.github.io/xls/design_docs/proc_scoped_channels/ help with this?
Related #869.
Note currently lowering a proc that accept arrays of channels fails with:
Could not extract a textual position from error message: INVALID_ARGUMENT: Expression @ xls/examples/matmul_4x4/matmul_4x4.x:120:36-120:50 was not constexpr: `activations_in`
Related https://github.com/google/xls/issues/983