Skip to content

Commit

Permalink
Moved MEMORY_ON_[HOST|DEVICE] from tsl::oneAPI to tsl namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
JPietrzykTUD committed Oct 17, 2023
1 parent ef863e6 commit 6f20ba5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
9 changes: 4 additions & 5 deletions examples/oneAPIfpga/clz_rtl_example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ int main(void) {
auto host_mem_data = cpu_executor.allocate<uint32_t>(128);
auto host_mem_result = cpu_executor.allocate<uint32_t>(128);
// allocate memory accessible from host and FPGA device
// WATCH OUT: oneAPI::MEMORY_ON_HOST and oneAPI::MEMORY_ON_DEVICE will soon be moved up in the namespace hierarchy
auto usm_host_mem_data = fpga_executor.allocate<uint32_t>(128, oneAPI::MEMORY_ON_HOST{});
auto usm_host_mem_result = fpga_executor.allocate<uint32_t>(128, oneAPI::MEMORY_ON_HOST{});
auto usm_host_mem_data = fpga_executor.allocate<uint32_t>(128, MEMORY_ON_HOST{});
auto usm_host_mem_result = fpga_executor.allocate<uint32_t>(128, MEMORY_ON_HOST{});
// allocate memory on FPGA device
auto usm_dev_mem_data = fpga_executor.allocate<uint32_t>(128, oneAPI::MEMORY_ON_DEVICE{});
auto usm_dev_mem_result = fpga_executor.allocate<uint32_t>(128, oneAPI::MEMORY_ON_DEVICE{});
auto usm_dev_mem_data = fpga_executor.allocate<uint32_t>(128, MEMORY_ON_DEVICE{});
auto usm_dev_mem_result = fpga_executor.allocate<uint32_t>(128, MEMORY_ON_DEVICE{});

// initialize input data
host_mem_data[0] = 0;
Expand Down
3 changes: 3 additions & 0 deletions generator/static_files/core/utils/runtime.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ includes:
- "<utility>"
implementations:
- |
struct MEMORY_ON_HOST{};
struct MEMORY_ON_DEVICE{};
template<class ExecTarget>
class executor {
private:
Expand Down
7 changes: 2 additions & 5 deletions supplementary/runtime/oneApiFPGA/include/tslOneAPIrt.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,6 @@ namespace tsl {
sycl::ext::intel::tsl_helper_loop_fuse_independent<N>(f, 0);
}

struct MEMORY_ON_HOST{};
struct MEMORY_ON_DEVICE{};

namespace details {
template <typename T, typename = void>
struct multi_ptr_base_type {
Expand Down Expand Up @@ -177,7 +174,7 @@ namespace tsl {
}
public:
template<typename _T>
auto allocate(size_t element_count, ::tsl::oneAPI::MEMORY_ON_HOST, size_t alignment = 0) {
auto allocate(size_t element_count, ::tsl::MEMORY_ON_HOST, size_t alignment = 0) {
using T = std::remove_pointer_t<std::remove_reference_t<_T>>;
T * buffer;
if (alignment == 0) {
Expand All @@ -194,7 +191,7 @@ namespace tsl {
return sycl::host_ptr<T>{buffer};
}
template<typename _T>
auto allocate(size_t element_count, ::tsl::oneAPI::MEMORY_ON_DEVICE, size_t alignment = 0) {
auto allocate(size_t element_count, ::tsl::MEMORY_ON_DEVICE, size_t alignment = 0) {
using T = std::remove_pointer_t<std::remove_reference_t<_T>>;
T * buffer;
if (alignment == 0) {
Expand Down

0 comments on commit 6f20ba5

Please sign in to comment.