Commit 36154263 authored by Paul's avatar Paul
Browse files

Format

parent af0d45a5
......@@ -149,8 +149,8 @@ struct find_ck_gemm_pointwise_int8
// Find a gemm followed by a pointwise operation.
auto matcher() const
{
auto gemm =
match::skip(match::name("contiguous"))(match::name("quant_dot")(is_ck_gemm().bind("gemm")));
auto gemm = match::skip(match::name("contiguous"))(
match::name("quant_dot")(is_ck_gemm().bind("gemm")));
return match::name("pointwise")(match::any_of[match::inputs()](gemm.bind("x")));
}
......@@ -162,7 +162,7 @@ struct find_ck_gemm_pointwise_int8
auto next_ins = std::next(ins);
auto* pm = ins->module_inputs().front();
auto names = pm->get_parameter_names();
std::sort(names.begin(), names.end());
auto inputs = ins->inputs();
auto gemm_it = std::find(inputs.begin(), inputs.end(), x_ins);
......
......@@ -229,7 +229,10 @@ struct ck_gemm_compiler : compiler<ck_gemm_compiler>
s = shape{s.type(), {m1, m2}};
}
std::vector<std::string> names() const { return {"ck_gemm", "gpu::ck_gemm", "ck_gemm_int8", "gpu::ck_gemm_int8"}; }
std::vector<std::string> names() const
{
return {"ck_gemm", "gpu::ck_gemm", "ck_gemm_int8", "gpu::ck_gemm_int8"};
}
operation compile_op(context& /* ctx */, const std::vector<shape>& inputs, const value& v) const
{
......@@ -272,24 +275,21 @@ struct ck_gemm_compiler : compiler<ck_gemm_compiler>
{
cde_op = v.at("post").to<std::string>();
}
auto problem = ck::host::device_gemm_multiple_d::Problem{
m,
n,
k,
transA,
transB,
transE,
ds_layout,
a_type,
b_type,
e_type,
ds_type,
ck_passthrough,
ck_passthrough,
cde_op};
auto problem = ck::host::device_gemm_multiple_d::Problem{m,
n,
k,
transA,
transB,
transE,
ds_layout,
a_type,
b_type,
e_type,
ds_type,
ck_passthrough,
ck_passthrough,
cde_op};
const auto include_header = problem.GetIncludeHeader();
const auto ck_headers = ck::host::GetHeaders();
......@@ -345,14 +345,17 @@ struct ck_gemm_compiler : compiler<ck_gemm_compiler>
}
auto shapes = to_shapes(ins->inputs());
return {compile_op(ctx, shapes, v), [=](module& m, instruction_ref ins2, const operation& code_object) {
if(enabled(MIGRAPHX_LOG_CK_GEMM{}))
{
std::vector<shape> gemm_shapes{shapes[0], shapes[1], shapes.back().with_type(shapes[0].type())};
std::cout << "ck_gemm: " << to_json_string(to_value(gemm_shapes)) << std::endl;
}
m.replace_instruction(ins2, code_object, ins2->inputs());
}};
return {compile_op(ctx, shapes, v),
[=](module& m, instruction_ref ins2, const operation& code_object) {
if(enabled(MIGRAPHX_LOG_CK_GEMM{}))
{
std::vector<shape> gemm_shapes{
shapes[0], shapes[1], shapes.back().with_type(shapes[0].type())};
std::cout << "ck_gemm: " << to_json_string(to_value(gemm_shapes))
<< std::endl;
}
m.replace_instruction(ins2, code_object, ins2->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