rapidstream-org / rapidstream-tapa

RapidStream TAPA compiles task-parallel HLS program into high-frequency FPGA accelerators.
https://tapa.rtfd.io
MIT License
155 stars 32 forks source link

undefined template 'tapa::stream<unsigned short, 2>' #126

Closed ZhuopingYang closed 1 year ago

ZhuopingYang commented 1 year ago

I am trying to compile AutoSA-generated systolic array using tapa. I have replaced all hls::stream with tapa::stream, tapa::istream, and tapa::ostream accordingly. This replacement approach works on fp32 matrix multiplication, and I have generated the xclbin file. However, when I use the same replacement method on int16 matrix multiplication, it shows the following error messages: ERROR: [HLS 207-3582] implicit instantiation of undefined template 'tapa::stream<unsigned short, 2>': /var/tmp/AutoSA/autosa.tmp/output/src/kernel.xilinx_u250_xdma_201830_2.hw.xo.tapa/cpp/A_IO_L2_in.cpp:450:33 I also tried to replace unsigned short to ap_int<16> or unsigned int but it still did not work.

The source code is attached, and the used command is tapac -o kernel.xilinx_u250_xdma_201830_2.hw.xo kernel_kernel_tapa.cpp --platform xilinx_u250_xdma_201830_2 --top kernel0 --work-dir kernel.xilinx_u250_xdma_201830_2.hw.xo.tapa_201830_2.hw.xo.tapa kernel_kernel_tapa.txt A_IO_L2_in.txt

Blaok commented 1 year ago

Hi @ZhuopingYang,

tapa::stream cannot be used as task interfaces (C++ function parameters). You need to use either tapa::ostream or tapa::istream. The first instance in kernel_kernel_tapa.txt is the fifo_C_drain_out parameter of PE:

@@ -680,7 +680,7 @@ void B_IO_L2_in_boundary(int idx, tapa::istream<B_t32> &fifo_B_in, tapa::ostream
 /* Module Definition */

 /* Module Definition */
-void PE(int idx, int idy, tapa::istream<A_t32> &fifo_A_in, tapa::ostream<A_t32> &fifo_A_out, tapa::istream<B_t32> &fifo_B_in, tapa::ostream<B_t32> &fifo_B_out, tapa::stream<unsigned short> &fifo_C_drain_out) {
+void PE(int idx, int idy, tapa::istream<A_t32> &fifo_A_in, tapa::ostream<A_t32> &fifo_A_out, tapa::istream<B_t32> &fifo_B_in, tapa::ostream<B_t32> &fifo_B_out, tapa::ostream<unsigned short> &fifo_C_drain_out) {
 #pragma HLS INLINE OFF
   /* Variable Declaration */
   int p0 = idx, p1 = idy; // module id

Let me know if this does not fix the problem.

cc @AriesLL

AriesLL commented 1 year ago

@Blaok Thank you very much! We will take a closer look at it and keep you posted!

ZhuopingYang commented 1 year ago

@Blaok Thank you very much! This issue has been addressed using your advice.