[CK_BUILDER] old ck build fixes (#3075)

* Disable c++20-compat warnings when building old CK in C++20 mode

Turns out that this creates some warnings for no good reason.

* ck-builder: add missing layouts and element-wise op names

For layouts, we can directly use the ::name attribute, which should
cover all layouts. For element-wise ops, I just added the ones which
are currently missing when compiling CK with -DMIOPEN_REQ_LIBS_ONLY.
This commit is contained in:
Robin Voetter
2025-10-23 22:01:19 +02:00
committed by GitHub
parent 0fd7d1a607
commit d0364641ed
2 changed files with 22 additions and 26 deletions

View File

@@ -99,6 +99,9 @@ else()
-Wno-unused-lambda-capture
-Wno-nvcc-compat
)
if(CK_CXX_STANDARD GREATER_EQUAL 20)
list(APPEND CMAKE_COMPILER_WARNINGS -Wno-c++20-compat)
endif()
else()
if (CMAKE_${COMPILER}_COMPILER_ID MATCHES "GNU" AND ${COMPILER} MATCHES "CXX")
# cmake 3.5.2 does not support >=.

View File

@@ -60,45 +60,38 @@ consteval std::string_view type_name()
template <typename T>
constexpr std::string_view layout_name()
{
// Convolution layouts
if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::GNHWC>)
return "GNHWC";
else if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::GKYXC>)
return "GKYXC";
else if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::GNHWK>)
return "GNHWK";
else if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::GKZYXC>)
return "GKZYXC";
else if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::GNDHWC>)
return "GNDHWC";
else if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::GNDHWK>)
return "GNDHWK";
else if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::NHWGC>)
return "NHWGC";
else if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::KYXGC>)
return "KYXGC";
else if constexpr(std::is_same_v<T, ck::tensor_layout::convolution::NHWGK>)
return "NHWGK";
if constexpr(requires {
{ T::name } -> std::convertible_to<std::string_view>;
})
return T::name;
else
static_assert(false, "unknown_layout");
static_assert(false, "layout type is missing name attribute");
}
// Convert element-wise operation types to string names
template <typename T>
constexpr std::string_view elementwise_op_name()
{
if constexpr(std::is_same_v<T, ck::tensor_operation::element_wise::PassThrough>)
namespace element_wise = ck::tensor_operation::element_wise;
if constexpr(std::is_same_v<T, element_wise::PassThrough>)
return "PassThrough";
else if constexpr(std::is_same_v<T, ck::tensor_operation::element_wise::Scale>)
else if constexpr(std::is_same_v<T, element_wise::Scale>)
return "Scale";
else if constexpr(std::is_same_v<T, ck::tensor_operation::element_wise::Bilinear>)
else if constexpr(std::is_same_v<T, element_wise::Bilinear>)
return "Bilinear";
else if constexpr(std::is_same_v<T, ck::tensor_operation::element_wise::Add>)
else if constexpr(std::is_same_v<T, element_wise::Add>)
return "Add";
else if constexpr(std::is_same_v<T, ck::tensor_operation::element_wise::AddRelu>)
else if constexpr(std::is_same_v<T, element_wise::AddRelu>)
return "AddRelu";
else if constexpr(std::is_same_v<T, ck::tensor_operation::element_wise::Relu>)
else if constexpr(std::is_same_v<T, element_wise::Relu>)
return "Relu";
else if constexpr(std::is_same_v<T, element_wise::BiasNormalizeInInferClamp>)
return "BiasNormalizeInInferClamp";
else if constexpr(std::is_same_v<T, element_wise::Clamp>)
return "Clamp";
else if constexpr(std::is_same_v<T, element_wise::AddClamp>)
return "AddClamp";
else
static_assert(false, "unknown_op");
}