Skip to content

Commit

Permalink
Mark the deduction guide for vector as ALPAKA_FN_HOST_ACC (#2376)
Browse files Browse the repository at this point in the history
This is a fix for some compilers which can't otherwise deduce the type on device.
  • Loading branch information
ikbuibui authored Sep 3, 2024
1 parent 6bdf13a commit 05030c0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions example/bufferCopy/src/bufferCopy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ struct TestBufferKernel
template<typename TAcc, typename MdSpan>
ALPAKA_FN_ACC auto operator()(TAcc const& acc, MdSpan data) const -> void
{
using Vec = alpaka::Vec<alpaka::Dim<TAcc>, alpaka::Idx<TAcc>>;

auto const idx = alpaka::getIdx<alpaka::Grid, alpaka::Threads>(acc);
auto const gridSize = alpaka::getWorkDiv<alpaka::Grid, alpaka::Threads>(acc);

Expand All @@ -41,7 +39,9 @@ struct TestBufferKernel
for(size_t x = idx[2]; x < data.extent(2); x += gridSize[2])
ALPAKA_ASSERT_ACC(
data(z, y, x)
== alpaka::mapIdx<1u>(Vec{z, y, x}, Vec{data.extent(0), data.extent(1), data.extent(2)})[0]);
== alpaka::mapIdx<1u>(
alpaka::Vec{z, y, x},
alpaka::Vec{data.extent(0), data.extent(1), data.extent(2)})[0]);
}
};

Expand Down
3 changes: 2 additions & 1 deletion include/alpaka/vec/Vec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,8 @@ namespace alpaka
};

template<typename TFirstIndex, typename... TRestIndices>
Vec(TFirstIndex&&, TRestIndices&&...) -> Vec<DimInt<1 + sizeof...(TRestIndices)>, std::decay_t<TFirstIndex>>;
ALPAKA_FN_HOST_ACC Vec(TFirstIndex&&, TRestIndices&&...)
-> Vec<DimInt<1 + sizeof...(TRestIndices)>, std::decay_t<TFirstIndex>>;

template<typename T>
inline constexpr bool isVec = false;
Expand Down

0 comments on commit 05030c0

Please sign in to comment.