Commit eff3d2d3 authored by turneram's avatar turneram
Browse files

Add contiguous before reshape

parent cd96c1c8
...@@ -100,11 +100,12 @@ struct parse_attention : op_parser<parse_attention> ...@@ -100,11 +100,12 @@ struct parse_attention : op_parser<parse_attention>
auto gemm4 = info.add_instruction(migraphx::make_op("dot"), softmax, v_t); auto gemm4 = info.add_instruction(migraphx::make_op("dot"), softmax, v_t);
// result is BxNxSxH, transpose to BxSxNxH and reshape to BxSxHiddenSize // result is BxNxSxH, transpose to BxSxNxH and reshape to BxSxHiddenSize
// transposeCtx
gemm4 = info.add_instruction( gemm4 = info.add_instruction(
migraphx::make_op("transpose", {{"permutation", {0, 2, 1, 3}}}), gemm4); migraphx::make_op("transpose", {{"permutation", {0, 2, 1, 3}}}), gemm4);
return info.add_instruction( return info.add_instruction(
make_op("reshape", {{"dims", {batch_size, sequence_length, num_heads * head_size}}}), make_op("reshape", {{"dims", {batch_size, sequence_length, num_heads * head_size}}}),
gemm4); info.make_contiguous(gemm4));
} }
}; };
......
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