Commit cfbd91a9 authored by Paul's avatar Paul
Browse files

Format

parent c37b1636
...@@ -465,7 +465,7 @@ struct mlir_program ...@@ -465,7 +465,7 @@ struct mlir_program
ops.add_attribute_value(get_operator_value(ins->get_operator())); ops.add_attribute_value(get_operator_value(ins->get_operator()));
if(ins->name() != "@return") if(ins->name() != "@return")
ops.add_results({get_shape(ins)}); ops.add_results({get_shape(ins)});
if (ins->name()) if(ins->name())
pp = {ins->get_operator(), ins->inputs(), ins->get_shape()}; pp = {ins->get_operator(), ins->inputs(), ins->get_shape()};
std::vector<MlirValue> inputs; std::vector<MlirValue> inputs;
...@@ -525,10 +525,7 @@ struct mlir_program ...@@ -525,10 +525,7 @@ struct mlir_program
MIGRAPHX_THROW("Failed to compile mlir program"); MIGRAPHX_THROW("Failed to compile mlir program");
} }
std::string get_tune_params() std::string get_tune_params() { return get_mlir_perf_for_conv(pp); }
{
return get_mlir_perf_for_conv(pp);
}
mlir_context ctx; mlir_context ctx;
MlirLocation location; MlirLocation location;
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include <migraphx/stringutils.hpp> #include <migraphx/stringutils.hpp>
#include <migraphx/permutation.hpp> #include <migraphx/permutation.hpp>
namespace migraphx { namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS { inline namespace MIGRAPHX_INLINE_NS {
namespace gpu { namespace gpu {
...@@ -39,7 +38,7 @@ std::string get_type(const shape& s) ...@@ -39,7 +38,7 @@ std::string get_type(const shape& s)
{shape::int32_type, "INT32"}, {shape::int32_type, "INT32"},
}; };
auto it = m.find(s.type()); auto it = m.find(s.type());
if (it == m.end()) if(it == m.end())
return "UNKNOWN"; return "UNKNOWN";
return it->second; return it->second;
} }
...@@ -53,37 +52,36 @@ std::string generate_miopen_config(const problem_params& pp) ...@@ -53,37 +52,36 @@ std::string generate_miopen_config(const problem_params& pp)
auto padding = v["padding"].to_vector<std::size_t>(); auto padding = v["padding"].to_vector<std::size_t>();
auto stride = v["stride"].to_vector<std::size_t>(); auto stride = v["stride"].to_vector<std::size_t>();
auto dilation = v["dilation"].to_vector<std::size_t>(); auto dilation = v["dilation"].to_vector<std::size_t>();
if (padding.size() != stride.size()) if(padding.size() != stride.size())
padding.erase(padding.begin()+padding.size()/2, padding.end()); padding.erase(padding.begin() + padding.size() / 2, padding.end());
return to_string_range({ return to_string_range({to_string(input[1]),
to_string(input[1]), to_string_range(input.begin() + 2, input.end(), "x"),
to_string_range(input.begin()+2, input.end(), "x"), to_string_range(weights.begin() + 2, weights.end(), "x"),
to_string_range(weights.begin()+2, weights.end(), "x"),
to_string(weights[0]), to_string(weights[0]),
to_string_range(output.begin()+2, output.end(), "x"), to_string_range(output.begin() + 2, output.end(), "x"),
to_string(input[0]), to_string(input[0]),
to_string_range(padding.begin()+2, padding.end(), "x"), to_string_range(padding.begin() + 2, padding.end(), "x"),
to_string_range(stride.begin()+2, stride.end(), "x"), to_string_range(stride.begin() + 2, stride.end(), "x"),
to_string_range(dilation.begin()+2, dilation.end(), "x"), to_string_range(dilation.begin() + 2, dilation.end(), "x"),
std::string{"0"}, std::string{"0"},
get_layout(pp.inputs[0], "NCHW"), get_layout(pp.inputs[0], "NCHW"),
get_layout(pp.inputs[1], "NCHW"), get_layout(pp.inputs[1], "NCHW"),
get_layout(pp.output, "NCHW"), get_layout(pp.output, "NCHW"),
get_type(pp.inputs[0]), get_type(pp.inputs[0]),
std::string{"F"} std::string{"F"}},
}, "-"); "-");
} }
} } // namespace
std::string get_mlir_perf_for_conv(const problem_params& pp) std::string get_mlir_perf_for_conv(const problem_params& pp)
{ {
const auto dbpath = fs::path{"opt"}/"rocm"/"share"/"miopen"/"db"/"miopen.db"; const auto dbpath = fs::path{"opt"} / "rocm" / "share" / "miopen" / "db" / "miopen.db";
auto db = sqlite::read(dbpath); auto db = sqlite::read(dbpath);
std::string query = "select * from perf_db where config=${config}"; std::string query = "select * from perf_db where config=${config}";
auto results = db.execute(interpolate_string(query, {{"config", generate_miopen_config(pp)}})); auto results = db.execute(interpolate_string(query, {{"config", generate_miopen_config(pp)}}));
if (results.empty()) if(results.empty())
return ""; return "";
return results.front().at("params"); return results.front().at("params");
} }
...@@ -91,4 +89,3 @@ std::string get_mlir_perf_for_conv(const problem_params& pp) ...@@ -91,4 +89,3 @@ std::string get_mlir_perf_for_conv(const problem_params& pp)
} // namespace gpu } // namespace gpu
} // namespace MIGRAPHX_INLINE_NS } // namespace MIGRAPHX_INLINE_NS
} // namespace migraphx } // namespace migraphx
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