Skip to content

Commit

Permalink
Fix a bit more stuff for NVCC build
Browse files Browse the repository at this point in the history
  • Loading branch information
crtrott committed Feb 1, 2023
1 parent 29ca91f commit 8cb0c6f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/experimental/__p0009_bits/extents2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ struct index_sequence_scan_impl<R, FirstVal, Values...> {

template<size_t R, size_t FirstVal>
struct index_sequence_scan_impl<R, FirstVal> {
#ifdef __NVCC__
#if defined(__NVCC__) || defined(__NVCOMPILER)
// NVCC warns about pointless comparison with 0 for R==0 and r being const evaluatable and also 0
MDSPAN_INLINE_FUNCTION
constexpr static size_t get(size_t r) { return static_cast<int64_t>(R)>static_cast<int64_t>(r)?FirstVal:0; }
Expand Down
2 changes: 1 addition & 1 deletion include/experimental/__p0009_bits/mdspan.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ class mdspan
MDSPAN_INLINE_FUNCTION
friend constexpr void swap(mdspan& x, mdspan& y) noexcept {
// can't call the std::swap inside on HIP
#ifndef _MDSPAN_HAS_HIP
#if !defined(_MDSPAN_HAS_HIP) && !defined(_MDSPAN_HAS_CUDA)
swap(x.__ptr_ref(), y.__ptr_ref());
swap(x.__mapping_ref(), y.__mapping_ref());
swap(x.__accessor_ref(), y.__accessor_ref());
Expand Down
3 changes: 2 additions & 1 deletion tests/foo_customizations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Foo {
struct foo_ptr {
T* data;
MDSPAN_INLINE_FUNCTION
foo_ptr(T* ptr):data(ptr) {}
constexpr foo_ptr(T* ptr):data(ptr) {}
};

template<class T>
Expand Down Expand Up @@ -57,6 +57,7 @@ namespace Foo {
}
int* flag;

MDSPAN_INLINE_FUNCTION
friend constexpr void swap(foo_accessor& x, foo_accessor& y) {
x.flag[0] = 99;
y.flag[0] = 77;
Expand Down
4 changes: 2 additions & 2 deletions tests/test_mdspan_swap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ TEST(TestMDSpanSwap, std_swap_dynamic_extents) {
__MDSPAN_TESTS_RUN_TEST(test_mdspan_std_swap_dynamic_extents())
}

// On HIP we actually don't call through to swap via ADL
// On HIP/CUDA we actually don't call through to swap via ADL
// so the foo swap test which has side effects will fail
#ifndef _MDSPAN_HAS_HIP
#if !defined(_MDSPAN_HAS_HIP) && !defined(_MDSPAN_HAS_CUDA)
void test_mdspan_foo_swap_dynamic_extents() {
size_t* errors = allocate_array<size_t>(1);
errors[0] = 0;
Expand Down

0 comments on commit 8cb0c6f

Please sign in to comment.