"cacheflow/model_executor/model_loader.py" did not exist on "e548c1488ae1e93b5ca60359f4b292d2bee0b60d"
Commit 79ffac9f authored by Paul's avatar Paul
Browse files

Format

parent b7f31df5
......@@ -486,11 +486,12 @@ struct mlir_program
// 2nd pipeline to call
std::string tname = get_device_name();
// HACK: Since MLIR can't handle the full target name
auto hacked_tname = tname.substr(0, tname.find(":"));
if (tname.size() != hacked_tname.size())
std::cout << "*************** WARNING: MLIR may not compile the correct target features for: " << tname << std::endl;
mlirMIGraphXAddBackendPipeline(
pm.get(), hacked_tname.c_str(), "amdgcn-amd-amdhsa", "");
auto hacked_tname = tname.substr(0, tname.find(":"));
if(tname.size() != hacked_tname.size())
std::cout
<< "*************** WARNING: MLIR may not compile the correct target features for: "
<< tname << std::endl;
mlirMIGraphXAddBackendPipeline(pm.get(), hacked_tname.c_str(), "amdgcn-amd-amdhsa", "");
mlirPassManagerRun(pm.get(), mmodule.get());
code_object_op op;
......@@ -537,12 +538,12 @@ std::string dump_mlir(const module& m)
code_object_op compile_mlir(const module& m)
{
const bool trace = enabled(MIGRAPHX_TRACE_MLIR{});
if (trace)
if(trace)
std::cout << m << std::endl;
mlir_program mp;
mp.parse(m);
auto mod_op = mlirModuleGetOperation(mp.mmodule.get());
if (trace)
if(trace)
std::cout << mlir_print(&mlirOperationPrint, mod_op) << std::endl;
return mp.compile();
}
......
......@@ -21,12 +21,11 @@ using migraphx::trim;
struct mlir_gpu_target : migraphx::gpu::target
{
std::string name() const { return "mlir"; }
std::vector<migraphx::pass> get_passes(migraphx::context& gctx, const migraphx::compile_options&) const
std::vector<migraphx::pass> get_passes(migraphx::context& gctx,
const migraphx::compile_options&) const
{
auto& ctx = migraphx::any_cast<migraphx::gpu::context>(gctx);
return {
migraphx::gpu::write_literals{&ctx}
};
return {migraphx::gpu::write_literals{&ctx}};
}
};
......@@ -60,7 +59,9 @@ migraphx::program create_program_from_mlir(const migraphx::module& mmlir)
std::transform(names.begin(), names.end(), std::back_inserter(inputs), [&](const auto& name) {
return mm->add_parameter(name, mmlir.get_parameter_shape(name));
});
std::sort(inputs.begin(), inputs.end(), migraphx::by(std::less<>{}, [](auto ins) { return to_string(ins->get_operator()); }));
std::sort(inputs.begin(), inputs.end(), migraphx::by(std::less<>{}, [](auto ins) {
return to_string(ins->get_operator());
}));
inputs.push_back(mm->add_parameter("output", mmlir.get_output_shapes().front()));
migraphx::gpu::insert_mlir(*mm, mm->end(), mmlir, inputs);
......
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