v-m
New Contributor
2 years agoMemory attributes for device_global
I am migrating IP component from HLS to oneAPI. The component is basic exponential moving average filtering.
Implementation has state, which is saved between invocation. In HLS this can be achieved using static variable inside function. Based on my research in oneAPI the recommended way is to to use device_global memory (see FPGA Optimization Guide for Intel®
oneAPI Toolkits - device_global Extension).
using FPGAProperties = decltype(sycl::ext::oneapi::experimental::properties( sycl::ext::oneapi::experimental::device_image_scope, sycl::ext::oneapi::experimental::host_access_none)); // Not able to apply memory attributes here // [[intel::fpga_register]] sycl::ext::oneapi::experimental::device_global<int, FPGAProperties> last; struct ExpKernel { float sample; void operator()() const { last = 0.5f * last + 0.5f * sample; OutputPipe::write(last); } };
This works as expected and generates device scoped memory. But I am not able to apply any memory attributes to this memory, like forcing registers or specifying bankwidth.
So my questions are:
1. How to apply memory attributes to device_global?
2. Is it the only way to achieve saving state across multiple invocations (besides using global memory)