Skip to content

Commit

Permalink
Merge pull request #340 from crtrott/fix_shadow_warning
Browse files Browse the repository at this point in the history
Fix warnings (shadow and conversion)
  • Loading branch information
crtrott authored Jun 6, 2024
2 parents 18c332e + 6a7bcc6 commit 96b3985
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
10 changes: 6 additions & 4 deletions examples/dot_product/dot_product.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ T dot_product(
Kokkos::mdspan<T, ExtsB, LayB, AccB> b
) //requires ExtsA::rank() == ExtsB::rank() && ExtsA::rank() == 2
{
using int_t = typename ExtsA::index_type;
T result = 0;
for(int i = 0; i < a.extent(0); ++i) {
for(int j = 0; j < a.extent(1); ++j) {
for(int_t i = 0; i < a.extent(0); ++i) {
for(int_t j = 0; j < a.extent(1); ++j) {
#if MDSPAN_USE_BRACKET_OPERATOR
result += a[i, j] * b[i, j];
#else
Expand All @@ -78,9 +79,10 @@ void fill_in_order(
Kokkos::mdspan<T, ExtsA, LayA, AccA> a
) // requires ExtsA::rank() == 2
{
using int_t = typename ExtsA::index_type;
T count = 0;
for(int i = 0; i < a.extent(0); ++i) {
for(int j = 0; j < a.extent(1); ++j) {
for(int_t i = 0; i < a.extent(0); ++i) {
for(int_t j = 0; j < a.extent(1); ++j) {
#if MDSPAN_USE_BRACKET_OPERATOR
a[i, j] = count++;
#else
Expand Down
6 changes: 3 additions & 3 deletions include/experimental/__p0009_bits/layout_stride.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,15 +651,15 @@ constexpr void validate_strides(with_rank<N>, Layout, const Extents& ext, const

constexpr auto is_left = std::is_same<Layout, layout_left>::value;

typename Extents::index_type stride = 1;
typename Extents::index_type expected_stride = 1;

for (std::size_t r = 0; r < N; r++) {
const std::size_t s = is_left ? r : N - 1 - r;

MDSPAN_IMPL_PRECONDITION(common_integral_compare(stride, other.stride(s))
MDSPAN_IMPL_PRECONDITION(common_integral_compare(expected_stride, other.stride(s))
and "invalid strides for layout_{left,right}");

stride *= ext.extent(s);
expected_stride *= ext.extent(s);
}
}

Expand Down
4 changes: 2 additions & 2 deletions include/experimental/__p2630_bits/submdspan_mapping.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ template<class IndexType,
class Slice>
MDSPAN_INLINE_FUNCTION
constexpr bool
one_slice_out_of_bounds(const IndexType& extent, const Slice& slice)
one_slice_out_of_bounds(const IndexType& ext, const Slice& slice)
{
using common_t = std::common_type_t<decltype(detail::first_of(slice)), IndexType>;
return static_cast<common_t>(detail::first_of(slice)) == static_cast<common_t>(extent);
return static_cast<common_t>(detail::first_of(slice)) == static_cast<common_t>(ext);
}

template<size_t ... RankIndices,
Expand Down

0 comments on commit 96b3985

Please sign in to comment.