mirror of
https://github.com/ROCm/composable_kernel.git
synced 2026-07-12 18:17:58 +00:00
fix bug where CK datatypes would be registered as unknown in the output files
This commit is contained in:
@@ -1,26 +1,32 @@
|
||||
include(FetchContent)
|
||||
|
||||
set(ARGPARSE_DIR "" CACHE STRING "Location of local argparse repo to build against")
|
||||
set(ARGPARSE_DIR "" CACHE STRING "Location of local argparse repo to build against")
|
||||
|
||||
if(ARGPARSE_DIR) set(FETCHCONTENT_SOURCE_DIR_ARGPARSE ${ARGPARSE_DIR} CACHE STRING
|
||||
"argparse source directory override") endif()
|
||||
if(ARGPARSE_DIR)
|
||||
set(FETCHCONTENT_SOURCE_DIR_ARGPARSE ${ARGPARSE_DIR} CACHE STRING "argparse source directory override")
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(argparse GIT_REPOSITORY https
|
||||
: // github.com/p-ranav/argparse.git
|
||||
GIT_TAG v2 .9 #Using a stable version)
|
||||
FetchContent_Declare(
|
||||
argparse
|
||||
GIT_REPOSITORY https://github.com/p-ranav/argparse.git
|
||||
GIT_TAG v2.9 # Using a stable version
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(argparse)
|
||||
FetchContent_MakeAvailable(argparse)
|
||||
|
||||
#Create a proper modern CMake INTERFACE target
|
||||
if(NOT TARGET argparse::argparse) add_library(argparse::argparse INTERFACE)
|
||||
target_include_directories(argparse::argparse INTERFACE
|
||||
$<BUILD_INTERFACE : ${argparse_SOURCE_DIR} /
|
||||
include> $<INSTALL_INTERFACE : include>)
|
||||
# Create a proper modern CMake INTERFACE target
|
||||
if(NOT TARGET argparse::argparse)
|
||||
add_library(argparse::argparse INTERFACE)
|
||||
target_include_directories(argparse::argparse
|
||||
INTERFACE
|
||||
$<BUILD_INTERFACE:${argparse_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include>
|
||||
)
|
||||
|
||||
#Disable the specific warning for code that includes argparse
|
||||
target_compile_options(
|
||||
argparse::argparse INTERFACE
|
||||
$<$<CXX_COMPILER_ID : Clang, AppleClang, GNU> : -Wno - missing -
|
||||
noreturn>) endif()
|
||||
# Disable the specific warning for code that includes argparse
|
||||
target_compile_options(argparse::argparse INTERFACE
|
||||
$<$<CXX_COMPILER_ID:Clang,AppleClang,GNU>:-Wno-missing-noreturn>
|
||||
)
|
||||
endif()
|
||||
|
||||
message(STATUS "Argparse source dir: ${argparse_SOURCE_DIR}")
|
||||
message(STATUS "Argparse source dir: ${argparse_SOURCE_DIR}")
|
||||
|
||||
@@ -6,15 +6,18 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <iomanip>
|
||||
#include <chrono>
|
||||
#include <sstream>
|
||||
#include <cctype>
|
||||
#include <cstdio>
|
||||
#include <typeinfo>
|
||||
|
||||
#include "ck/utility/data_type.hpp"
|
||||
#include "ck/utility/amd_ck_fp8.hpp"
|
||||
|
||||
#include "data_type_enum.hpp"
|
||||
#include "profiler/argparse_wrapper.hpp"
|
||||
#include "profiler/data_type_enum.hpp"
|
||||
|
||||
namespace ck {
|
||||
namespace profiler {
|
||||
@@ -345,20 +348,44 @@ DataTypeEnum GetDataTypeEnum()
|
||||
{
|
||||
return DataTypeEnum::Int32;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Use typeid to try to identify CK-specific types
|
||||
|
||||
// Add explicit checks for CK-specific types
|
||||
else if constexpr(std::is_same_v<DataType, ck::half_t>) {
|
||||
return DataTypeEnum::Half;
|
||||
} else if constexpr(std::is_same_v<DataType, ck::bhalf_t>) {
|
||||
return DataTypeEnum::BFloat16;
|
||||
} else if constexpr(std::is_same_v<DataType, ck::f8_t>) {
|
||||
return DataTypeEnum::Float8;
|
||||
}
|
||||
// Handle potential alternative type names that might be used
|
||||
else if constexpr(std::is_same_v<DataType, __half>) {
|
||||
return DataTypeEnum::Half;
|
||||
}
|
||||
// Fallback for any 1-byte floating point types that aren't int8_t
|
||||
else if constexpr(sizeof(DataType) == 1 && std::is_floating_point_v<DataType>) {
|
||||
return DataTypeEnum::Float8;
|
||||
}
|
||||
// Fallback for 2-byte types that might be half precision
|
||||
else if constexpr(sizeof(DataType) == 2 && std::is_floating_point_v<DataType>) {
|
||||
// Try to distinguish between fp16 and bf16 using typeid as last resort
|
||||
std::string type_name = typeid(DataType).name();
|
||||
if(type_name.find("half") != std::string::npos)
|
||||
{
|
||||
if (type_name.find("bhalf") != std::string::npos || type_name.find("bf16") != std::string::npos) {
|
||||
return DataTypeEnum::BFloat16;
|
||||
} else {
|
||||
return DataTypeEnum::Half;
|
||||
}
|
||||
}
|
||||
// Additional fallback using typeid for types we might have missed
|
||||
else {
|
||||
std::string type_name = typeid(DataType).name();
|
||||
if (type_name.find("half") != std::string::npos && type_name.find("bhalf") == std::string::npos) {
|
||||
return DataTypeEnum::Half;
|
||||
}
|
||||
else if(type_name.find("bhalf") != std::string::npos)
|
||||
{
|
||||
return DataTypeEnum::BFloat16;
|
||||
}
|
||||
else if(sizeof(DataType) == 1 && !std::is_same_v<DataType, int8_t>)
|
||||
{
|
||||
|
||||
} else if (type_name.find("f8") != std::string::npos || type_name.find("fp8") != std::string::npos) {
|
||||
return DataTypeEnum::Float8;
|
||||
}
|
||||
return DataTypeEnum::Unknown;
|
||||
|
||||
@@ -57,6 +57,7 @@ int profile_gemm(int argc, char* argv[])
|
||||
}
|
||||
|
||||
const auto data_type = static_cast<GemmDataType>(std::stoi(argv[2]));
|
||||
std::cout << "Data Type: " << static_cast<int>(data_type) << std::endl;
|
||||
const auto layout = static_cast<GemmMatrixLayout>(std::stoi(argv[3]));
|
||||
const bool do_verification = std::stoi(argv[4]);
|
||||
const int init_method = std::stoi(argv[5]);
|
||||
|
||||
Reference in New Issue
Block a user