Commit 33423f8c authored by Paul's avatar Paul
Browse files

Tidy fixes

parent 390586c5
......@@ -23,7 +23,7 @@ struct 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();
if(mods.size() != 1)
......@@ -47,12 +47,12 @@ struct find_conv_pointwise
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 conv_ins = r.instructions["convolution"];
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();
// Whitelist pointwise operators
if(std::any_of(pm->begin(), pm->end(), [](const auto& i) {
......
......@@ -129,8 +129,8 @@ struct mlir_program
location(mlirLocationUnknownGet(ctx.get())),
mmodule(mlirModuleCreateEmpty(location))
{
MlirDialectHandle mixrHandle = mlirGetDialectHandle__migraphx__();
mlirDialectHandleRegisterDialect(mixrHandle, ctx.get());
MlirDialectHandle mixr_handle = mlirGetDialectHandle__migraphx__();
mlirDialectHandleRegisterDialect(mixr_handle, ctx.get());
mlirRegisterAllDialects(ctx.get());
mlirContextSetAllowUnregisteredDialects(ctx.get(), true /*allow*/);
}
......@@ -487,7 +487,7 @@ 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(":"));
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: "
......@@ -502,7 +502,7 @@ struct mlir_program
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];
// returns block and grid sizes
......@@ -512,7 +512,7 @@ struct mlir_program
return {global, local};
}
value::binary get_binary()
value::binary get_binary() const
{
int size = 0;
mlirGetBinary(mmodule.get(), &size, nullptr);
......
......@@ -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;
bool prespace = false;
for(auto c : s)
{
if(std::isspace(c))
if(std::isspace(c) != 0)
{
if(not prespace)
ss << " ";
prespace = true;
}
else if(std::isprint(c))
else if(std::isprint(c) != 0)
{
ss << c;
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