Skip to content

Commit

Permalink
Update the signature of allocMappedBuf for alpaka 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fwyzard committed Jan 17, 2025
1 parent 547258c commit b409f96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ namespace cms::alpakatools {
} else if constexpr (std::is_same_v<Device, alpaka::DevCpu>) {
// allocate pinned host memory accessible by the queue's platform
using Platform = alpaka::Platform<alpaka::Dev<Queue>>;
return alpaka::allocMappedBuf<Platform, std::byte, size_t>(device_, platform<Platform>(), bytes);
return alpaka::allocMappedBuf<std::byte, size_t>(device_, platform<Platform>(), bytes);
} else {
// unsupported combination
static_assert(std::is_same_v<Device, alpaka::Dev<Queue>> or std::is_same_v<Device, alpaka::DevCpu>,
Expand Down
14 changes: 6 additions & 8 deletions HeterogeneousCore/AlpakaInterface/interface/memory.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,21 @@ namespace cms::alpakatools {
template <typename T, typename TPlatform>
std::enable_if_t<not std::is_array_v<T>, host_buffer<T>> make_host_buffer() {
using Platform = TPlatform;
return alpaka::allocMappedBuf<Platform, T, Idx>(host(), platform<Platform>(), Scalar{});
return alpaka::allocMappedBuf<T, Idx>(host(), platform<Platform>(), Scalar{});
}

template <typename T, typename TPlatform>
std::enable_if_t<cms::is_unbounded_array_v<T> and not std::is_array_v<std::remove_extent_t<T>>, host_buffer<T>>
make_host_buffer(Extent extent) {
using Platform = TPlatform;
return alpaka::allocMappedBuf<Platform, std::remove_extent_t<T>, Idx>(host(), platform<Platform>(), Vec1D{extent});
return alpaka::allocMappedBuf<std::remove_extent_t<T>, Idx>(host(), platform<Platform>(), Vec1D{extent});
}

template <typename T, typename TPlatform>
std::enable_if_t<cms::is_bounded_array_v<T> and not std::is_array_v<std::remove_extent_t<T>>, host_buffer<T>>
make_host_buffer() {
using Platform = TPlatform;
return alpaka::allocMappedBuf<Platform, std::remove_extent_t<T>, Idx>(
host(), platform<Platform>(), Vec1D{std::extent_v<T>});
return alpaka::allocMappedBuf<std::remove_extent_t<T>, Idx>(host(), platform<Platform>(), Vec1D{std::extent_v<T>});
}

// potentially cached, pinned, scalar and 1-dimensional host buffers, associated to a work queue
Expand All @@ -112,7 +111,7 @@ namespace cms::alpakatools {
return allocCachedBuf<T, Idx>(host(), queue, Scalar{});
} else {
using Platform = alpaka::Platform<alpaka::Dev<TQueue>>;
return alpaka::allocMappedBuf<Platform, T, Idx>(host(), platform<Platform>(), Scalar{});
return alpaka::allocMappedBuf<T, Idx>(host(), platform<Platform>(), Scalar{});
}
}

Expand All @@ -125,8 +124,7 @@ namespace cms::alpakatools {
return allocCachedBuf<std::remove_extent_t<T>, Idx>(host(), queue, Vec1D{extent});
} else {
using Platform = alpaka::Platform<alpaka::Dev<TQueue>>;
return alpaka::allocMappedBuf<Platform, std::remove_extent_t<T>, Idx>(
host(), platform<Platform>(), Vec1D{extent});
return alpaka::allocMappedBuf<std::remove_extent_t<T>, Idx>(host(), platform<Platform>(), Vec1D{extent});
}
}

Expand All @@ -139,7 +137,7 @@ namespace cms::alpakatools {
return allocCachedBuf<std::remove_extent_t<T>, Idx>(host(), queue, Vec1D{std::extent_v<T>});
} else {
using Platform = alpaka::Platform<alpaka::Dev<TQueue>>;
return alpaka::allocMappedBuf<Platform, std::remove_extent_t<T>, Idx>(
return alpaka::allocMappedBuf<std::remove_extent_t<T>, Idx>(
host(), platform<Platform>(), Vec1D{std::extent_v<T>});
}
}
Expand Down

0 comments on commit b409f96

Please sign in to comment.