Skip to content

Commit d71f0dd

Browse files
authored
Fixing warnings issues by clang-19, both host and device (#825)
1 parent 39ba917 commit d71f0dd

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

81 files changed

+278
-365
lines changed

CMakeLists.txt

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,10 @@ rapids_cpm_cccl(
134134

135135
target_link_libraries(matx INTERFACE CCCL::CCCL)
136136

137-
# Set flags for compiling tests faster
138-
set(MATX_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} --threads 0 -ftemplate-backtrace-limit=0)
137+
# Set flags for compiling tests faster (only for nvcc)
138+
if (NOT CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
139+
set(MATX_CUDA_FLAGS ${CMAKE_CUDA_FLAGS} --threads 0 -ftemplate-backtrace-limit=0)
140+
endif()
139141

140142
# Hack because CMake doesn't have short circult evaluation
141143
if (NOT CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
@@ -165,9 +167,13 @@ if (NOT ${IS_NVCPP} GREATER -1)
165167
endif()
166168
endif()
167169

168-
169-
170-
set(WARN_FLAGS ${WARN_FLAGS} $<$<COMPILE_LANGUAGE:CUDA>:-Werror all-warnings>)
170+
if (CMAKE_CUDA_COMPILER_ID STREQUAL "Clang")
171+
message((STATUS "Using Clang compiler"))
172+
# Workaround for clang bug: https://github.com/llvm/llvm-project/issues/58491
173+
set(WARN_FLAGS ${WARN_FLAGS} $<$<COMPILE_LANGUAGE:CUDA>:-Wno-unused-command-line-argument>)
174+
else()
175+
set(WARN_FLAGS ${WARN_FLAGS} $<$<COMPILE_LANGUAGE:CUDA>:-Werror all-warnings>)
176+
endif()
171177
set(WARN_FLAGS ${WARN_FLAGS} $<$<COMPILE_LANGUAGE:CXX>:-Werror>)
172178

173179
# CUTLASS slows down compile times when used, so leave it as optional for now

examples/black_scholes.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ private:
6161

6262
public:
6363
BlackScholes(O out, I1 K, I1 V, I1 S, I1 r, I1 T)
64-
: out_(out), K_(K), V_(V), S_(S), r_(r), T_(T) {}
64+
: out_(out), V_(V), S_(S), K_(K), r_(r), T_(T) {}
6565

6666
__device__ inline void operator()(index_t idx)
6767
{

examples/convolution.cu

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ using namespace matx;
3939
int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
4040
{
4141
MATX_ENTER_HANDLER();
42-
typedef cuda::std::complex<float> complex;
4342

4443
uint32_t iterations = 10;
4544
constexpr index_t numSamples = 1638400;

examples/mvdr_beamformer.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,9 @@ class MVDRBeamformer {
164164
auto GetCovMatInvView() { return invCovMatView; }
165165

166166
private:
167-
index_t num_beams_;
168-
index_t num_el_;
169-
index_t data_len_;
167+
[[maybe_unused]] index_t num_beams_;
168+
[[maybe_unused]] index_t num_el_;
169+
[[maybe_unused]] index_t data_len_;
170170
index_t snap_len_;
171171
cuda::std::complex<float> load_coeff_ = {0.1f, 0.f};
172172

examples/recursive_filter.cu

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@ using namespace matx;
4040
int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
4141
{
4242
MATX_ENTER_HANDLER();
43-
using complex = cuda::std::complex<float>;
44-
4543
cudaDeviceProp prop;
4644
cudaGetDeviceProperties(&prop, 0);
4745

@@ -70,7 +68,6 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv)
7068
cudaEventCreate(&start);
7169
cudaEventCreate(&stop);
7270

73-
using OutType = float;
7471
using InType = float;
7572
using FilterType = float;
7673

include/matx/core/half.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ __MATX_HOST__ __MATX_DEVICE__ __MATX_INLINE__ bool operator==(const T &lhs,
417417
const matxHalf<T> &rhs)
418418
{
419419
matxHalf<T> tmp{lhs};
420-
return lhs == tmp;
420+
return rhs == tmp;
421421
}
422422

423423
/**
@@ -464,7 +464,7 @@ __MATX_HOST__ __MATX_DEVICE__ __MATX_INLINE__ bool operator!=(const T &lhs,
464464
const matxHalf<T> &rhs)
465465
{
466466
matxHalf<T> tmp{lhs};
467-
return !(lhs == tmp);
467+
return !(rhs == tmp);
468468
}
469469

470470
/**

include/matx/core/half_complex.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ __MATX_HOST__ __MATX_DEVICE__ __MATX_INLINE__ bool
515515
operator==(const T &lhs, const matxHalfComplex<T> &rhs)
516516
{
517517
matxHalfComplex<T> tmp{lhs};
518-
return lhs == tmp;
518+
return rhs == tmp;
519519
}
520520

521521
/**
@@ -562,7 +562,7 @@ __MATX_HOST__ __MATX_DEVICE__ __MATX_INLINE__ bool
562562
operator!=(const T &lhs, const matxHalfComplex<T> &rhs)
563563
{
564564
matxHalfComplex<T> tmp{lhs};
565-
return !(lhs == tmp);
565+
return !(rhs == tmp);
566566
}
567567

568568

@@ -853,7 +853,7 @@ pow(const T &x, const matxHalfComplex<T> &y)
853853
{
854854
cuda::std::complex<float> tmp{static_cast<float>(y.real()),
855855
static_cast<float>(y.imag())};
856-
tmp = cuda::std::pow(y, pow);
856+
tmp = cuda::std::pow(x, pow);
857857
return {static_cast<T>(tmp.real()), static_cast<T>(tmp.imag())};
858858
}
859859

include/matx/core/operator_utils.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ namespace matx {
132132

133133
template <typename Op, typename ValidFunc>
134134
__MATX_INLINE__ auto GetSupportedTensor(const Op &in, const ValidFunc &fn, matxMemorySpace_t space, cudaStream_t stream = 0) {
135-
constexpr int RANK = Op::Rank();
136-
137135
if constexpr (is_matx_transform_op<Op>()) {
138136
// We can assume that if a transform is passed to the input then PreRun has already completed
139137
// on the transform and we can use the internal pointer

include/matx/core/print.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ namespace matx {
653653
*/
654654
template <typename Op, typename... Args,
655655
std::enable_if_t<(Op::Rank() > 0 && sizeof...(Args) == 0), bool> = true>
656-
void fprint(FILE* fp, const Op &op, Args... dims) {
656+
void fprint(FILE* fp, const Op &op, [[maybe_unused]] Args... dims) {
657657
cuda::std::array<int, Op::Rank()> arr = {0};
658658
auto tp = cuda::std::tuple_cat(arr);
659659
cuda::std::apply([&](auto &&...args) { fprint(fp, op, args...); }, tp);

include/matx/core/storage.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ namespace matx
406406
*/
407407
void SetData(T *const data) noexcept
408408
{
409-
data_.reset(data_, [](auto){});
409+
data_.reset(data, [](auto){});
410410
}
411411

412412
/**
@@ -423,7 +423,7 @@ namespace matx
423423
*
424424
* @param size Size in bytes to allocate
425425
*/
426-
__MATX_INLINE__ T* allocate(size_t size)
426+
__MATX_INLINE__ T* allocate([[maybe_unused]] size_t size)
427427
{
428428
MATX_THROW(matxInvalidParameter, "Cannot call allocate on a smart pointer storage type");
429429
}

0 commit comments

Comments
 (0)