Skip to content

Commit

Permalink
Remove LLAMA_FORCE_INLINE_RECURSIVE
Browse files Browse the repository at this point in the history
It is not needed, LLAMA_FORCE_INLINE is enough.
  • Loading branch information
bernhardmgruber committed May 30, 2023
1 parent 92397c6 commit d43c25d
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 49 deletions.
1 change: 0 additions & 1 deletion docs/pages/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ Macros

.. doxygendefine:: LLAMA_INDEPENDENT_DATA
.. doxygendefine:: LLAMA_FORCE_INLINE
.. doxygendefine:: LLAMA_FORCE_INLINE_RECURSIVE
.. doxygendefine:: LLAMA_UNROLL
.. doxygendefine:: LLAMA_HOST_ACC
.. doxygendefine:: LLAMA_FN_HOST_ACC_INLINE
Expand Down
2 changes: 0 additions & 2 deletions include/llama/Core.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ namespace llama
LLAMA_FN_HOST_ACC_INLINE constexpr void forEachLeafCoord(Functor&& functor, RecordCoord<Coords...> baseCoord)
{
LLAMA_BEGIN_SUPPRESS_HOST_DEVICE_WARNING
LLAMA_FORCE_INLINE_RECURSIVE
internal::mpForEachInlined(
LeafRecordCoords<GetType<RecordDim, RecordCoord<Coords...>>>{},
[&](auto innerCoord) LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS(constexpr)
Expand All @@ -429,7 +428,6 @@ namespace llama
template<typename RecordDim, typename Functor, typename... Tags>
LLAMA_FN_HOST_ACC_INLINE constexpr void forEachLeafCoord(Functor&& functor, Tags... /*baseTags*/)
{
LLAMA_FORCE_INLINE_RECURSIVE
forEachLeafCoord<RecordDim>(std::forward<Functor>(functor), GetCoordFromTags<RecordDim, Tags...>{});
}

Expand Down
17 changes: 0 additions & 17 deletions include/llama/RecordRef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,15 +426,9 @@ namespace llama
using AbsolutCoord = Cat<BoundRecordCoord, RecordCoord<Coord...>>;
using AccessedType = GetType<RecordDim, AbsolutCoord>;
if constexpr(isRecordDim<AccessedType>)
{
LLAMA_FORCE_INLINE_RECURSIVE
return RecordRef<const View, AbsolutCoord>{arrayIndex(), this->view};
}
else
{
LLAMA_FORCE_INLINE_RECURSIVE
return this->view.access(arrayIndex(), AbsolutCoord{});
}
}

// FIXME(bgruber): remove redundancy
Expand All @@ -444,15 +438,9 @@ namespace llama
using AbsolutCoord = Cat<BoundRecordCoord, RecordCoord<Coord...>>;
using AccessedType = GetType<RecordDim, AbsolutCoord>;
if constexpr(isRecordDim<AccessedType>)
{
LLAMA_FORCE_INLINE_RECURSIVE
return RecordRef<View, AbsolutCoord>{arrayIndex(), this->view};
}
else
{
LLAMA_FORCE_INLINE_RECURSIVE
return this->view.access(arrayIndex(), AbsolutCoord{});
}
}

/// Access a record in the record dimension underneath the current record reference using a series of tags. If
Expand All @@ -462,8 +450,6 @@ namespace llama
LLAMA_FN_HOST_ACC_INLINE auto operator()(Tags...) const -> decltype(auto)
{
using RecordCoord = GetCoordFromTags<AccessibleRecordDim, Tags...>;

LLAMA_FORCE_INLINE_RECURSIVE
return operator()(RecordCoord{});
}

Expand All @@ -472,8 +458,6 @@ namespace llama
LLAMA_FN_HOST_ACC_INLINE auto operator()(Tags...) -> decltype(auto)
{
using RecordCoord = GetCoordFromTags<AccessibleRecordDim, Tags...>;

LLAMA_FORCE_INLINE_RECURSIVE
return operator()(RecordCoord{});
}

Expand Down Expand Up @@ -816,7 +800,6 @@ namespace llama
LLAMA_FN_HOST_ACC_INLINE constexpr void forEachLeaf(RecordRefFwd&& vr, Functor&& functor)
{
using RecordRef = std::remove_reference_t<RecordRefFwd>;
LLAMA_FORCE_INLINE_RECURSIVE
forEachLeafCoord<typename RecordRef::AccessibleRecordDim>(
[functor = std::forward<Functor>(functor), &vr = vr](auto rc)
LLAMA_LAMBDA_INLINE_WITH_SPECIFIERS(constexpr mutable) { std::forward<Functor>(functor)(vr(rc)); });
Expand Down
22 changes: 0 additions & 22 deletions include/llama/View.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -456,29 +456,17 @@ namespace llama
LLAMA_FN_HOST_ACC_INLINE auto operator()(ArrayIndex ai) const -> decltype(auto)
{
if constexpr(isRecordDim<RecordDim>)
{
LLAMA_FORCE_INLINE_RECURSIVE
return RecordRef<const View>{ai, *this};
}
else
{
LLAMA_FORCE_INLINE_RECURSIVE
return access(ai, RecordCoord<>{});
}
}

LLAMA_FN_HOST_ACC_INLINE auto operator()(ArrayIndex ai) -> decltype(auto)
{
if constexpr(isRecordDim<RecordDim>)
{
LLAMA_FORCE_INLINE_RECURSIVE
return RecordRef<View>{ai, *this};
}
else
{
LLAMA_FORCE_INLINE_RECURSIVE
return access(ai, RecordCoord<>{});
}
}

/// Retrieves the \ref RecordRef at the \ref ArrayIndex index constructed from the passed component
Expand All @@ -491,7 +479,6 @@ namespace llama
static_assert(
sizeof...(Indices) == ArrayIndex::rank,
"Please specify as many indices as you have array dimensions");
LLAMA_FORCE_INLINE_RECURSIVE
return (*this)(ArrayIndex{static_cast<typename ArrayIndex::value_type>(indices)...});
}

Expand All @@ -503,21 +490,18 @@ namespace llama
static_assert(
sizeof...(Indices) == ArrayIndex::rank,
"Please specify as many indices as you have array dimensions");
LLAMA_FORCE_INLINE_RECURSIVE
return (*this)(ArrayIndex{static_cast<typename ArrayIndex::value_type>(indices)...});
}

/// Retrieves the \ref RecordRef at the \ref ArrayIndex index constructed from the passed component
/// indices.
LLAMA_FN_HOST_ACC_INLINE auto operator[](ArrayIndex ai) const -> decltype(auto)
{
LLAMA_FORCE_INLINE_RECURSIVE
return (*this)(ai);
}

LLAMA_FN_HOST_ACC_INLINE auto operator[](ArrayIndex ai) -> decltype(auto)
{
LLAMA_FORCE_INLINE_RECURSIVE
return (*this)(ai);
}

Expand All @@ -532,13 +516,11 @@ namespace llama
/// Retrieves the \ref RecordRef at the 1D \ref ArrayIndex index constructed from the passed index.
LLAMA_FN_HOST_ACC_INLINE auto operator[](size_type index) const -> decltype(auto)
{
LLAMA_FORCE_INLINE_RECURSIVE
return (*this)(index);
}

LLAMA_FN_HOST_ACC_INLINE auto operator[](size_type index) -> decltype(auto)
{
LLAMA_FORCE_INLINE_RECURSIVE
return (*this)(index);
}

Expand Down Expand Up @@ -703,13 +685,11 @@ namespace llama
/// Same as \ref View::operator()(ArrayIndex), but shifted by the offset of this \ref SubView.
LLAMA_FN_HOST_ACC_INLINE auto operator()(ArrayIndex ai) const -> decltype(auto)
{
LLAMA_FORCE_INLINE_RECURSIVE
return parentView(ArrayIndex{ai + offset});
}

LLAMA_FN_HOST_ACC_INLINE auto operator()(ArrayIndex ai) -> decltype(auto)
{
LLAMA_FORCE_INLINE_RECURSIVE
return parentView(ArrayIndex{ai + offset});
}

Expand All @@ -723,7 +703,6 @@ namespace llama
static_assert(
std::conjunction_v<std::is_convertible<Indices, size_type>...>,
"Indices must be convertible to ArrayExtents::size_type");
LLAMA_FORCE_INLINE_RECURSIVE
return parentView(
ArrayIndex{ArrayIndex{static_cast<typename ArrayIndex::value_type>(indices)...} + offset});
}
Expand All @@ -737,7 +716,6 @@ namespace llama
static_assert(
std::conjunction_v<std::is_convertible<Indices, size_type>...>,
"Indices must be convertible to ArrayExtents::size_type");
LLAMA_FORCE_INLINE_RECURSIVE
return parentView(
ArrayIndex{ArrayIndex{static_cast<typename ArrayIndex::value_type>(indices)...} + offset});
}
Expand Down
7 changes: 0 additions & 7 deletions include/llama/macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,6 @@
# endif
#endif

#if defined(_MSC_VER)
# define LLAMA_FORCE_INLINE_RECURSIVE __pragma(inline_depth(255))
#else
/// Forces the compiler to recursively inline the call hiearchy started by the subsequent function call.
# define LLAMA_FORCE_INLINE_RECURSIVE
#endif

/// Forces a copy of a value. This is useful to prevent ODR usage of constants when compiling for GPU targets.
#define LLAMA_COPY(x) decltype(x)(x)

Expand Down

0 comments on commit d43c25d

Please sign in to comment.