Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings (shadow and conversion) #340

Merged
merged 1 commit into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading