Skip to content

Commit

Permalink
[SYCLomatic] Refine help function async_reduction #309
Browse files Browse the repository at this point in the history
Signed-off-by: Wang, Hao3 <[email protected]>
  • Loading branch information
intwanghao authored Oct 21, 2022
1 parent 063bc30 commit c093888
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions clang/runtime/dpct-rt/include/dnnl_utils.hpp.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2965,10 +2965,13 @@ sycl::event engine_ext::async_reduction(reduction_op op, float alpha,
auto execution_args = new std::unordered_map<int, ::dnnl::memory>{
{DNNL_ARG_SRC, ::dnnl::memory(src_desc.get_desc(), _eng, src)}};

auto e =
execute_primitive(primitive, execution_args,
{{alpha, beta, DNNL_ARG_DST, dst_desc, dst}}, {cache});
return e;
if (cache) {
return execute_primitive(primitive, execution_args,
{{alpha, beta, DNNL_ARG_DST, dst_desc, dst}},
{cache});
}
return execute_primitive(primitive, execution_args,
{{alpha, beta, DNNL_ARG_DST, dst_desc, dst}});
}
// DPCT_LABEL_END

Expand Down
11 changes: 7 additions & 4 deletions clang/test/dpct/helper_files_ref/include/dnnl_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2624,10 +2624,13 @@ sycl::event engine_ext::async_reduction(reduction_op op, float alpha,
auto execution_args = new std::unordered_map<int, ::dnnl::memory>{
{DNNL_ARG_SRC, ::dnnl::memory(src_desc.get_desc(), _eng, src)}};

auto e =
execute_primitive(primitive, execution_args,
{{alpha, beta, DNNL_ARG_DST, dst_desc, dst}}, {cache});
return e;
if (cache) {
return execute_primitive(primitive, execution_args,
{{alpha, beta, DNNL_ARG_DST, dst_desc, dst}},
{cache});
}
return execute_primitive(primitive, execution_args,
{{alpha, beta, DNNL_ARG_DST, dst_desc, dst}});
}

sycl::event engine_ext::async_activation_forward(activation_desc &desc, float alpha,
Expand Down

0 comments on commit c093888

Please sign in to comment.