cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
CapitanUccio
Visitor
Visitor
219 Views
Registered: ‎03-13-2021

atomic functions

Jump to solution

I'm converting some opencl kernel into HSL C++ kernel, and need to convert the atomic_inc of openCL into something equivalent in C++. I've tried this:

#include <atomic>

std::atomic<uint32_t> abort;

 

it runs fine in software simulation, but when I try to compile it in hardware I get:

ERROR: [v++ 214-194] in function 'search': Undefined function __atomic_fetch_add_4 (/tools/Xilinx/Vitis_HLS/2020.2/tps/lnx64/gcc-6.2.0/lib/gcc/x86_64-pc-linux-gnu/6.2.0/../../../../include/c++/6.2.0/bits/atomic_base.h:514:16)

 

I suppose atomic function are not supported in C++? or there is another way?

0 Kudos
1 Solution

Accepted Solutions
xilinxacct
Instructor
Instructor
205 Views
Registered: ‎10-23-2018

@CapitanUccio 

The result of the HLS program should be inherently atomic for a simple 'variable' (e.g. a write or read should happen in the same cycle). I think your should just remove the include and the qualifier on the variable declaration will get you want you want. Of course, if you are trying to share this, maybe something akin to the notion of write enable (ala a memory), may give you access control, if you need it in a more complex use case.

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed.

View solution in original post

0 Kudos
2 Replies
xilinxacct
Instructor
Instructor
206 Views
Registered: ‎10-23-2018

@CapitanUccio 

The result of the HLS program should be inherently atomic for a simple 'variable' (e.g. a write or read should happen in the same cycle). I think your should just remove the include and the qualifier on the variable declaration will get you want you want. Of course, if you are trying to share this, maybe something akin to the notion of write enable (ala a memory), may give you access control, if you need it in a more complex use case.

Hope that Helps
If so, Please mark as solution accepted. Kudos also welcomed.

View solution in original post

0 Kudos
CapitanUccio
Visitor
Visitor
124 Views
Registered: ‎03-13-2021

what about read and write of a variable within an unrolled loop?

0 Kudos