"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "412c298e3119c23829b3af127fb17fb2511ac0a3"
Commit 33423f8c authored by Paul's avatar Paul
Browse files

Tidy fixes

parent 390586c5
...@@ -23,7 +23,7 @@ struct mlir_conv ...@@ -23,7 +23,7 @@ struct mlir_conv
} }
std::string name() const { return "gpu::mlir_conv"; } std::string name() const { return "gpu::mlir_conv"; }
shape compute_shape(std::vector<shape> inputs, std::vector<module_ref> mods) const shape compute_shape(std::vector<shape> inputs, const std::vector<module_ref>& mods) const
{ {
check_shapes{inputs, *this}.standard(); check_shapes{inputs, *this}.standard();
if(mods.size() != 1) if(mods.size() != 1)
...@@ -47,12 +47,12 @@ struct find_conv_pointwise ...@@ -47,12 +47,12 @@ struct find_conv_pointwise
return match::name("pointwise")(match::any_of[match::inputs()](convolution.bind("x"))); return match::name("pointwise")(match::any_of[match::inputs()](convolution.bind("x")));
} }
void apply(module_pass_manager& mpm, match::matcher_result r) const void apply(module_pass_manager& mpm, const match::matcher_result& r) const
{ {
auto ins = r.result; auto ins = r.result;
auto conv_ins = r.instructions["convolution"]; auto conv_ins = r.instructions["convolution"];
auto x_ins = r.instructions["x"]; // input after contiguous auto x_ins = r.instructions["x"]; // input after contiguous
auto pm = ins->module_inputs().front(); auto *pm = ins->module_inputs().front();
auto names = pm->get_parameter_names(); auto names = pm->get_parameter_names();
// Whitelist pointwise operators // Whitelist pointwise operators
if(std::any_of(pm->begin(), pm->end(), [](const auto& i) { if(std::any_of(pm->begin(), pm->end(), [](const auto& i) {
......
...@@ -129,8 +129,8 @@ struct mlir_program ...@@ -129,8 +129,8 @@ struct mlir_program
location(mlirLocationUnknownGet(ctx.get())), location(mlirLocationUnknownGet(ctx.get())),
mmodule(mlirModuleCreateEmpty(location)) mmodule(mlirModuleCreateEmpty(location))
{ {
MlirDialectHandle mixrHandle = mlirGetDialectHandle__migraphx__(); MlirDialectHandle mixr_handle = mlirGetDialectHandle__migraphx__();
mlirDialectHandleRegisterDialect(mixrHandle, ctx.get()); mlirDialectHandleRegisterDialect(mixr_handle, ctx.get());
mlirRegisterAllDialects(ctx.get()); mlirRegisterAllDialects(ctx.get());
mlirContextSetAllowUnregisteredDialects(ctx.get(), true /*allow*/); mlirContextSetAllowUnregisteredDialects(ctx.get(), true /*allow*/);
} }
...@@ -487,7 +487,7 @@ struct mlir_program ...@@ -487,7 +487,7 @@ struct mlir_program
// 2nd pipeline to call // 2nd pipeline to call
std::string tname = get_device_name(); std::string tname = get_device_name();
// HACK: Since MLIR can't handle the full target name // HACK: Since MLIR can't handle the full target name
auto hacked_tname = tname.substr(0, tname.find(":")); auto hacked_tname = tname.substr(0, tname.find(':'));
if(tname.size() != hacked_tname.size()) if(tname.size() != hacked_tname.size())
std::cout std::cout
<< "*************** WARNING: MLIR may not compile the correct target features for: " << "*************** WARNING: MLIR may not compile the correct target features for: "
...@@ -502,7 +502,7 @@ struct mlir_program ...@@ -502,7 +502,7 @@ struct mlir_program
return op; return op;
} }
std::pair<std::size_t, std::size_t> get_launch_params() std::pair<std::size_t, std::size_t> get_launch_params() const
{ {
uint32_t attrs[2]; uint32_t attrs[2];
// returns block and grid sizes // returns block and grid sizes
...@@ -512,7 +512,7 @@ struct mlir_program ...@@ -512,7 +512,7 @@ struct mlir_program
return {global, local}; return {global, local};
} }
value::binary get_binary() value::binary get_binary() const
{ {
int size = 0; int size = 0;
mlirGetBinary(mmodule.get(), &size, nullptr); mlirGetBinary(mmodule.get(), &size, nullptr);
......
...@@ -29,19 +29,19 @@ struct mlir_gpu_target : migraphx::gpu::target ...@@ -29,19 +29,19 @@ struct mlir_gpu_target : migraphx::gpu::target
} }
}; };
std::string encode(std::string s) std::string encode(const std::string& s)
{ {
std::stringstream ss; std::stringstream ss;
bool prespace = false; bool prespace = false;
for(auto c : s) for(auto c : s)
{ {
if(std::isspace(c)) if(std::isspace(c) != 0)
{ {
if(not prespace) if(not prespace)
ss << " "; ss << " ";
prespace = true; prespace = true;
} }
else if(std::isprint(c)) else if(std::isprint(c) != 0)
{ {
ss << c; ss << c;
prespace = false; prespace = false;
......
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