Unverified Commit b73427c9 authored by Chris Austen's avatar Chris Austen Committed by GitHub
Browse files

Merge branch 'develop' into fix_for_multiconfig_generators

parents 55e635e5 4c059fa3
...@@ -23,22 +23,26 @@ ...@@ -23,22 +23,26 @@
*/ */
#include "verify_program.hpp" #include "verify_program.hpp"
#include <migraphx/float8.hpp>
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_rsqrt : verify_program<test_rsqrt> template <typename CType>
struct test_rsqrt : verify_program<test_rsqrt<CType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape::type_t dtype = migraphx::shape::get_type<CType>();
std::vector<size_t> input_lens{1, 3, 16, 16}; std::vector<size_t> input_lens{1, 3, 16, 16};
migraphx::shape s{migraphx::shape::float_type, input_lens}; migraphx::shape s{dtype, input_lens};
auto x = mm->add_parameter("x", s); auto x = mm->add_parameter("x", s);
auto min_val = mm->add_literal(1.0f); auto min_val = mm->add_literal(migraphx::literal{migraphx::shape{dtype}, {1.0}});
auto max_val = mm->add_literal(std::numeric_limits<float>::max()); auto max_val = mm->add_literal(
min_val = mm->add_instruction( migraphx::literal{migraphx::shape{dtype}, {std::numeric_limits<CType>::max()}});
min_val = mm->add_instruction(
migraphx::make_op("multibroadcast", {{"out_lens", input_lens}}), min_val); migraphx::make_op("multibroadcast", {{"out_lens", input_lens}}), min_val);
max_val = mm->add_instruction( max_val = mm->add_instruction(
migraphx::make_op("multibroadcast", {{"out_lens", input_lens}}), max_val); migraphx::make_op("multibroadcast", {{"out_lens", input_lens}}), max_val);
...@@ -47,3 +51,7 @@ struct test_rsqrt : verify_program<test_rsqrt> ...@@ -47,3 +51,7 @@ struct test_rsqrt : verify_program<test_rsqrt>
return p; return p;
}; };
}; };
template struct test_rsqrt<float>;
template struct test_rsqrt<migraphx::half>;
template struct test_rsqrt<migraphx::fp8::fp8e4m3fnuz>;
...@@ -27,16 +27,17 @@ ...@@ -27,16 +27,17 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_scatter0 : verify_program<test_scatter0> template <migraphx::shape::type_t DType>
struct test_scatter0 : verify_program<test_scatter0<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape sd{migraphx::shape::float_type, {3, 3}}; migraphx::shape sd{DType, {3, 3}};
migraphx::shape si{migraphx::shape::int32_type, {2, 3}}; migraphx::shape si{migraphx::shape::int32_type, {2, 3}};
std::vector<int> vi = {1, 0, 2, 0, 2, 1}; std::vector<int> vi = {1, 0, 2, 0, 2, 1};
migraphx::shape su{migraphx::shape::float_type, {2, 3}}; migraphx::shape su{DType, {2, 3}};
auto pd = mm->add_parameter("data", sd); auto pd = mm->add_parameter("data", sd);
auto li = mm->add_literal(migraphx::literal{si, vi}); auto li = mm->add_literal(migraphx::literal{si, vi});
...@@ -47,3 +48,7 @@ struct test_scatter0 : verify_program<test_scatter0> ...@@ -47,3 +48,7 @@ struct test_scatter0 : verify_program<test_scatter0>
return p; return p;
} }
}; };
template struct test_scatter0<migraphx::shape::float_type>;
template struct test_scatter0<migraphx::shape::half_type>;
template struct test_scatter0<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -25,18 +25,19 @@ ...@@ -25,18 +25,19 @@
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
#include <migraphx/shape.hpp>
struct test_scatternd : verify_program<test_scatternd> template <migraphx::shape::type_t DType>
struct test_scatternd : verify_program<test_scatternd<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto dtype = migraphx::shape::float_type;
auto itype = migraphx::shape::int64_type; auto itype = migraphx::shape::int64_type;
migraphx::shape ds{dtype, {1}}; migraphx::shape ds{DType, {1}};
migraphx::shape is{itype, {4, 1}}; migraphx::shape is{itype, {4, 1}};
migraphx::shape us{dtype, {4}}; migraphx::shape us{DType, {4}};
std::vector<int64_t> ind_vec{4, 3, 1, 7}; std::vector<int64_t> ind_vec{4, 3, 1, 7};
auto ld = mm->add_literal(migraphx::literal{ds, {1}}); auto ld = mm->add_literal(migraphx::literal{ds, {1}});
...@@ -51,3 +52,7 @@ struct test_scatternd : verify_program<test_scatternd> ...@@ -51,3 +52,7 @@ struct test_scatternd : verify_program<test_scatternd>
return p; return p;
} }
}; };
template struct test_scatternd<migraphx::shape::float_type>;
template struct test_scatternd<migraphx::shape::half_type>;
template struct test_scatternd<migraphx::shape::fp8e4m3fnuz_type>;
/* /*
* The MIT License (MIT) * The MIT License (MIT)
* *
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
...@@ -21,24 +21,31 @@ ...@@ -21,24 +21,31 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "verify_program.hpp" #include "verify_program.hpp"
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_conv_relu_half : verify_program<test_conv_relu_half> struct test_scatternd_max : verify_program<test_scatternd_max>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto input = auto dtype = migraphx::shape::float_type;
mm->add_parameter("x", migraphx::shape{migraphx::shape::half_type, {4, 3, 3, 3}}); auto itype = migraphx::shape::int64_type;
auto weights = migraphx::shape ds{dtype, {8}};
mm->add_parameter("w", migraphx::shape{migraphx::shape::half_type, {4, 3, 3, 3}}); migraphx::shape is{itype, {4, 1}};
auto conv = mm->add_instruction(migraphx::make_op("convolution"), input, weights); migraphx::shape us{dtype, {4}};
mm->add_instruction(migraphx::make_op("relu"), conv); std::vector<int64_t> ind_vec{4, 3, 1, 7};
auto data = mm->add_parameter("data", ds);
auto indices = mm->add_literal(migraphx::literal{is, ind_vec});
auto updates = mm->add_parameter("update", us);
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_max"), data, indices, updates);
mm->add_return({scatternd});
return p; return p;
} }
}; };
/* /*
* The MIT License (MIT) * The MIT License (MIT)
* *
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
...@@ -21,21 +21,31 @@ ...@@ -21,21 +21,31 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "verify_program.hpp" #include "verify_program.hpp"
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_gemm_half : verify_program<test_gemm_half> struct test_scatternd_max_duplicate_idx : verify_program<test_scatternd_max_duplicate_idx>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto a = mm->add_parameter("a", migraphx::shape{migraphx::shape::half_type, {4, 5}}); auto dtype = migraphx::shape::float_type;
auto b = mm->add_parameter("b", migraphx::shape{migraphx::shape::half_type, {5, 3}}); auto itype = migraphx::shape::int64_type;
mm->add_instruction(migraphx::make_op("dot"), a, b); migraphx::shape ds{dtype, {8}};
migraphx::shape is{itype, {4, 1}};
migraphx::shape us{dtype, {4}};
std::vector<int64_t> ind_vec{4, 7, 4, 7};
auto data = mm->add_parameter("data", ds);
auto indices = mm->add_literal(migraphx::literal{is, ind_vec});
auto updates = mm->add_parameter("update", us);
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_max"), data, indices, updates);
mm->add_return({scatternd});
return p; return p;
} }
}; };
/* /*
* The MIT License (MIT) * The MIT License (MIT)
* *
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
...@@ -21,22 +21,30 @@ ...@@ -21,22 +21,30 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "verify_program.hpp" #include "verify_program.hpp"
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_nonzero_half : verify_program<test_nonzero_half> struct test_scatternd_min : verify_program<test_scatternd_min>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::half_type, {3, 4, 3, 5}}; auto dtype = migraphx::shape::float_type;
auto x = mm->add_parameter("data", s); auto itype = migraphx::shape::int64_type;
auto r = mm->add_instruction(migraphx::make_op("nonzero"), x); migraphx::shape ds{dtype, {8}};
mm->add_return({r}); migraphx::shape is{itype, {4, 1}};
migraphx::shape us{dtype, {4}};
std::vector<int64_t> ind_vec{4, 3, 1, 7};
auto data = mm->add_parameter("data", ds);
auto indices = mm->add_literal(migraphx::literal{is, ind_vec});
auto updates = mm->add_parameter("update", us);
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_min"), data, indices, updates);
mm->add_return({scatternd});
return p; return p;
} }
......
/* /*
* The MIT License (MIT) * The MIT License (MIT)
* *
* Copyright (c) 2015-2022 Advanced Micro Devices, Inc. All rights reserved. * Copyright (c) 2015-2023 Advanced Micro Devices, Inc. All rights reserved.
* *
* Permission is hereby granted, free of charge, to any person obtaining a copy * Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal * of this software and associated documentation files (the "Software"), to deal
...@@ -21,27 +21,31 @@ ...@@ -21,27 +21,31 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
#include "verify_program.hpp" #include "verify_program.hpp"
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct gemm_add_half : verify_program<gemm_add_half> struct test_scatternd_min_duplicate_idx : verify_program<test_scatternd_min_duplicate_idx>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape m1_shape{migraphx::shape::half_type, {1, 2, 3}}; auto dtype = migraphx::shape::float_type;
migraphx::shape m2_shape{migraphx::shape::half_type, {1, 3, 4}}; auto itype = migraphx::shape::int64_type;
migraphx::shape m3_shape{migraphx::shape::half_type, {1, 2, 4}}; migraphx::shape ds{dtype, {8}};
auto l1 = mm->add_parameter("1", m1_shape); migraphx::shape is{itype, {4, 1}};
auto l2 = mm->add_parameter("2", m2_shape); migraphx::shape us{dtype, {4}};
auto l3 = mm->add_parameter("3", m3_shape); std::vector<int64_t> ind_vec{4, 7, 4, 7};
auto data = mm->add_parameter("data", ds);
auto indices = mm->add_literal(migraphx::literal{is, ind_vec});
auto updates = mm->add_parameter("update", us);
auto scatternd =
mm->add_instruction(migraphx::make_op("scatternd_min"), data, indices, updates);
mm->add_return({scatternd});
auto dot = mm->add_instruction(migraphx::make_op("dot"), l1, l2);
mm->add_instruction(migraphx::make_op("add"), dot, l3);
return p; return p;
} }
}; };
...@@ -27,15 +27,20 @@ ...@@ -27,15 +27,20 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_sin : verify_program<test_sin> template <migraphx::shape::type_t DType>
struct test_sin : verify_program<test_sin<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {10}}; migraphx::shape s{DType, {10}};
auto x = mm->add_parameter("x", s); auto x = mm->add_parameter("x", s);
mm->add_instruction(migraphx::make_op("sin"), x); mm->add_instruction(migraphx::make_op("sin"), x);
return p; return p;
} }
}; };
template struct test_sin<migraphx::shape::float_type>;
template struct test_sin<migraphx::shape::half_type>;
template struct test_sin<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -27,15 +27,20 @@ ...@@ -27,15 +27,20 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_sinh : verify_program<test_sinh> template <migraphx::shape::type_t DType>
struct test_sinh : verify_program<test_sinh<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {16}}; migraphx::shape s{DType, {16}};
auto x = mm->add_parameter("x", s); auto x = mm->add_parameter("x", s);
mm->add_instruction(migraphx::make_op("sinh"), x); mm->add_instruction(migraphx::make_op("sinh"), x);
return p; return p;
} }
}; };
template struct test_sinh<migraphx::shape::float_type>;
template struct test_sinh<migraphx::shape::half_type>;
template struct test_sinh<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -48,3 +48,7 @@ template struct test_softmax<0, migraphx::shape::half_type>; ...@@ -48,3 +48,7 @@ template struct test_softmax<0, migraphx::shape::half_type>;
template struct test_softmax<1, migraphx::shape::half_type>; template struct test_softmax<1, migraphx::shape::half_type>;
template struct test_softmax<2, migraphx::shape::half_type>; template struct test_softmax<2, migraphx::shape::half_type>;
template struct test_softmax<3, migraphx::shape::half_type>; template struct test_softmax<3, migraphx::shape::half_type>;
template struct test_softmax<0, migraphx::shape::fp8e4m3fnuz_type>;
template struct test_softmax<1, migraphx::shape::fp8e4m3fnuz_type>;
template struct test_softmax<2, migraphx::shape::fp8e4m3fnuz_type>;
template struct test_softmax<3, migraphx::shape::fp8e4m3fnuz_type>;
...@@ -27,16 +27,21 @@ ...@@ -27,16 +27,21 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_sqrt : verify_program<test_sqrt> template <migraphx::shape::type_t DType>
struct test_sqrt : verify_program<test_sqrt<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {2, 3, 4, 6}}; migraphx::shape s{DType, {2, 3, 4, 6}};
auto param = mm->add_parameter("x", s); auto param = mm->add_parameter("x", s);
auto param_abs = mm->add_instruction(migraphx::make_op("abs"), param); auto param_abs = mm->add_instruction(migraphx::make_op("abs"), param);
mm->add_instruction(migraphx::make_op("sqrt"), param_abs); mm->add_instruction(migraphx::make_op("sqrt"), param_abs);
return p; return p;
} }
}; };
template struct test_sqrt<migraphx::shape::float_type>;
template struct test_sqrt<migraphx::shape::half_type>;
template struct test_sqrt<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -27,15 +27,20 @@ ...@@ -27,15 +27,20 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_tan : verify_program<test_tan> template <migraphx::shape::type_t DType>
struct test_tan : verify_program<test_tan<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {16}}; migraphx::shape s{DType, {16}};
auto x = mm->add_parameter("x", s); auto x = mm->add_parameter("x", s);
mm->add_instruction(migraphx::make_op("tan"), x); mm->add_instruction(migraphx::make_op("tan"), x);
return p; return p;
} }
}; };
template struct test_tan<migraphx::shape::float_type>;
template struct test_tan<migraphx::shape::half_type>;
template struct test_tan<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -27,14 +27,19 @@ ...@@ -27,14 +27,19 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_tanh : verify_program<test_tanh> template <migraphx::shape::type_t DType>
struct test_tanh : verify_program<test_tanh<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto x = mm->add_parameter("x", migraphx::shape{migraphx::shape::float_type, {4, 3, 3, 3}}); auto x = mm->add_parameter("x", migraphx::shape{DType, {4, 3, 3, 3}});
mm->add_instruction(migraphx::make_op("tanh"), x); mm->add_instruction(migraphx::make_op("tanh"), x);
return p; return p;
} }
}; };
template struct test_tanh<migraphx::shape::float_type>;
template struct test_tanh<migraphx::shape::half_type>;
template struct test_tanh<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -27,13 +27,14 @@ ...@@ -27,13 +27,14 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_topk_0 : verify_program<test_topk_0> template <migraphx::shape::type_t DType>
struct test_topk_0 : verify_program<test_topk_0<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape s{migraphx::shape::float_type, {3, 5}}; migraphx::shape s{DType, {3, 5}};
auto data = mm->add_parameter("data", s); auto data = mm->add_parameter("data", s);
auto r = mm->add_instruction( auto r = mm->add_instruction(
migraphx::make_op("topk", {{"axis", 1}, {"k", 4}, {"largest", 1}}), data); migraphx::make_op("topk", {{"axis", 1}, {"k", 4}, {"largest", 1}}), data);
...@@ -43,3 +44,7 @@ struct test_topk_0 : verify_program<test_topk_0> ...@@ -43,3 +44,7 @@ struct test_topk_0 : verify_program<test_topk_0>
return p; return p;
} }
}; };
template struct test_topk_0<migraphx::shape::float_type>;
template struct test_topk_0<migraphx::shape::half_type>;
template struct test_topk_0<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -27,15 +27,17 @@ ...@@ -27,15 +27,17 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp> #include <migraphx/apply_alpha_beta.hpp>
struct test_unbatched_gemm_1 : verify_program<test_unbatched_gemm_1>
template <migraphx::shape::type_t DType>
struct test_unbatched_gemm_1 : verify_program<test_unbatched_gemm_1<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape m1_shape{migraphx::shape::float_type, {2, 32, 64}}; migraphx::shape m1_shape{DType, {2, 32, 64}};
migraphx::shape m2_shape{migraphx::shape::float_type, {64, 64}}; migraphx::shape m2_shape{DType, {64, 64}};
migraphx::shape m3_shape{migraphx::shape::float_type, {2, 32, 192}}; migraphx::shape m3_shape{DType, {2, 32, 192}};
auto l1 = mm->add_parameter("1", m1_shape); auto l1 = mm->add_parameter("1", m1_shape);
auto l2 = mm->add_literal(migraphx::generate_literal(m2_shape)); auto l2 = mm->add_literal(migraphx::generate_literal(m2_shape));
l2 = mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {2, 64, 64}}}), l2 = mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {2, 64, 64}}}),
...@@ -56,3 +58,7 @@ struct test_unbatched_gemm_1 : verify_program<test_unbatched_gemm_1> ...@@ -56,3 +58,7 @@ struct test_unbatched_gemm_1 : verify_program<test_unbatched_gemm_1>
return p; return p;
} }
}; };
template struct test_unbatched_gemm_1<migraphx::shape::float_type>;
template struct test_unbatched_gemm_1<migraphx::shape::half_type>;
template struct test_unbatched_gemm_1<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -27,14 +27,16 @@ ...@@ -27,14 +27,16 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp> #include <migraphx/apply_alpha_beta.hpp>
struct test_unbatched_gemm_2 : verify_program<test_unbatched_gemm_2>
template <migraphx::shape::type_t DType>
struct test_unbatched_gemm_2 : verify_program<test_unbatched_gemm_2<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
migraphx::program p; migraphx::program p;
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
migraphx::shape m1_shape{migraphx::shape::float_type, {4, 32, 64}}; migraphx::shape m1_shape{DType, {4, 32, 64}};
migraphx::shape m2_shape{migraphx::shape::float_type, {64, 64}}; migraphx::shape m2_shape{DType, {64, 64}};
auto l1 = mm->add_parameter("1", m1_shape); auto l1 = mm->add_parameter("1", m1_shape);
auto l2 = mm->add_literal(migraphx::generate_literal(m2_shape)); auto l2 = mm->add_literal(migraphx::generate_literal(m2_shape));
l2 = mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {4, 64, 64}}}), l2 = mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {4, 64, 64}}}),
...@@ -44,3 +46,7 @@ struct test_unbatched_gemm_2 : verify_program<test_unbatched_gemm_2> ...@@ -44,3 +46,7 @@ struct test_unbatched_gemm_2 : verify_program<test_unbatched_gemm_2>
return p; return p;
} }
}; };
template struct test_unbatched_gemm_2<migraphx::shape::float_type>;
template struct test_unbatched_gemm_2<migraphx::shape::half_type>;
template struct test_unbatched_gemm_2<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -27,7 +27,8 @@ ...@@ -27,7 +27,8 @@
#include <migraphx/generate.hpp> #include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp> #include <migraphx/make_op.hpp>
struct test_where : verify_program<test_where> template <migraphx::shape::type_t DType>
struct test_where : verify_program<test_where<DType>>
{ {
migraphx::program create_program() const migraphx::program create_program() const
{ {
...@@ -44,3 +45,7 @@ struct test_where : verify_program<test_where> ...@@ -44,3 +45,7 @@ struct test_where : verify_program<test_where>
return p; return p;
}; };
}; };
template struct test_where<migraphx::shape::float_type>;
template struct test_where<migraphx::shape::half_type>;
template struct test_where<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -134,10 +134,11 @@ def check_correctness(gold_outputs, ...@@ -134,10 +134,11 @@ def check_correctness(gold_outputs,
if not np.allclose(gold_outputs[i], outputs[i], rtol, atol): if not np.allclose(gold_outputs[i], outputs[i], rtol, atol):
ret = False ret = False
if verbose: if verbose:
print('\nOutput {} is incorrect ...'.format(i)) with np.printoptions(threshold=np.inf):
print('Expected value: \n{}'.format(gold_outputs[i])) print('\nOutput {} is incorrect ...'.format(i))
print('......') print('Expected value: \n{}\n'.format(gold_outputs[i]))
print('Actual value: \n{}\n'.format(outputs[i])) print('\n......\n')
print('Actual value: \n{}\n'.format(outputs[i]))
else: else:
print('Outputs do not match') print('Outputs do not match')
break break
......
...@@ -63,7 +63,8 @@ def clang_format(against, apply=False, path=CLANG_FORMAT_PATH): ...@@ -63,7 +63,8 @@ def clang_format(against, apply=False, path=CLANG_FORMAT_PATH):
print(f"{git_clang_format} not installed. Skipping format.") print(f"{git_clang_format} not installed. Skipping format.")
return return
diff_flag = "" if apply else "--diff" diff_flag = "" if apply else "--diff"
run(f"{git_clang_format} --binary {clang_format} {diff_flag} {base}") run(f"{git_clang_format} --extensions c,cpp,hpp,h,cl,hip,in --binary {clang_format} {diff_flag} {base}"
)
def get_files_changed(against, ext=('py')): def get_files_changed(against, ext=('py')):
......
...@@ -53,7 +53,8 @@ else ...@@ -53,7 +53,8 @@ else
python3-pip \ python3-pip \
python3-venv \ python3-venv \
rocblas-dev \ rocblas-dev \
rocm-cmake rocm-cmake \
libtbb-dev
fi fi
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment