Skip to content

Commit fa0b5d7

Browse files
avoid compier error
``` /mem/view/Traits.hpp:124:20: error: not eliding copy on return [-Werror,-Wnrvo] 3111 14:27:41 124 | return pitchBytes; ``` and ``` block/sync/BlockSyncUniformCudaHipBuiltIn.hpp:76:32: error: 'tmp' may be duplicated when built into a shared library: it is mutable, with external linkage and hidden visibility [-Werror,-Wunique-object-duplication] 3169 08:41:14 76 | __shared__ int tmp; ```
1 parent d97c2b5 commit fa0b5d7

4 files changed

Lines changed: 19 additions & 5 deletions

File tree

include/alpaka/block/sync/BlockSyncUniformCudaHipBuiltIn.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,15 @@ namespace alpaka
4747
int predicate) -> int
4848
{
4949
# if defined(__HIP_ARCH_HAS_SYNC_THREAD_EXT__) && __HIP_ARCH_HAS_SYNC_THREAD_EXT__ == 0 && ALPAKA_COMP_HIP
50+
# if ALPAKA_COMP_CLANG
51+
# pragma clang diagnostic push
52+
# pragma clang diagnostic ignored "-Wattributes"
53+
# endif
5054
// workaround for unsupported syncthreads_* operation on AMD hardware without sync extension
5155
__shared__ int tmp;
56+
# if ALPAKA_COMP_CLANG
57+
# pragma clang diagnostic pop
58+
# endif
5259
__syncthreads();
5360
if(threadIdx.x == 0)
5461
tmp = 0;

include/alpaka/core/DemangleTypeNames.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ namespace alpaka::core
8080
std::copy(embeddedType.data() + start, embeddedType.data() + end, storage.data());
8181
storage[length] = '\0';
8282

83-
return storage;
83+
return std::move(storage);
8484
}
8585

8686
// Store the demangled type name as a null-terminated array of bytes.

include/alpaka/mem/view/Traits.hpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ namespace alpaka
9797
if constexpr(dim > 1)
9898
for(TIdx i = TDim::value - 1; i > 0; i--)
9999
pitchBytes[i - 1] = extent[i] * pitchBytes[i];
100-
return pitchBytes;
100+
return std::move(pitchBytes);
101101
}
102102

103103
//! Calculate the pitches from the extents and the one-dimensional pitch.
@@ -121,7 +121,14 @@ namespace alpaka
121121
if constexpr(dim > 2)
122122
for(TIdx i = TDim::value - 2; i > 0; i--)
123123
pitchBytes[i - 1] = extent[i] * pitchBytes[i];
124+
#if ALPAKA_COMP_CLANG
125+
# pragma clang diagnostic push
126+
# pragma clang diagnostic ignored "-Wnrvo"
127+
#endif
124128
return pitchBytes;
129+
#if ALPAKA_COMP_CLANG
130+
# pragma clang diagnostic pop
131+
#endif
125132
}
126133

127134
} // namespace detail

include/alpaka/workdiv/WorkDivHelpers.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ namespace alpaka
7979
}
8080
}
8181

82-
return divisorSet;
82+
return std::move(divisorSet);
8383
}
8484
} // namespace detail
8585

@@ -160,7 +160,7 @@ namespace alpaka
160160
Vec r;
161161
for(DimLoopInd i(0u); i < TDim::value; ++i)
162162
r[i] = core::divCeil(gridElemExtent[i], clippedThreadElemExtent[i]);
163-
return r;
163+
return std::move(r);
164164
}();
165165

166166
///////////////////////////////////////////////////////////////////
@@ -278,7 +278,7 @@ namespace alpaka
278278
Vec r;
279279
for(DimLoopInd i = 0; i < TDim::value; ++i)
280280
r[i] = core::divCeil(gridThreadExtent[i], blockThreadExtent[i]);
281-
return r;
281+
return std::move(r);
282282
}();
283283

284284

0 commit comments

Comments
 (0)