Skip to content

Commit

Permalink
allow complex inner mapping construction in Bytesplit
Browse files Browse the repository at this point in the history
  • Loading branch information
bernhardmgruber committed Dec 15, 2021
1 parent ef045ec commit 021efe5
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
6 changes: 6 additions & 0 deletions include/llama/mapping/Bytesplit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ namespace llama::mapping
{
}

template<typename... Args>
LLAMA_FN_HOST_ACC_INLINE constexpr explicit Bytesplit(std::tuple<Args...> innerMappingArgs, TRecordDim = {})
: Inner(std::make_from_tuple<Inner>(innerMappingArgs))
{
}

template<std::size_t... RecordCoords>
static constexpr auto isComputed(RecordCoord<RecordCoords...>)
{
Expand Down
15 changes: 15 additions & 0 deletions tests/mapping.Bytesplit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,21 @@ TEST_CASE("mapping.ByteSplit.ChangeType.SoA")
iotaCheckView(view);
}

TEST_CASE("mapping.ByteSplit.Split.BitPackedIntSoA")
{
auto view = llama::allocView(llama::mapping::Bytesplit<
llama::ArrayExtentsDynamic<1>,
Vec3I,
llama::mapping::PreconfiguredSplit<
llama::RecordCoord<1>,
llama::mapping::BitPackedIntSoA,
llama::mapping::PreconfiguredAoS<>::type,
true>::type>{
std::tuple{std::tuple{23, llama::ArrayExtents{128}}, std::tuple{llama::ArrayExtents{128}}}});
iotaFillView(view);
iotaCheckView(view);
}

TEST_CASE("mapping.ByteSplit.SoA.verify")
{
using Mapping
Expand Down
3 changes: 2 additions & 1 deletion tests/proxyrefopmixin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,8 @@ namespace
TEST_CASE("proxyrefopmixin.Bytesplit")
{
auto view = llama::allocView(
llama::mapping::Bytesplit<llama::ArrayExtents<4>, Vec3I, llama::mapping::PreconfiguredAoS<>::type>{{}});
llama::mapping::Bytesplit<llama::ArrayExtents<4>, Vec3I, llama::mapping::PreconfiguredAoS<>::type>{
llama::ArrayExtents<4>{}});
testProxyRef(view(2)(tag::X{}));
}

Expand Down

0 comments on commit 021efe5

Please sign in to comment.