Xilinx / Vitis-In-Depth-Tutorial

Other
116 stars 70 forks source link

Question about wide_vadd sample #14

Closed boxerab closed 3 years ago

boxerab commented 3 years ago

@rwarmstr thanks for making this tutorial available ! I've added it to my OpenCL wrapper project:

https://github.com/GrokImageCompression/latke/tree/master/tests/wide_vadd

Question: is it possible to modify the kernel to do calculations other than adding AP types ? What I would like to do is to somehow "cast" the 512 bit type to 16 ints, do some calculations with these ints, then send them back to the host as 512 bit types. This would allow me to make full use of U250 512 bit bus, but have a more flexible kernel where I can do 32 bit int or float ops. Is this possible? Any insight here would be much appreciated!

rwarmstr commented 3 years ago

@boxerab Thanks! Glad you find it useful.

You can definitely do this, and in fact we're adding in vector data types in our upcoming 2020.2 release later this month. With the vector types you can do things like, for instance:

typedef float mytype attribute((vector_size(64)));

… defines a 512-bit mytype variable that can be read or written to m_axi ports to guarantee it takes advantage of the width. Then swap float to integer to use integers.

Full example here (load-compute-store with datflow):

https://github.com/Xilinx/HLS-Tiny-Tutorials/tree/2020.2/coding_vectorized

boxerab commented 3 years ago

@rwarmstr thanks, very happy to hear vector types will be supported! The example you linked is just what I was hoping for.

For reference, I also got implementation details from Herve on the Vitis forum:

https://forums.xilinx.com/t5/Vitis-Acceleration-SDAccel-SDSoC/opencl-kernel-quot-casting-quot-uint512-dt-type-to-array-of-16/td-p/1171526