mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-05-21 13:29:20 +00:00
Enhance printing functionality (#1751)
* Added object print with all template parameters
* fix clang format
---------
Co-authored-by: ravil-mobile <ravil.aviva.com@gmail.com>
Co-authored-by: illsilin <Illia.Silin@amd.com>
[ROCm/composable_kernel commit: d46196f291]
This commit is contained in:
@@ -5,6 +5,8 @@
|
||||
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <regex>
|
||||
#include <optional>
|
||||
|
||||
#include "ck/stream_config.hpp"
|
||||
|
||||
@@ -12,6 +14,34 @@ namespace ck {
|
||||
namespace tensor_operation {
|
||||
namespace device {
|
||||
|
||||
#define GET_OBJECT_NAME_IMLP \
|
||||
std::optional<std::string> GetObjectName() const override \
|
||||
{ \
|
||||
std::string str = __PRETTY_FUNCTION__; \
|
||||
static std::regex obj_name_expr{"<std::string> (.*)::GetObjectName"}; \
|
||||
std::smatch match; \
|
||||
if(!std::regex_search(str, match, obj_name_expr)) \
|
||||
{ \
|
||||
return str; \
|
||||
} \
|
||||
return std::string(match[1]) + ';'; \
|
||||
}
|
||||
|
||||
#define GET_TEMPLATE_INFO_IMPL \
|
||||
std::optional<std::string> GetTemplateInfo() const override \
|
||||
{ \
|
||||
std::string str = __PRETTY_FUNCTION__; \
|
||||
static std::regex template_expr{"\\[(.*)\\]"}; \
|
||||
std::smatch match; \
|
||||
if(!std::regex_search(str, match, template_expr)) \
|
||||
{ \
|
||||
return std::nullopt; \
|
||||
} \
|
||||
return std::string(match[1]); \
|
||||
}
|
||||
|
||||
#define REGISTER_EXTRA_PRINTING_METHODS GET_OBJECT_NAME_IMLP GET_TEMPLATE_INFO_IMPL
|
||||
|
||||
struct BaseArgument
|
||||
{
|
||||
BaseArgument() = default;
|
||||
@@ -48,6 +78,10 @@ struct BaseOperator
|
||||
|
||||
virtual std::string GetTypeIdName() const { return typeid(*this).name(); }
|
||||
|
||||
virtual std::optional<std::string> GetObjectName() const { return std::nullopt; }
|
||||
|
||||
virtual std::optional<std::string> GetTemplateInfo() const { return std::nullopt; }
|
||||
|
||||
virtual std::string GetTypeIdHashCode() const
|
||||
{
|
||||
std::ostringstream oss;
|
||||
|
||||
@@ -729,6 +729,7 @@ struct DeviceGemm_Xdl_CShuffleV3 : public DeviceGemmV2<ALayout,
|
||||
|
||||
return str.str();
|
||||
}
|
||||
REGISTER_EXTRA_PRINTING_METHODS
|
||||
};
|
||||
|
||||
} // namespace device
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user