Commit 381b2d9e authored by Umang Yadav's avatar Umang Yadav
Browse files

add half tests

parent 379692fc
...@@ -49,4 +49,5 @@ struct gemm_2args_bmv : verify_program<gemm_2args_bmv<DType>> ...@@ -49,4 +49,5 @@ struct gemm_2args_bmv : verify_program<gemm_2args_bmv<DType>>
}; };
template struct gemm_2args_bmv<migraphx::shape::float_type>; template struct gemm_2args_bmv<migraphx::shape::float_type>;
template struct gemm_2args_bmv<migraphx::shape::half_type>;
template struct gemm_2args_bmv<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_bmv<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -48,4 +48,5 @@ struct gemm_2args_mm_1 : verify_program<gemm_2args_mm_1<DType>> ...@@ -48,4 +48,5 @@ struct gemm_2args_mm_1 : verify_program<gemm_2args_mm_1<DType>>
}; };
template struct gemm_2args_mm_1<migraphx::shape::float_type>; template struct gemm_2args_mm_1<migraphx::shape::float_type>;
template struct gemm_2args_mm_1<migraphx::shape::half_type>;
template struct gemm_2args_mm_1<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mm_1<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -49,4 +49,5 @@ struct gemm_2args_mm_2 : verify_program<gemm_2args_mm_2<DType>> ...@@ -49,4 +49,5 @@ struct gemm_2args_mm_2 : verify_program<gemm_2args_mm_2<DType>>
}; };
template struct gemm_2args_mm_2<migraphx::shape::float_type>; template struct gemm_2args_mm_2<migraphx::shape::float_type>;
template struct gemm_2args_mm_2<migraphx::shape::half_type>;
template struct gemm_2args_mm_2<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mm_2<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -49,4 +49,5 @@ struct gemm_2args_mm_3 : verify_program<gemm_2args_mm_3<DType>> ...@@ -49,4 +49,5 @@ struct gemm_2args_mm_3 : verify_program<gemm_2args_mm_3<DType>>
}; };
template struct gemm_2args_mm_3<migraphx::shape::float_type>; template struct gemm_2args_mm_3<migraphx::shape::float_type>;
template struct gemm_2args_mm_3<migraphx::shape::half_type>;
template struct gemm_2args_mm_3<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mm_3<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -49,4 +49,5 @@ struct gemm_2args_mm_4 : verify_program<gemm_2args_mm_4<DType>> ...@@ -49,4 +49,5 @@ struct gemm_2args_mm_4 : verify_program<gemm_2args_mm_4<DType>>
}; };
template struct gemm_2args_mm_4<migraphx::shape::float_type>; template struct gemm_2args_mm_4<migraphx::shape::float_type>;
template struct gemm_2args_mm_4<migraphx::shape::half_type>;
template struct gemm_2args_mm_4<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mm_4<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -48,4 +48,5 @@ struct gemm_2args_mm_5 : verify_program<gemm_2args_mm_5<DType>> ...@@ -48,4 +48,5 @@ struct gemm_2args_mm_5 : verify_program<gemm_2args_mm_5<DType>>
}; };
template struct gemm_2args_mm_5<migraphx::shape::float_type>; template struct gemm_2args_mm_5<migraphx::shape::float_type>;
template struct gemm_2args_mm_5<migraphx::shape::half_type>;
template struct gemm_2args_mm_5<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mm_5<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -51,4 +51,5 @@ struct gemm_2args_mm_6 : verify_program<gemm_2args_mm_6<DType>> ...@@ -51,4 +51,5 @@ struct gemm_2args_mm_6 : verify_program<gemm_2args_mm_6<DType>>
}; };
template struct gemm_2args_mm_6<migraphx::shape::float_type>; template struct gemm_2args_mm_6<migraphx::shape::float_type>;
template struct gemm_2args_mm_6<migraphx::shape::half_type>;
template struct gemm_2args_mm_6<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mm_6<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -48,4 +48,5 @@ struct gemm_2args_mm_7 : verify_program<gemm_2args_mm_7<DType>> ...@@ -48,4 +48,5 @@ struct gemm_2args_mm_7 : verify_program<gemm_2args_mm_7<DType>>
}; };
template struct gemm_2args_mm_7<migraphx::shape::float_type>; template struct gemm_2args_mm_7<migraphx::shape::float_type>;
template struct gemm_2args_mm_7<migraphx::shape::half_type>;
template struct gemm_2args_mm_7<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mm_7<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -48,4 +48,5 @@ struct gemm_2args_mm_8 : verify_program<gemm_2args_mm_8<DType>> ...@@ -48,4 +48,5 @@ struct gemm_2args_mm_8 : verify_program<gemm_2args_mm_8<DType>>
}; };
template struct gemm_2args_mm_8<migraphx::shape::float_type>; template struct gemm_2args_mm_8<migraphx::shape::float_type>;
template struct gemm_2args_mm_8<migraphx::shape::half_type>;
template struct gemm_2args_mm_8<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mm_8<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -47,4 +47,5 @@ struct gemm_2args_mv : verify_program<gemm_2args_mv<DType>> ...@@ -47,4 +47,5 @@ struct gemm_2args_mv : verify_program<gemm_2args_mv<DType>>
}; };
template struct gemm_2args_mv<migraphx::shape::float_type>; template struct gemm_2args_mv<migraphx::shape::float_type>;
template struct gemm_2args_mv<migraphx::shape::half_type>;
template struct gemm_2args_mv<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_mv<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -51,4 +51,5 @@ struct gemm_2args_vbm : verify_program<gemm_2args_vbm<DType>> ...@@ -51,4 +51,5 @@ struct gemm_2args_vbm : verify_program<gemm_2args_vbm<DType>>
}; };
template struct gemm_2args_vbm<migraphx::shape::float_type>; template struct gemm_2args_vbm<migraphx::shape::float_type>;
template struct gemm_2args_vbm<migraphx::shape::half_type>;
template struct gemm_2args_vbm<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_vbm<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -48,4 +48,5 @@ struct gemm_2args_vm : verify_program<gemm_2args_vm<DType>> ...@@ -48,4 +48,5 @@ struct gemm_2args_vm : verify_program<gemm_2args_vm<DType>>
}; };
template struct gemm_2args_vm<migraphx::shape::float_type>; template struct gemm_2args_vm<migraphx::shape::float_type>;
template struct gemm_2args_vm<migraphx::shape::half_type>;
template struct gemm_2args_vm<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_vm<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -51,4 +51,5 @@ struct gemm_2args_vv : verify_program<gemm_2args_vv<DType>> ...@@ -51,4 +51,5 @@ struct gemm_2args_vv : verify_program<gemm_2args_vv<DType>>
}; };
template struct gemm_2args_vv<migraphx::shape::float_type>; template struct gemm_2args_vv<migraphx::shape::float_type>;
template struct gemm_2args_vv<migraphx::shape::half_type>;
template struct gemm_2args_vv<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_2args_vv<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -49,4 +49,5 @@ struct gemm_add : verify_program<gemm_add<DType>> ...@@ -49,4 +49,5 @@ struct gemm_add : verify_program<gemm_add<DType>>
}; };
template struct gemm_add<migraphx::shape::float_type>; template struct gemm_add<migraphx::shape::float_type>;
template struct gemm_add<migraphx::shape::half_type>;
template struct gemm_add<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_add<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -51,4 +51,5 @@ struct gemm_add_broadcast1 : verify_program<gemm_add_broadcast1<DType>> ...@@ -51,4 +51,5 @@ struct gemm_add_broadcast1 : verify_program<gemm_add_broadcast1<DType>>
}; };
template struct gemm_add_broadcast1<migraphx::shape::float_type>; template struct gemm_add_broadcast1<migraphx::shape::float_type>;
template struct gemm_add_broadcast1<migraphx::shape::half_type>;
template struct gemm_add_broadcast1<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_add_broadcast1<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -51,4 +51,5 @@ struct gemm_add_broadcast2 : verify_program<gemm_add_broadcast2<DType>> ...@@ -51,4 +51,5 @@ struct gemm_add_broadcast2 : verify_program<gemm_add_broadcast2<DType>>
}; };
template struct gemm_add_broadcast2<migraphx::shape::float_type>; template struct gemm_add_broadcast2<migraphx::shape::float_type>;
template struct gemm_add_broadcast2<migraphx::shape::half_type>;
template struct gemm_add_broadcast2<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_add_broadcast2<migraphx::shape::fp8e4m3fnuz_type>;
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct gemm_add_broadcast_half : verify_program<gemm_add_broadcast_half>
{
migraphx::program create_program() const
{
migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape m1_shape{migraphx::shape::half_type, {1, 2, 3}};
migraphx::shape m2_shape{migraphx::shape::half_type, {1, 3, 4}};
migraphx::shape m3_shape{migraphx::shape::half_type, {1, 1, 4}};
auto l1 = mm->add_parameter("1", m1_shape);
auto l2 = mm->add_parameter("2", m2_shape);
auto l3 = mm->add_parameter("3", m3_shape);
auto l3_b =
mm->add_instruction(migraphx::make_op("multibroadcast", {{"out_lens", {1, 2, 4}}}), l3);
auto dot = mm->add_instruction(migraphx::make_op("dot"), l1, l2);
mm->add_instruction(migraphx::make_op("add"), dot, l3_b);
return p;
}
};
/*
* The MIT License (MIT)
*
* Copyright (c) 2015-2022 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
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include "verify_program.hpp"
#include <migraphx/program.hpp>
#include <migraphx/generate.hpp>
#include <migraphx/make_op.hpp>
#include <migraphx/apply_alpha_beta.hpp>
struct gemm_add_half : verify_program<gemm_add_half>
{
migraphx::program create_program() const
{
migraphx::program p;
auto* mm = p.get_main_module();
migraphx::shape m1_shape{migraphx::shape::half_type, {1, 2, 3}};
migraphx::shape m2_shape{migraphx::shape::half_type, {1, 3, 4}};
migraphx::shape m3_shape{migraphx::shape::half_type, {1, 2, 4}};
auto l1 = mm->add_parameter("1", m1_shape);
auto l2 = mm->add_parameter("2", m2_shape);
auto l3 = mm->add_parameter("3", m3_shape);
auto dot = mm->add_instruction(migraphx::make_op("dot"), l1, l2);
mm->add_instruction(migraphx::make_op("add"), dot, l3);
return p;
}
};
...@@ -46,4 +46,5 @@ struct gemm_literal : verify_program<gemm_literal<DType>> ...@@ -46,4 +46,5 @@ struct gemm_literal : verify_program<gemm_literal<DType>>
}; };
template struct gemm_literal<migraphx::shape::float_type>; template struct gemm_literal<migraphx::shape::float_type>;
template struct gemm_literal<migraphx::shape::half_type>;
template struct gemm_literal<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_literal<migraphx::shape::fp8e4m3fnuz_type>;
...@@ -50,4 +50,5 @@ struct gemm_multi_3args : verify_program<gemm_multi_3args<DType>> ...@@ -50,4 +50,5 @@ struct gemm_multi_3args : verify_program<gemm_multi_3args<DType>>
}; };
template struct gemm_multi_3args<migraphx::shape::float_type>; template struct gemm_multi_3args<migraphx::shape::float_type>;
template struct gemm_multi_3args<migraphx::shape::half_type>;
template struct gemm_multi_3args<migraphx::shape::fp8e4m3fnuz_type>; template struct gemm_multi_3args<migraphx::shape::fp8e4m3fnuz_type>;
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