Skip to content

Commit

Permalink
Fixes for clang17 errors/warnings (#815)
Browse files Browse the repository at this point in the history
  • Loading branch information
cliffburdick authored Dec 19, 2024
1 parent 4445bc2 commit b1a02f1
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion include/matx/operators/base_operator.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ namespace matx
tp->Exec(ex);
}
else if constexpr (is_matx_set_op<T>()) {
if constexpr (static_cast<const T *>(this)->IsTransformSet()) {
if constexpr (is_matx_transform_op<typename T::op_type>() && is_tensor_view_v<typename T::tensor_type>) {
tp->TransformExec(tp->Shape(), ex);
}
else {
Expand Down
2 changes: 1 addition & 1 deletion include/matx/operators/concat.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace matx
{
static_assert(RANK > 0, "Cannot concatenate rank-0 tensors");
static_assert(sizeof...(Ts) > 1, "Must have more than one tensor to concatenate");
static_assert((... && (RANK == ts.Rank())), "concatenated ops must have the same rank");
static_assert((... && (RANK == Ts::Rank())), "concatenated ops must have the same rank");

for (int32_t i = 0; i < RANK; i++) {
if(i == axis_) {
Expand Down
2 changes: 1 addition & 1 deletion include/matx/operators/isclose.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace matx
__MATX_INLINE__ IsCloseOp(const Op1 &op1, const Op2 &op2, double rtol, double atol) :
op1_(op1), op2_(op2), rtol_(static_cast<inner_type>(rtol)), atol_(static_cast<inner_type>(atol))
{
static_assert(op1.Rank() == op2.Rank(), "Operator ranks must match in isclose()");
static_assert(Op1::Rank() == Op2::Rank(), "Operator ranks must match in isclose()");
ASSERT_COMPATIBLE_OP_SIZES(op1);
ASSERT_COMPATIBLE_OP_SIZES(op2);
}
Expand Down
2 changes: 1 addition & 1 deletion include/matx/operators/stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ namespace matx
__MATX_INLINE__ StackOp(int axis, const Ts&... ts) : ops_(ts...), axis_(axis)
{
static_assert(sizeof...(Ts) > 1, "Must have more than one tensor to stack");
static_assert((... && (RANK == ts.Rank())), "stacked ops must have the same rank");
static_assert((... && (RANK == Ts::Rank())), "stacked ops must have the same rank");

for (int32_t i = 0; i < RANK; i++) {
MATX_ASSERT_STR(((ts.Size(i) == pp_get<0>(ts).Size(i)) && ...)
Expand Down
2 changes: 1 addition & 1 deletion include/matx/transforms/fft/fft_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ __MATX_INLINE__ auto getCufft1DSupportedTensor( const Op &in, cudaStream_t strea
template <typename Op>
__MATX_INLINE__ auto getCufft2DSupportedTensor( const Op &in, cudaStream_t stream) {
// This would be better as a templated lambda, but we don't have those in C++17 yet
const auto support_func = [&in]() {
const auto support_func = [&]() {
if constexpr (is_tensor_view_v<Op>) {
if ( in.Stride(Op::Rank()-2) != in.Stride(Op::Rank()-1) * in.Size(Op::Rank()-1)) {
return false;
Expand Down
4 changes: 2 additions & 2 deletions include/matx/transforms/fft/fft_fftw.h
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ template<typename OutTensorType, typename InTensorType> class matxFFTWPlan_t {
template <typename Op>
__MATX_INLINE__ auto getFFTW1DSupportedTensor(const Op &in) {
// This would be better as a templated lambda, but we don't have those in C++17 yet
const auto support_func = [&in]() {
const auto support_func = [&]() {
if constexpr (is_tensor_view_v<Op>) {
if constexpr (Op::Rank() >= 2) {
if (in.Stride(Op::Rank() - 2) != in.Stride(Op::Rank() - 1) * in.Size(Op::Rank() - 1)) {
Expand All @@ -527,7 +527,7 @@ template<typename OutTensorType, typename InTensorType> class matxFFTWPlan_t {
template <typename Op>
__MATX_INLINE__ auto getFFTW2DSupportedTensor( const Op &in) {
// This would be better as a templated lambda, but we don't have those in C++17 yet
const auto support_func = [&in]() {
const auto support_func = [&]() {
if constexpr (is_tensor_view_v<Op>) {
if ( in.Stride(Op::Rank()-2) != in.Stride(Op::Rank()-1) * in.Size(Op::Rank()-1)) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion include/matx/transforms/matmul/matmul_cblas.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ __MATX_INLINE__ void matmul_dispatch(TensorTypeC &c,
template <typename Op>
__MATX_INLINE__ auto getCBLASSupportedTensor( const Op &in) {
// This would be better as a templated lambda, but we don't have those in C++17 yet
const auto support_func = [&in]() {
const auto support_func = [&]() {
if constexpr (is_tensor_view_v<Op>) {
return !(
(in.Stride(Op::Rank() - 1) != (index_t)1 && in.Stride(Op::Rank() - 2) != (index_t)1) ||
Expand Down
2 changes: 1 addition & 1 deletion include/matx/transforms/matmul/matmul_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -1102,7 +1102,7 @@ using gemm_cuda_cache_t = std::unordered_map<MatMulCUDAParams_t, std::any, MatM
template <typename Op>
__MATX_INLINE__ auto getCublasSupportedTensor( const Op &in, cudaStream_t stream) {
// This would be better as a templated lambda, but we don't have those in C++17 yet
const auto support_func = [&in]() {
const auto support_func = [&]() {
if constexpr (is_tensor_view_v<Op>) {
return !(
(in.Stride(Op::Rank()-1) != (index_t)1 && in.Stride(Op::Rank()-2) != (index_t)1) ||
Expand Down
10 changes: 4 additions & 6 deletions include/matx/transforms/svd/svd_cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -551,13 +551,11 @@ static __MATX_INLINE__ SVDMethod GetCUDASVDMethod(const ATensor &a) {
static constexpr int RANK = ATensor::Rank();
index_t m = a.Size(RANK - 2);
index_t n = a.Size(RANK - 1);
SVDMethod method;

// This assumes the matrix sizes are fairly large, in which case gesvd should win out on speed
if (a.Rank() == 2) {
method = detail::SVDMethod::GESVD;
}
else {
// gesvd is a good default for non-batched
SVDMethod method = detail::SVDMethod::GESVD;

if (a.Rank() != 2) {
if (a.Size(RANK-2) <= 32 &&
a.Size(RANK-1) <= 32) {
if constexpr (is_tensor_view_v<ATensor>) {
Expand Down

0 comments on commit b1a02f1

Please sign in to comment.