Skip to content

Commit

Permalink
gpu: intel: ocl: gemm: fix new memory_t usage issue
Browse files Browse the repository at this point in the history
  • Loading branch information
spalicki committed Sep 26, 2024
1 parent 930c8f1 commit c4b2695
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/gpu/intel/ocl/gemm/conv_gemm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,22 +189,23 @@ struct conv_gemm_t : public gpu_gemm_t {
status_t execute(const gemm_exec_ctx_t &ctx) const override {
exec_args_t args;
std::unique_ptr<memory_t, memory_deleter_t> a;
CHECK(safe_ptr_assign(
a = new memory_t(ctx.stream()->engine(),
pd()->conv_pd->src_md(0), ctx.args().a->clone())));
CHECK(safe_ptr_assign(a,
new memory_t(ctx.stream()->engine(), pd()->conv_pd->src_md(0),
ctx.args().a->clone())));
std::unique_ptr<memory_t, memory_deleter_t> b;
CHECK(safe_ptr_assign(
b = new memory_t(ctx.stream()->engine(),
pd()->conv_pd->src_md(1), ctx.args().b->clone())));
CHECK(safe_ptr_assign(b,
new memory_t(ctx.stream()->engine(), pd()->conv_pd->src_md(1),
ctx.args().b->clone())));
std::unique_ptr<memory_t, memory_deleter_t> c;
CHECK(safe_ptr_assign(
c = new memory_t(ctx.stream()->engine(),
pd()->conv_pd->dst_md(), ctx.args().c->clone())));
CHECK(safe_ptr_assign(c,
new memory_t(ctx.stream()->engine(), pd()->conv_pd->dst_md(),
ctx.args().c->clone())));

std::unique_ptr<memory_t, memory_deleter_t> bias = [&] {
if (ctx.args().bias) {
return utils::make_unique<memory_t>(ctx.stream()->engine(),
pd()->conv_pd->src_md(2), ctx.args().bias->clone());
return std::unique_ptr<memory_t, memory_deleter_t>(new memory_t(
ctx.stream()->engine(), pd()->conv_pd->src_md(2),
ctx.args().bias->clone()));
} else {
return std::unique_ptr<memory_t, memory_deleter_t>();
}
Expand Down

0 comments on commit c4b2695

Please sign in to comment.