Generalized version to StringLiteral.

With the change, the following can be used for the version parameter:

"0.1.0"  // string literal
constexpr char API_VERSION[] = "0.1.0";
constexpr ckb::StringLiteral API_VERSION = "0.1.0";
This commit is contained in:
John Shumway
2025-09-05 22:30:00 +00:00
parent 3c020eb507
commit b2f501d5d7
4 changed files with 11 additions and 9 deletions

View File

@@ -3,7 +3,6 @@
#include <concepts>
#include <type_traits>
#include "conv_builder_reference.hpp"
#include <ck_tile/builder/conv_algorithm.hpp>
#include <ck_tile/builder/conv_factory.hpp>
#include <ck_tile/builder/conv_signature.hpp>
@@ -23,7 +22,7 @@ namespace ck_tile::builder {
* @tparam ALGORITHM The specific convolution algorithm to be used for the implementation.
* @tparam VERSION The version of the builder implementation.
*/
template <ConvSignature auto SIGNATURE, ConvAlgorithm auto ALGORITHM, auto VERSION>
template <ConvSignature auto SIGNATURE, ConvAlgorithm auto ALGORITHM, StringLiteral VERSION>
requires SupportedVersion<VERSION>
struct ConvBuilder
{

View File

@@ -3,13 +3,14 @@
#include <concepts>
#include <string_view>
#include <ck_tile/builder/builder_utils.hpp>
namespace ck_tile::builder {
static constexpr char V0_0_0[] = "0.0.0";
static constexpr char V0_1_0[] = "0.1.0";
static constexpr StringLiteral V0_0_0 = "0.0.0";
static constexpr StringLiteral V0_1_0 = "0.1.0";
template <const char* V>
concept SupportedVersion = (std::string_view{V} == std::string_view{V0_0_0}) ||
(std::string_view{V} == std::string_view{V0_1_0});
template <StringLiteral V>
concept SupportedVersion = (V == V0_0_0) || (V == V0_1_0);
} // namespace ck_tile::builder

View File

@@ -20,7 +20,8 @@ struct DefaultFwdConvAlgorithm
};
static_assert(ckb::ConvAlgorithm<DefaultFwdConvAlgorithm>);
static constexpr char API_VERSION[] = "0.1.0";
constexpr char API_VERSION[] = "0.1.0";
static_assert(ckb::SupportedVersion<API_VERSION>);
TEST(ConvBuilderTest, TestDefaultInstance)
{

View File

@@ -14,7 +14,8 @@ struct FwdConvSignature
};
static_assert(ckb::ConvSignature<FwdConvSignature>);
static constexpr char API_VERSION[] = "0.1.0";
constexpr char API_VERSION[] = "0.1.0";
static_assert(ckb::SupportedVersion<API_VERSION>);
struct FwdConvAlgorithm
{