Unverified Commit 8d21fdc9 authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Refactor to use make_op almost everywhere (#696)

* Load op when serializing

* Formatting

* Add missing clip field

* Use make_op almost everywhere

* Formatting

* More make ops for rnns

* Get rid of spaces

* Formatting

* Remove operators headers

* Formatting

* Remove unused op headers

* Increase line threshold
parent b5633c27
This diff is collapsed.
This diff is collapsed.
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/ref/target.hpp> #include <migraphx/ref/target.hpp>
#include <migraphx/load_save.hpp> #include <migraphx/load_save.hpp>
#include <migraphx/op/add.hpp>
#include "test.hpp" #include "test.hpp"
#include <migraphx/make_op.hpp>
#include <cstdio> #include <cstdio>
migraphx::program create_program() migraphx::program create_program()
...@@ -12,7 +13,7 @@ migraphx::program create_program() ...@@ -12,7 +13,7 @@ migraphx::program create_program()
auto x = mm->add_parameter("x", {migraphx::shape::int32_type}); auto x = mm->add_parameter("x", {migraphx::shape::int32_type});
auto two = mm->add_literal(2); auto two = mm->add_literal(2);
auto add = mm->add_instruction(migraphx::op::add{}, x, two); auto add = mm->add_instruction(migraphx::make_op("add"), x, two);
mm->add_return({add}); mm->add_return({add});
return p; return p;
} }
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#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/operators.hpp> #include <migraphx/make_op.hpp>
struct batch_quant_dot_1 : verify_program<batch_quant_dot_1> struct batch_quant_dot_1 : verify_program<batch_quant_dot_1>
{ {
...@@ -14,12 +14,15 @@ struct batch_quant_dot_1 : verify_program<batch_quant_dot_1> ...@@ -14,12 +14,15 @@ struct batch_quant_dot_1 : verify_program<batch_quant_dot_1>
migraphx::shape m2_shape{migraphx::shape::int8_type, {3, 2, 7, 8}}; migraphx::shape m2_shape{migraphx::shape::int8_type, {3, 2, 7, 8}};
migraphx::shape m3_shape{migraphx::shape::int32_type, {3, 2, 2, 7}}; migraphx::shape m3_shape{migraphx::shape::int32_type, {3, 2, 2, 7}};
auto l1 = mm->add_parameter("a", m1_shape); auto l1 = mm->add_parameter("a", m1_shape);
auto tl1 = mm->add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, l1); auto tl1 =
auto l2 = mm->add_parameter("b", m2_shape); mm->add_instruction(migraphx::make_op("transpose", {{"dims", {0, 1, 3, 2}}}), l1);
auto tl2 = mm->add_instruction(migraphx::op::transpose{{0, 1, 3, 2}}, l2); auto l2 = mm->add_parameter("b", m2_shape);
auto l3 = mm->add_parameter("c", m3_shape); auto tl2 =
mm->add_instruction(migraphx::op::quant_dot{3, 2}, tl1, tl2, l3); mm->add_instruction(migraphx::make_op("transpose", {{"dims", {0, 1, 3, 2}}}), l2);
auto l3 = mm->add_parameter("c", m3_shape);
mm->add_instruction(
migraphx::make_op("quant_dot", {{"alpha", 3}, {"beta", 2}}), tl1, tl2, l3);
return p; return p;
} }
}; };
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
#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/operators.hpp> #include <migraphx/make_op.hpp>
struct batch_quant_dot_2 : verify_program<batch_quant_dot_2> struct batch_quant_dot_2 : verify_program<batch_quant_dot_2>
{ {
...@@ -17,7 +17,8 @@ struct batch_quant_dot_2 : verify_program<batch_quant_dot_2> ...@@ -17,7 +17,8 @@ struct batch_quant_dot_2 : verify_program<batch_quant_dot_2>
auto l1 = mm->add_parameter("a", m1_shape); auto l1 = mm->add_parameter("a", m1_shape);
auto l2 = mm->add_parameter("b", m2_shape); auto l2 = mm->add_parameter("b", m2_shape);
auto l3 = mm->add_parameter("c", m3_shape); auto l3 = mm->add_parameter("c", m3_shape);
mm->add_instruction(migraphx::op::quant_dot{1, 3}, l1, l2, l3); mm->add_instruction(
migraphx::make_op("quant_dot", {{"alpha", 1}, {"beta", 3}}), l1, l2, l3);
return p; return p;
} }
}; };
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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