spatial icon indicating copy to clipboard operation
spatial copied to clipboard

Parallelize Transfer in Dimension Other Than Leading Dimension

Open mattfel1 opened this issue 5 years ago • 0 comments

For example: sram2 load dram2(0::64 par P, 0::64)

This compiles in spatial successfully, but crashes chisel compilation because it's confused about how the unroller created two streams that both share input/output stream buses.

I think you could fix this either by making the unroller duplicate the streams appropriately, or have a transformer super early on that basically rewrites like this:

Parallel{
  // Metaprogrammed:
  List.tabulate(P){i => sram2(i::64 by P, 0::64) load dram2(i::64 by P, 0::64)}
}

OR

Parallel{
  // Manually:
  sram2(0::64 by 2, 0::64) load dram2(0::64 by 2, 0::64)
  sram2(1::64 by 2, 0::64) load dram2(1::64 by 2, 0::64)
}

The first way is probably better since it can reason about dse parameters, but I'm not sure why it doesn't unroll this way already. The second way should be pretty straightforward to implement but I don't think enough people need this feature to justify doing it right now. For now I'm going to throw an error and recommend writing the code manually as shown above.

mattfel1 avatar May 15 '19 01:05 mattfel1