Skip to content

Commit e30cf1f

Browse files
alvoronxczhai
authored andcommitted
[ARM] [WA] Reconfigure ACL Matmul on each inference
1 parent 7ebf75e commit e30cf1f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/cpu/acl/matmul/acl_matmul.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,14 @@ status_t acl_matmul_t::execute_forward(const exec_ctx_t &ctx) const {
4141
acl_matmul_obj_t &acl_obj = acl_resource->get_acl_obj();
4242

4343
const auto scratchpad = ctx.get_scratchpad_grantor();
44+
// [WA] ACL Matmul produces wrong results in case it is not reconfigured on each inference
45+
if (do_transC) {
46+
acl_obj.gemm.configure(&acl_obj.wei_tensor, &acl_obj.src_tensor,
47+
nullptr, &acl_obj.dst_acc_tensor, 1.0f, 0.0f, pd()->amp_.gemm_info);
48+
} else {
49+
acl_obj.gemm.configure(&acl_obj.src_tensor, &acl_obj.wei_tensor,
50+
nullptr, &acl_obj.dst_tensor, 1.0f, 0.0f, pd()->amp_.gemm_info);
51+
}
4452

4553
// Run transpose kernel
4654
if (is_transA && !is_transB) {

0 commit comments

Comments
 (0)