diff --git a/src/api/include/migraphx/migraphx.hpp b/src/api/include/migraphx/migraphx.hpp index 336cbb71e69..af30020f4d0 100644 --- a/src/api/include/migraphx/migraphx.hpp +++ b/src/api/include/migraphx/migraphx.hpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -67,8 +67,24 @@ std::string compute_type_name() { std::string name; #if defined(_MSC_VER) && !defined(__clang__) - name = typeid(PrivateMigraphTypeNameProbe).name(); - name = name.substr(7); + const char struct_name[] = "struct "; + const char class_name[] = "class "; + const char function_name[] = "compute_type_name<"; + const char parameter_name[] = ">(void)"; + const char cdecl_name[] = "__cdecl"; + + name = __FUNCSIG__; + + auto begin = name.find(function_name) + sizeof(function_name) - 1; + auto length = name.find(parameter_name) - begin; + name = name.substr(begin, length); + if(name.find(class_name) == 0) + name = name.substr(sizeof(class_name) - 1); + else if(name.find(struct_name) == 0) + name = name.substr(sizeof(struct_name) - 1); + begin = name.find(cdecl_name); + if(begin != std::string::npos) + name.erase(begin, sizeof(cdecl_name) - 1); #else const char parameter_name[] = "PrivateMigraphTypeNameProbe ="; // NOLINT diff --git a/src/include/migraphx/type_name.hpp b/src/include/migraphx/type_name.hpp index 72a1b53aad8..50396e1a4c6 100644 --- a/src/include/migraphx/type_name.hpp +++ b/src/include/migraphx/type_name.hpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -33,14 +33,9 @@ inline namespace MIGRAPHX_INLINE_NS { template std::string compute_type_name() { - std::string name; -#if defined(_MSC_VER) && !defined(__clang__) - name = typeid(PrivateMigraphTypeNameProbe).name(); - name = name.substr(7); -#else const char parameter_name[] = "PrivateMigraphTypeNameProbe ="; // NOLINT - name = __PRETTY_FUNCTION__; + std::string name = __PRETTY_FUNCTION__; auto begin = name.find(parameter_name) + sizeof(parameter_name); #if(defined(__GNUC__) && !defined(__clang__) && __GNUC__ == 4 && __GNUC_MINOR__ < 7) @@ -48,9 +43,7 @@ std::string compute_type_name() #else auto length = name.find_first_of("];", begin) - begin; #endif - name = name.substr(begin, length); -#endif - return name; + return name.substr(begin, length); } template diff --git a/src/targets/gpu/target.cpp b/src/targets/gpu/target.cpp index 5329936bc1a..4a18e25aab5 100644 --- a/src/targets/gpu/target.cpp +++ b/src/targets/gpu/target.cpp @@ -131,8 +131,8 @@ std::vector target::get_passes(migraphx::context& gctx, const compile_opti simplify_qdq{}, enable_pass(not mlir_enabled(), rewrite_quantization{}), dead_code_elimination{}, - // workaround for rocBLAS unsupported error when using uint8 in quant_dot & quant_convolution - eliminate_data_type{{migraphx::shape::uint8_type}, shape::float_type, {"quant_convolution", "quant_dot"}}, + // workaround for rocBLAS unsupported error when using uint8 in quant_dot, quant_convolution & pooling + eliminate_data_type{{migraphx::shape::uint8_type}, shape::float_type, {"quant_convolution", "quant_dot", "pooling"}}, eliminate_data_type{unsupported_types, shape::type_t::float_type}, simplify_reshapes{}, eliminate_identity{}, diff --git a/test/py/onnx_backend_test.py b/test/py/onnx_backend_test.py index 31900548f73..353bcea3944 100644 --- a/test/py/onnx_backend_test.py +++ b/test/py/onnx_backend_test.py @@ -117,7 +117,6 @@ def disabled_tests_onnx_1_7_0(backend_test): backend_test.exclude(r'test_einsum_inner_prod_cpu') backend_test.exclude(r'test_einsum_sum_cpu') backend_test.exclude(r'test_einsum_transpose_cpu') - backend_test.exclude(r'test_maxpool_2d_uint8_cpu') backend_test.exclude(r'test_maxunpool_export_with_output_shape_cpu') backend_test.exclude(r'test_maxunpool_export_without_output_shape_cpu') backend_test.exclude(r'test_mod_mixed_sign_int32_cpu') diff --git a/test/verify/test_global_max_pooling.cpp b/test/verify/test_global_max_pooling.cpp index 56de69e28bd..e32994edc14 100644 --- a/test/verify/test_global_max_pooling.cpp +++ b/test/verify/test_global_max_pooling.cpp @@ -1,7 +1,7 @@ /* * The MIT License (MIT) * - * Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. + * Copyright (c) 2015-2024 Advanced Micro Devices, Inc. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,14 +28,14 @@ #include #include -struct test_global_max_pooling : verify_program +template +struct test_global_max_pooling : verify_program> { migraphx::program create_program() const { migraphx::program p; auto* mm = p.get_main_module(); - auto input = - mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 16, 16}}); + auto input = mm->add_parameter("x", migraphx::shape{T, {1, 3, 16, 16}}); auto op = migraphx::op::pooling{migraphx::op::pooling_mode::max}; auto lens = input->get_shape().lens(); op.lengths = {lens[2], lens[3]}; @@ -43,3 +43,6 @@ struct test_global_max_pooling : verify_program return p; } }; + +template struct test_global_max_pooling; +template struct test_global_max_pooling; diff --git a/test/verify/test_max_pooling_ceil_3d.cpp b/test/verify/test_max_pooling_ceil_3d.cpp index e6fdfe8970e..88e96795ccc 100644 --- a/test/verify/test_max_pooling_ceil_3d.cpp +++ b/test/verify/test_max_pooling_ceil_3d.cpp @@ -27,17 +27,20 @@ #include #include -struct test_max_pooling_ceil_3d : verify_program +template +struct test_max_pooling_ceil_3d : verify_program> { migraphx::program create_program() const { migraphx::program p; auto* mm = p.get_main_module(); - auto input = - mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {1, 3, 5, 5, 5}}); + auto input = mm->add_parameter("x", migraphx::shape{T, {1, 3, 5, 5, 5}}); auto op = migraphx::op::pooling{ migraphx::op::pooling_mode::max, {1, 1, 1}, {3, 3, 3}, {3, 3, 3}, {1, 1, 1}, true}; mm->add_instruction(op, input); return p; } }; + +template struct test_max_pooling_ceil_3d; +template struct test_max_pooling_ceil_3d;