JuliaComputing / xtrx_julia

XTRX LiteX/LitePCIe based design for Julia Computing
BSD 2-Clause "Simplified" License
1 stars 0 forks source link

Multi-device DMA buffer handle synchronization #92

Open staticfloat opened 2 years ago

staticfloat commented 2 years ago

If we end up synchronizing DMA buffers as described in https://github.com/JuliaComputing/xtrx_julia/issues/83#issuecomment-1245713043 we will need to have a good software method for ensuring that the buffers passed back to userspace are synchronized across devices. One proposed way of doing this is to use the handle argument passed back by the driver (which represents a buffer count, internally) to ensure that the buffers we're acquiring are actually synchronized in time.

One possible way to do this synchronization is to have a vectorized acquireXBuffer() call that reads in buffers for all the devices, compares the returned handles, and if any device is "behind" the "leading" device, we drop buffers from those devices until we are synchronized with identical handles on all devices. From that point on, we should remain in lockstep, but we will need to be careful around edge cases like overflows and whatnot.