[Compiler] Addressing new compiler warnings (#3640)

* [Compiler] Addressing new compiler warnings

Clang enables new lifetime warnings in production and we see build
errors due to this with the staging compiler.

The attributes added in this PR are suggested by the compiler. However,
I'm not very familiar with the code base, so the changes may be
incorrect.

* Update some more instances

* Adds file-level ignores via clang diagnostic pragma

The number of instances was large, so I decided to use file-level scope
to disable the warning via pragma clang diagnostic ignored.

It also showed this warning coming from the gtest dependency. For that,
I did add the respective command line flag to the CMake variables. I
don't know if this is acceptable or not.

* This adds the remaining instances

For a build on gfx90a.

* fix clang format

* Adding couple more instances from gfx1200 build

* Fixed another few instances

---------

Co-authored-by: Illia Silin <98187287+illsilin@users.noreply.github.com>
Co-authored-by: illsilin_amdeng <Illia.Silin@amd.com>
This commit is contained in:
Jan Patrick Lehr
2026-02-02 18:39:48 +01:00
committed by GitHub
parent e6bcd192d4
commit 069500464d
50 changed files with 228 additions and 43 deletions

View File

@@ -10,6 +10,8 @@
#include "ck/tensor_operation/gpu/warp/wmma_gemm.hpp"
#include "ck/tensor_description/tensor_adaptor.hpp"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlifetime-safety-intra-tu-suggestions"
namespace ck {
template <index_t BlockSize,
@@ -485,3 +487,4 @@ struct BlockwiseGemmWmmaops_pipeline_base
};
} // namespace ck
#pragma clang diagnostic pop

View File

@@ -13,6 +13,8 @@
// Prefetech 2 stage
// Local prefetch 1 stage
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlifetime-safety-intra-tu-suggestions"
namespace ck {
template <index_t BlockSize,
@@ -992,3 +994,4 @@ struct BlockwiseGemmXdlops_pipeline_v4
};
} // namespace ck
#pragma clang diagnostic pop

View File

@@ -9,6 +9,9 @@
#include "ck/tensor_operation/gpu/warp/xdlops_gemm.hpp"
#include "ck/tensor_description/tensor_adaptor.hpp"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlifetime-safety-intra-tu-suggestions"
namespace ck {
template <index_t BlockSize,
@@ -404,3 +407,4 @@ struct BlockwiseGemmXdlops_pipeline_base
};
} // namespace ck
#pragma clang diagnostic pop

View File

@@ -11,6 +11,9 @@
#define CK_MNK_LOOP
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlifetime-safety-intra-tu-suggestions"
namespace ck {
#ifdef __gfx12__
@@ -1028,3 +1031,4 @@ struct BlockwiseGemmWMMA
#endif
} // namespace ck
#pragma clang diagnostic pop

View File

@@ -9,6 +9,8 @@
#include "ck/tensor_operation/gpu/warp/xdlops_gemm.hpp"
#include "ck/tensor_description/tensor_adaptor.hpp"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlifetime-safety-intra-tu-suggestions"
namespace ck {
template <index_t MNXdlPerWave, index_t MNWaves, index_t MNPerXdl, typename TileDesc_K0_MN_K1>
@@ -1031,3 +1033,4 @@ struct BlockwiseGemmXdlops_v2
};
} // namespace ck
#pragma clang diagnostic pop

View File

@@ -8,6 +8,9 @@
#include "ck/tensor_operation/gpu/warp/xdlops_gemm.hpp"
#include "ck/tensor_description/tensor_adaptor.hpp"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlifetime-safety-intra-tu-suggestions"
namespace ck {
template <index_t BlockSize,
@@ -317,3 +320,4 @@ struct BlockwiseGemmXdlops_k0mk1_k0nk1_m0n0m1n1m2m3m4n2_v1r1
};
} // namespace ck
#pragma clang diagnostic pop

View File

@@ -455,7 +455,7 @@ struct G_NDHW : public BaseConvolutionLayout
template <
typename Layout,
typename std::enable_if<std::is_base_of<BaseTensorLayout, Layout>::value, bool>::type = false>
std::ostream& operator<<(std::ostream& os, const Layout&)
std::ostream& operator<<([[clang::lifetimebound]] std::ostream& os, const Layout&)
{
os << Layout::name;
return os;

View File

@@ -17,6 +17,9 @@
#include "ck/tensor_operation/gpu/grid/gridwise_gemm_xdl_cshuffle_common.hpp"
#include "ck/tensor_operation/gpu/device/device_base.hpp"
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wlifetime-safety-intra-tu-suggestions"
namespace ck {
// Implementation of "Merge" transformation primitive that uses division and mod. It is supposed to
@@ -1132,3 +1135,4 @@ struct GridwiseGemm_bk0mk1_bk0nk1_mn_xdlops_bwd_weight
}; // namespace ck
} // namespace ck
#pragma clang diagnostic pop