Commit f1c8e6c9 authored by turneram's avatar turneram
Browse files

Merge remote-tracking branch 'origin/develop' into ck-integration-tuning

parents d09b7682 c1b8c975
5a43828b3d73028bfd33b3856f82698d9ab02cb1 fbf08c4b4dce5da245189203d9f6cfc41f6663a2
...@@ -743,6 +743,33 @@ def clip_test_args_type_mismatch(): ...@@ -743,6 +743,33 @@ def clip_test_args_type_mismatch():
return ([node], [x], [y], [min_val, max_val]) return ([node], [x], [y], [min_val, max_val])
@onnx_test()
def clip_dyn_min_max_test():
x = helper.make_tensor_value_info('0', TensorProto.FLOAT, [None])
y = helper.make_tensor_value_info('1', TensorProto.FLOAT, [None])
min_val = helper.make_tensor('min', TensorProto.FLOAT, [], [0.0])
max_val = helper.make_tensor('max', TensorProto.FLOAT, [], [6.0])
node = onnx.helper.make_node('Clip',
inputs=['0', 'min', 'max'],
outputs=['1'])
return ([node], [x], [y], [min_val, max_val])
@onnx_test()
def clip_dyn_min_only_test():
x = helper.make_tensor_value_info('0', TensorProto.FLOAT, [None])
y = helper.make_tensor_value_info('1', TensorProto.FLOAT, [None])
min_val = helper.make_tensor('min', TensorProto.FLOAT, [], [0.0])
node = onnx.helper.make_node('Clip', inputs=['0', 'min'], outputs=['1'])
return ([node], [x], [y], [min_val])
@onnx_test() @onnx_test()
def concat_test(): def concat_test():
x = helper.make_tensor_value_info('0', TensorProto.FLOAT, [2, 4, 3]) x = helper.make_tensor_value_info('0', TensorProto.FLOAT, [2, 4, 3])
......
...@@ -823,6 +823,47 @@ TEST_CASE(clip_test_args_type_mismatch) ...@@ -823,6 +823,47 @@ TEST_CASE(clip_test_args_type_mismatch)
EXPECT(p == prog); EXPECT(p == prog);
} }
TEST_CASE(clip_dyn_min_max_test)
{
migraphx::program p;
auto* mm = p.get_main_module();
auto min_val = mm->add_literal(0.0f);
auto max_val = mm->add_literal(6.0f);
std::vector<migraphx::shape::dynamic_dimension> dds = {{2, 8, {3}}};
auto l0 = mm->add_parameter("0", migraphx::shape{migraphx::shape::float_type, dds});
min_val = mm->add_instruction(
migraphx::make_op("multibroadcast", {{"out_dyn_dims", to_value(dds)}}), min_val, l0);
max_val = mm->add_instruction(
migraphx::make_op("multibroadcast", {{"out_dyn_dims", to_value(dds)}}), max_val, l0);
auto ret = mm->add_instruction(migraphx::make_op("clip"), l0, min_val, max_val);
mm->add_return({ret});
migraphx::onnx_options options;
options.default_dyn_dim_value = {2, 8, {3}};
auto prog = parse_onnx("clip_dyn_min_max_test.onnx", options);
EXPECT(p == prog);
}
TEST_CASE(clip_dyn_min_only_test)
{
migraphx::program p;
auto* mm = p.get_main_module();
auto min_val = mm->add_literal(0.0f);
std::vector<migraphx::shape::dynamic_dimension> dds = {{2, 8, {3}}};
auto l0 = mm->add_parameter("0", migraphx::shape{migraphx::shape::float_type, dds});
min_val = mm->add_instruction(
migraphx::make_op("multibroadcast", {{"out_dyn_dims", to_value(dds)}}), min_val, l0);
auto ret = mm->add_instruction(migraphx::make_op("max"), l0, min_val);
mm->add_return({ret});
migraphx::onnx_options options;
options.default_dyn_dim_value = {2, 8, {3}};
auto prog = parse_onnx("clip_dyn_min_only_test.onnx", options);
EXPECT(p == prog);
}
TEST_CASE(concat_test) TEST_CASE(concat_test)
{ {
migraphx::program p; migraphx::program p;
......
...@@ -40,12 +40,12 @@ TEST_CASE(const_add) ...@@ -40,12 +40,12 @@ TEST_CASE(const_add)
auto one = m1.add_literal(1); auto one = m1.add_literal(1);
auto two = m1.add_literal(2); auto two = m1.add_literal(2);
auto sum = m1.add_instruction(migraphx::make_op("add"), one, two); auto sum = m1.add_instruction(migraphx::make_op("add"), one, two);
m1.add_instruction(pass_op{}, sum); m1.add_instruction(non_const_pass_op{}, sum);
run_pass(m1); run_pass(m1);
migraphx::module m2; migraphx::module m2;
auto total = m2.add_literal(3); auto total = m2.add_literal(3);
m2.add_instruction(pass_op{}, total); m2.add_instruction(non_const_pass_op{}, total);
EXPECT(m1 == m2); EXPECT(m1 == m2);
} }
...@@ -55,12 +55,12 @@ TEST_CASE(const_add_parameter) ...@@ -55,12 +55,12 @@ TEST_CASE(const_add_parameter)
auto one = m1.add_parameter("one", {migraphx::shape::int32_type, {1}}); auto one = m1.add_parameter("one", {migraphx::shape::int32_type, {1}});
auto two = m1.add_literal(2); auto two = m1.add_literal(2);
auto sum = m1.add_instruction(migraphx::make_op("add"), one, two); auto sum = m1.add_instruction(migraphx::make_op("add"), one, two);
m1.add_instruction(pass_op{}, sum); m1.add_instruction(non_const_pass_op{}, sum);
run_pass(m1); run_pass(m1);
migraphx::module m2; migraphx::module m2;
auto total = m2.add_literal(3); auto total = m2.add_literal(3);
m2.add_instruction(pass_op{}, total); m2.add_instruction(non_const_pass_op{}, total);
EXPECT(m1 != m2); EXPECT(m1 != m2);
} }
...@@ -71,12 +71,12 @@ TEST_CASE(const_multiadd) ...@@ -71,12 +71,12 @@ TEST_CASE(const_multiadd)
auto two = m1.add_literal(2); auto two = m1.add_literal(2);
auto sum1 = m1.add_instruction(migraphx::make_op("add"), one, two); auto sum1 = m1.add_instruction(migraphx::make_op("add"), one, two);
auto sum2 = m1.add_instruction(migraphx::make_op("add"), sum1, two); auto sum2 = m1.add_instruction(migraphx::make_op("add"), sum1, two);
m1.add_instruction(pass_op{}, sum2); m1.add_instruction(non_const_pass_op{}, sum2);
run_pass(m1); run_pass(m1);
migraphx::module m2; migraphx::module m2;
auto total = m2.add_literal(5); auto total = m2.add_literal(5);
m2.add_instruction(pass_op{}, total); m2.add_instruction(non_const_pass_op{}, total);
EXPECT(m1 == m2); EXPECT(m1 == m2);
} }
...@@ -88,12 +88,12 @@ TEST_CASE(const_add_mul) ...@@ -88,12 +88,12 @@ TEST_CASE(const_add_mul)
auto mul = m1.add_instruction(migraphx::make_op("mul"), two, two); auto mul = m1.add_instruction(migraphx::make_op("mul"), two, two);
auto sum1 = m1.add_instruction(migraphx::make_op("add"), one, mul); auto sum1 = m1.add_instruction(migraphx::make_op("add"), one, mul);
auto sum2 = m1.add_instruction(migraphx::make_op("add"), sum1, two); auto sum2 = m1.add_instruction(migraphx::make_op("add"), sum1, two);
m1.add_instruction(pass_op{}, sum2); m1.add_instruction(non_const_pass_op{}, sum2);
run_pass(m1); run_pass(m1);
migraphx::module m2; migraphx::module m2;
auto total = m2.add_literal(7); auto total = m2.add_literal(7);
m2.add_instruction(pass_op{}, total); m2.add_instruction(non_const_pass_op{}, total);
EXPECT(m1 == m2); EXPECT(m1 == m2);
} }
...@@ -105,13 +105,13 @@ TEST_CASE(const_add_scalar) ...@@ -105,13 +105,13 @@ TEST_CASE(const_add_scalar)
auto two = m1.add_instruction(migraphx::make_op("scalar", {{"scalar_bcst_dims", {2, 2}}}), auto two = m1.add_instruction(migraphx::make_op("scalar", {{"scalar_bcst_dims", {2, 2}}}),
m1.add_literal(2)); m1.add_literal(2));
auto sum = m1.add_instruction(migraphx::make_op("add"), one, two); auto sum = m1.add_instruction(migraphx::make_op("add"), one, two);
m1.add_instruction(pass_op{}, sum); m1.add_instruction(non_const_pass_op{}, sum);
run_pass(m1); run_pass(m1);
migraphx::module m2; migraphx::module m2;
auto total = auto total =
m2.add_literal(migraphx::literal{{migraphx::shape::int32_type, {2, 2}}, {3, 3, 3, 3}}); m2.add_literal(migraphx::literal{{migraphx::shape::int32_type, {2, 2}}, {3, 3, 3, 3}});
m2.add_instruction(pass_op{}, total); m2.add_instruction(non_const_pass_op{}, total);
EXPECT(m1 == m2); EXPECT(m1 == m2);
} }
...@@ -121,7 +121,7 @@ TEST_CASE(const_scalar) ...@@ -121,7 +121,7 @@ TEST_CASE(const_scalar)
{ {
auto one = m1.add_instruction(migraphx::make_op("scalar", {{"scalar_bcst_dims", {2, 2}}}), auto one = m1.add_instruction(migraphx::make_op("scalar", {{"scalar_bcst_dims", {2, 2}}}),
m1.add_literal(1)); m1.add_literal(1));
m1.add_instruction(pass_op{}, one); m1.add_instruction(non_const_pass_op{}, one);
} }
run_pass(m1); run_pass(m1);
...@@ -129,7 +129,7 @@ TEST_CASE(const_scalar) ...@@ -129,7 +129,7 @@ TEST_CASE(const_scalar)
{ {
auto one = m2.add_instruction(migraphx::make_op("scalar", {{"scalar_bcst_dims", {2, 2}}}), auto one = m2.add_instruction(migraphx::make_op("scalar", {{"scalar_bcst_dims", {2, 2}}}),
m2.add_literal(1)); m2.add_literal(1));
m2.add_instruction(pass_op{}, one); m2.add_instruction(non_const_pass_op{}, one);
} }
EXPECT(m1 == m2); EXPECT(m1 == m2);
} }
......
...@@ -82,13 +82,17 @@ TEST_CASE(param_add) ...@@ -82,13 +82,17 @@ TEST_CASE(param_add)
auto hp1 = mm->add_instruction(migraphx::make_op("convert"), p1); auto hp1 = mm->add_instruction(migraphx::make_op("convert"), p1);
auto hp2 = mm->add_instruction(migraphx::make_op("convert"), p2); auto hp2 = mm->add_instruction(migraphx::make_op("convert"), p2);
auto hs = mm->add_instruction(migraphx::make_op("add"), hp1, hp2); auto hs = mm->add_instruction(migraphx::make_op("add"), hp1, hp2);
auto res = mm->add_instruction( auto fs = mm->add_instruction(
migraphx::make_op("convert", migraphx::make_op("convert",
{{"target_type", migraphx::to_value(migraphx::shape::float_type)}}), {{"target_type", migraphx::to_value(migraphx::shape::float_type)}}),
hs); hs);
if(add_return) if(add_return)
{ {
mm->add_return({res}); mm->add_return({fs});
}
else
{
mm->add_instruction(migraphx::make_op("identity"), {fs});
} }
return p; return p;
...@@ -159,10 +163,10 @@ TEST_CASE(param_add_sub) ...@@ -159,10 +163,10 @@ TEST_CASE(param_add_sub)
auto diff = mm->add_instruction(migraphx::make_op("sub"), sum, p2); auto diff = mm->add_instruction(migraphx::make_op("sub"), sum, p2);
auto hdiff = mm->add_instruction( auto hdiff = mm->add_instruction(
migraphx::make_op("convert", {{"target_type", migraphx::shape::half_type}}), diff); migraphx::make_op("convert", {{"target_type", migraphx::shape::half_type}}), diff);
auto res = mm->add_instruction(migraphx::make_op("add"), hdiff, hp1); auto hadd = mm->add_instruction(migraphx::make_op("add"), hdiff, hp1);
auto r = mm->add_instruction( auto fadd = mm->add_instruction(
migraphx::make_op("convert", {{"target_type", migraphx::shape::float_type}}), res); migraphx::make_op("convert", {{"target_type", migraphx::shape::float_type}}), hadd);
mm->add_return({r}); mm->add_return({fadd});
return p; return p;
}; };
...@@ -258,7 +262,8 @@ TEST_CASE(param_add_sub) ...@@ -258,7 +262,8 @@ TEST_CASE(param_add_sub)
}; };
auto p0 = create_program_float(); auto p0 = create_program_float();
migraphx::run_passes(p0, {migraphx::quantize_fp16_pass{{"all"}}}); migraphx::run_passes(
p0, {migraphx::quantize_fp16_pass{{"all"}}, migraphx::dead_code_elimination{}});
EXPECT(p0 == create_program_fp16()); EXPECT(p0 == create_program_fp16());
auto p1 = create_program_float(); auto p1 = create_program_float();
...@@ -278,7 +283,6 @@ TEST_CASE(literal_add) ...@@ -278,7 +283,6 @@ TEST_CASE(literal_add)
auto l1 = mm->add_literal(migraphx::literal(s, data)); auto l1 = mm->add_literal(migraphx::literal(s, data));
auto l2 = mm->add_literal(migraphx::literal(s, data)); auto l2 = mm->add_literal(migraphx::literal(s, data));
mm->add_instruction(migraphx::make_op("add"), l1, l2); mm->add_instruction(migraphx::make_op("add"), l1, l2);
return p; return p;
}; };
...@@ -291,11 +295,11 @@ TEST_CASE(literal_add) ...@@ -291,11 +295,11 @@ TEST_CASE(literal_add)
auto l1 = mm->add_literal(migraphx::literal(s, data)); auto l1 = mm->add_literal(migraphx::literal(s, data));
auto l2 = mm->add_literal(migraphx::literal(s, data)); auto l2 = mm->add_literal(migraphx::literal(s, data));
auto hs = mm->add_instruction(migraphx::make_op("add"), l1, l2); auto hs = mm->add_instruction(migraphx::make_op("add"), l1, l2);
mm->add_instruction( auto fs = mm->add_instruction(
migraphx::make_op("convert", migraphx::make_op("convert",
{{"target_type", migraphx::to_value(migraphx::shape::float_type)}}), {{"target_type", migraphx::to_value(migraphx::shape::float_type)}}),
hs); hs);
mm->add_instruction(migraphx::make_op("identity"), fs);
return p; return p;
}; };
......
...@@ -850,6 +850,31 @@ TEST_CASE(clip_test) ...@@ -850,6 +850,31 @@ TEST_CASE(clip_test)
EXPECT(migraphx::verify_range(results_vector, gold)); EXPECT(migraphx::verify_range(results_vector, gold));
} }
TEST_CASE(clip_dyn_test)
{
migraphx::program p;
auto* mm = p.get_main_module();
std::vector<migraphx::shape::dynamic_dimension> dds = {{2, 8, {3}}};
migraphx::shape s{migraphx::shape::float_type, dds};
auto l = mm->add_parameter("X", s);
auto min_val = mm->add_literal(0.0f);
auto max_val = mm->add_literal(6.0f);
min_val = mm->add_instruction(migraphx::make_op("multibroadcast"), min_val, l);
max_val = mm->add_instruction(migraphx::make_op("multibroadcast"), max_val, l);
mm->add_instruction(migraphx::make_op("clip"), l, min_val, max_val);
p.compile(migraphx::make_target("ref"));
migraphx::shape static_shape{migraphx::shape::float_type, {3}};
migraphx::parameter_map params;
std::vector<float> data = {-1.0, 0.0, 10.0};
params["X"] = migraphx::argument(static_shape, data.data());
auto result = p.eval(params).back();
std::vector<float> results_vector(3);
result.visit([&](auto output) { results_vector.assign(output.begin(), output.end()); });
std::vector<float> gold = {0.0, 0.0, 6.0};
EXPECT(migraphx::verify_range(results_vector, gold));
}
TEST_CASE(concat_test) TEST_CASE(concat_test)
{ {
{ {
...@@ -7511,7 +7536,7 @@ TEST_CASE(select_module_not_found_error) ...@@ -7511,7 +7536,7 @@ TEST_CASE(select_module_not_found_error)
migraphx::parameter_map params; migraphx::parameter_map params;
migraphx::shape input_fixed_shape{migraphx::shape::float_type, {5, 2, 2}}; migraphx::shape input_fixed_shape{migraphx::shape::float_type, {5, 2, 2}};
params["data"] = migraphx::argument(input_fixed_shape, input_data.data()); params["data"] = migraphx::argument(input_fixed_shape, input_data.data());
EXPECT(test::throws([&] { p.eval(params).back(); })); EXPECT(test::throws([&] { std::ignore = p.eval(params).back(); }));
} }
TEST_CASE(scatternd_reduction_dyn_test) TEST_CASE(scatternd_reduction_dyn_test)
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
*/ */
#include <migraphx/program.hpp> #include <migraphx/program.hpp>
#include <migraphx/instruction.hpp> #include <migraphx/instruction.hpp>
#include <migraphx/make_op.hpp>
#include <basic_ops.hpp> #include <basic_ops.hpp>
#include <test.hpp> #include <test.hpp>
#include <rob.hpp> #include <rob.hpp>
...@@ -33,7 +34,7 @@ TEST_CASE(simple_test) ...@@ -33,7 +34,7 @@ TEST_CASE(simple_test)
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto one = mm->add_literal(1); auto one = mm->add_literal(1);
auto two = mm->add_literal(2); auto two = mm->add_literal(2);
mm->add_instruction(sum_op{}, one, two); mm->add_instruction(migraphx::make_op("add"), one, two);
EXPECT(bool{mm->validate() == mm->end()}); EXPECT(bool{mm->validate() == mm->end()});
auto result = p.eval({}); auto result = p.eval({});
EXPECT(result.back() == migraphx::literal{3}); EXPECT(result.back() == migraphx::literal{3});
...@@ -46,7 +47,7 @@ TEST_CASE(out_of_order) ...@@ -46,7 +47,7 @@ TEST_CASE(out_of_order)
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto one = mm->add_literal(1); auto one = mm->add_literal(1);
auto two = mm->add_literal(2); auto two = mm->add_literal(2);
auto ins = mm->add_instruction(sum_op{}, one, two); auto ins = mm->add_instruction(migraphx::make_op("add"), one, two);
mm->move_instruction(two, mm->end()); mm->move_instruction(two, mm->end());
EXPECT(bool{p.validate() == ins}); EXPECT(bool{p.validate() == ins});
} }
...@@ -57,7 +58,7 @@ TEST_CASE(incomplete_args) ...@@ -57,7 +58,7 @@ TEST_CASE(incomplete_args)
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto one = mm->add_literal(1); auto one = mm->add_literal(1);
auto two = mm->add_literal(2); auto two = mm->add_literal(2);
auto ins = mm->add_instruction(sum_op{}, one, two); auto ins = mm->add_instruction(migraphx::make_op("add"), one, two);
ins->clear_arguments(); ins->clear_arguments();
EXPECT(bool{p.validate() == ins}); EXPECT(bool{p.validate() == ins});
} }
...@@ -73,7 +74,7 @@ TEST_CASE(invalid_args) ...@@ -73,7 +74,7 @@ TEST_CASE(invalid_args)
auto* mm = p.get_main_module(); auto* mm = p.get_main_module();
auto one = mm->add_literal(1); auto one = mm->add_literal(1);
auto two = mm->add_literal(2); auto two = mm->add_literal(2);
auto ins = mm->add_instruction(sum_op{}, one, two); auto ins = mm->add_instruction(migraphx::make_op("add"), one, two);
access_ins_arguments(*ins).clear(); access_ins_arguments(*ins).clear();
EXPECT(bool{mm->validate() == mm->begin()}); EXPECT(bool{mm->validate() == mm->begin()});
} }
......
...@@ -49,7 +49,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f ...@@ -49,7 +49,7 @@ std::future<typename std::result_of<Function()>::type> detach_async(Function&& f
{ {
if(parallel) if(parallel)
{ {
using result_type = typename std::result_of<Function()>::type; using result_type = typename std::invoke_result<Function>::type;
std::packaged_task<result_type()> task(std::forward<Function>(f)); std::packaged_task<result_type()> task(std::forward<Function>(f));
auto fut = task.get_future(); auto fut = task.get_future();
std::thread(std::move(task)).detach(); std::thread(std::move(task)).detach();
......
...@@ -38,7 +38,7 @@ struct test_pad_highest : verify_program<test_pad_highest> ...@@ -38,7 +38,7 @@ struct test_pad_highest : verify_program<test_pad_highest>
migraphx::shape s0{migraphx::shape::half_type, {2, 2}}; migraphx::shape s0{migraphx::shape::half_type, {2, 2}};
auto l0 = mm->add_literal(migraphx::literal{s0, data0}); auto l0 = mm->add_literal(migraphx::literal{s0, data0});
migraphx::op::pad op{}; migraphx::op::pad op{};
op.value = std::numeric_limits<float>::max(); op.value = std::numeric_limits<migraphx::half>::max();
op.pads = {0, 0, 1, 1}; op.pads = {0, 0, 1, 1};
mm->add_instruction(op, l0); mm->add_instruction(op, l0);
return p; return p;
......
...@@ -38,7 +38,7 @@ struct test_pad_lowest : verify_program<test_pad_lowest> ...@@ -38,7 +38,7 @@ struct test_pad_lowest : verify_program<test_pad_lowest>
migraphx::shape s0{migraphx::shape::half_type, {2, 2}}; migraphx::shape s0{migraphx::shape::half_type, {2, 2}};
auto l0 = mm->add_literal(migraphx::literal{s0, data0}); auto l0 = mm->add_literal(migraphx::literal{s0, data0});
migraphx::op::pad op{}; migraphx::op::pad op{};
op.value = std::numeric_limits<float>::lowest(); op.value = std::numeric_limits<migraphx::half>::lowest();
op.pads = {0, 0, 1, 1}; op.pads = {0, 0, 1, 1};
mm->add_instruction(op, l0); mm->add_instruction(op, l0);
return p; return p;
......
FROM ubuntu:22.04
ARG PREFIX=/usr/local
# Support multiarch
RUN dpkg --add-architecture i386
# Install rocm key
RUN apt-get update && apt-get install -y gnupg2 --no-install-recommends curl && \
curl -fsSL http://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/rocm-keyring.gpg
# Add rocm repository
RUN sh -c "echo 'deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rocm-keyring.gpg] http://repo.radeon.com/rocm/apt/5.5 jammy main' > /etc/apt/sources.list.d/rocm.list"
# From docs.amd.com for installing rocm. Needed to install properly
RUN sh -c "echo 'Package: *\nPin: release o=repo.radeon.com\nPin-priority: 600' > /etc/apt/preferences.d/rocm-pin-600"
# Install dependencies
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
apt-utils \
build-essential \
#clang-format-10 \
cmake \
curl \
doxygen \
#g++-7 \
gdb \
git \
lcov \
locales \
pkg-config \
python3 \
python3-dev \
python3-pip \
software-properties-common \
wget \
rocm-device-libs \
hip-base \
libnuma-dev \
miopen-hip \
rocblas \
hipfft \
rocthrust \
rocrand \
hipsparse \
rccl \
rccl-dev \
rocm-smi-lib \
rocm-dev \
roctracer-dev \
hipcub \
hipblas \
hipify-clang \
half \
libssl-dev \
zlib1g-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# add this for roctracer dependancies
RUN pip3 install CppHeaderParser
# Workaround broken rocm packages
RUN ln -s /opt/rocm-* /opt/rocm
RUN echo "/opt/rocm/lib" > /etc/ld.so.conf.d/rocm.conf
RUN echo "/opt/rocm/llvm/lib" > /etc/ld.so.conf.d/rocm-llvm.conf
RUN ldconfig
RUN locale-gen en_US.UTF-8
RUN update-locale LANG=en_US.UTF-8
ENV LC_ALL=C.UTF-8
ENV LANG=C.UTF-8
# Install dependencies
ADD dev-requirements.txt /dev-requirements.txt
ADD requirements.txt /requirements.txt
ADD rbuild.ini /rbuild.ini
COPY ./tools/install_prereqs.sh /
RUN /install_prereqs.sh /usr/local / && rm /install_prereqs.sh
RUN test -f /usr/local/hash || exit 1
# Install yapf
RUN pip3 install yapf==0.28.0
# Install doc requirements
ADD doc/requirements.txt /doc-requirements.txt
RUN pip3 install -r /doc-requirements.txt
# Download real models to run onnx unit tests
ENV ONNX_HOME=/.onnx
COPY ./tools/download_models.sh /
RUN /download_models.sh && rm /download_models.sh
# Install latest ccache version
RUN cget -p $PREFIX install facebook/zstd@v1.4.5 -X subdir -DCMAKE_DIR=build/cmake
RUN cget -p $PREFIX install ccache@v4.1 -DENABLE_TESTING=OFF
RUN cget -p /opt/cmake install kitware/cmake@v3.24.3
COPY ./test/onnx/.onnxrt-commit /
ARG ONNXRUNTIME_REPO=https://github.com/Microsoft/onnxruntime
ARG ONNXRUNTIME_BRANCH=main
ARG ONNXRUNTIME_COMMIT
RUN git clone --single-branch --branch ${ONNXRUNTIME_BRANCH} --recursive ${ONNXRUNTIME_REPO} onnxruntime && \
cd onnxruntime && \
if [ -z "$ONNXRUNTIME_COMMIT" ] ; then git checkout $(cat /.onnxrt-commit) ; else git checkout ${ONNXRUNTIME_COMMIT} ; fi && \
/bin/sh /onnxruntime/dockerfiles/scripts/install_common_deps.sh
ADD tools/build_and_test_onnxrt.sh /onnxruntime/build_and_test_onnxrt.sh
RUN cget -p /usr/local install ROCmSoftwarePlatform/rocMLIR@a997d5f51314b45d7a4c04f1599966dcf53f9b4d -DBUILD_MIXR_TARGET=On -DLLVM_ENABLE_ZSTD=Off -DLLVM_ENABLE_THREADS=Off
ENV MIOPEN_FIND_DB_PATH=/tmp/miopen/find-db
ENV MIOPEN_USER_DB_PATH=/tmp/miopen/user-db
ENV LD_LIBRARY_PATH=$PREFIX/lib
# Setup ubsan environment to printstacktrace
ENV UBSAN_OPTIONS=print_stacktrace=1
ENV ASAN_OPTIONS=detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1
RUN ln -s /opt/rocm/llvm/bin/llvm-symbolizer /usr/bin/llvm-symbolizer
...@@ -261,11 +261,13 @@ auto compute_op(rank<1>, ...@@ -261,11 +261,13 @@ auto compute_op(rank<1>,
template <class T, class F> template <class T, class F>
argument compute_op(rank<0>, argument compute_op(rank<0>,
const T& x, const T& x,
const shape&, const shape& output,
const std::vector<argument>&, const std::vector<argument>& inputs,
const std::vector<module_ref>&, const std::vector<module_ref>& module_args,
F) F)
{ {
if(module_args.empty())
return compute_op(x, output, inputs);
std::string name = x.name(); std::string name = x.name();
MIGRAPHX_THROW("Not computable: " + name); MIGRAPHX_THROW("Not computable: " + name);
} }
......
...@@ -45,6 +45,8 @@ ...@@ -45,6 +45,8 @@
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
struct value;
#ifdef DOXYGEN #ifdef DOXYGEN
/// An interface for a compilation target /// An interface for a compilation target
...@@ -123,28 +125,41 @@ supported_segments target_find_supported(T&, const_module_ref, support_metric) ...@@ -123,28 +125,41 @@ supported_segments target_find_supported(T&, const_module_ref, support_metric)
} }
<% <%
interface('target', interface('target',
virtual('name', returns='std::string', const=True), virtual('name', returns = 'std::string', const = True),
virtual('get_passes', ctx='context&', options='const compile_options&', returns='std::vector<pass>', const=True), virtual('get_passes',
virtual('get_context', returns='context', const=True), ctx = 'context&',
virtual('find_supported', returns='supported_segments', mod='const_module_ref', m='support_metric', const=True, default='target_find_supported'), options = 'const compile_options&',
virtual('copy_to', returns = 'std::vector<pass>',
returns = 'argument', const = True),
input = 'const argument&', virtual('get_context', returns = 'context', const = True),
const = True, virtual('find_supported',
default = 'copy_to_target'), returns = 'supported_segments',
virtual('copy_from', mod = 'const_module_ref',
returns = 'argument', m = 'support_metric',
input = 'const argument&', const = True,
const = True, default = 'target_find_supported'),
default = 'copy_from_target'), virtual('copy_to',
virtual('allocate', s='const shape&', returns='argument', const=True, returns = 'argument',
default = 'target_allocate') input = 'const argument&',
) const = True,
%> default = 'copy_to_target'),
virtual('copy_from',
returns = 'argument',
input = 'const argument&',
const = True,
default = 'copy_from_target'),
virtual('allocate',
s = 'const shape&',
returns = 'argument',
const = True,
default = 'target_allocate')) %>
#endif #endif
void migraphx_to_value(value& v, const target& t);
void migraphx_from_value(const value& v, target& t);
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
......
...@@ -56,8 +56,9 @@ echo "Dependencies are installed at $PREFIX" ...@@ -56,8 +56,9 @@ echo "Dependencies are installed at $PREFIX"
# Install deps with rbuild # Install deps with rbuild
rbuild prepare -d $PREFIX -s develop rbuild prepare -d $PREFIX -s develop
# install onnx package for unit tests export CMAKE_ARGS="-DONNX_USE_PROTOBUF_SHARED_LIBS=ON"
pip3 install onnx==1.10.2 numpy==1.21.6 typing==3.7.4 pytest==6.0.1 packaging==23.0 pip3 install onnx==1.10.2 numpy==1.21.6 typing==3.7.4 pytest==6.0.1 packaging==23.0
# pin version of protobuf in Python for onnx runtime unit tests # pin version of protobuf in Python for onnx runtime unit tests between dist versions
pip3 install protobuf==3.20.0 pip3 install protobuf==3.20.0
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