From 068dedae583f7aff409b25c3e1ce843ac018812a Mon Sep 17 00:00:00 2001 From: "Gu, Yonghao" Date: Fri, 24 Jan 2025 10:25:52 +0000 Subject: [PATCH] graph: backend: dnnl: fix the null pointer issue and remove unused code --- src/graph/backend/dnnl/kernels/sdp_primitive.cpp | 7 ------- src/graph/backend/dnnl/scratchpad.hpp | 5 +++-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/src/graph/backend/dnnl/kernels/sdp_primitive.cpp b/src/graph/backend/dnnl/kernels/sdp_primitive.cpp index 2b5c08f523e..b7729c5b80e 100644 --- a/src/graph/backend/dnnl/kernels/sdp_primitive.cpp +++ b/src/graph/backend/dnnl/kernels/sdp_primitive.cpp @@ -142,13 +142,6 @@ void sdp_primitive_kernel_t::prepare_args_set( mem_idx.first.set_data_handle( outputs[mem_idx.second].get_data_handle()); } - - grantor_t var_grantor = memory_planner_.internal_temporary_grantor( - scratchpad.get_buffer()); - - for (auto &mem_offkey : res->get_mems_use_internal_temporary()) { - mem_offkey.first.set_data_handle(var_grantor.get(mem_offkey.second)); - } } template diff --git a/src/graph/backend/dnnl/scratchpad.hpp b/src/graph/backend/dnnl/scratchpad.hpp index a1e0312d90e..9d41fab4ecf 100644 --- a/src/graph/backend/dnnl/scratchpad.hpp +++ b/src/graph/backend/dnnl/scratchpad.hpp @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright 2021-2024 Intel Corporation + * Copyright 2021-2025 Intel Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -215,7 +215,8 @@ class grantor_t { } char *get(const registry_t::key_t &key) const { - return aligned_base_ptr_ + registry_.get(key); + return aligned_base_ptr_ ? (aligned_base_ptr_ + registry_.get(key)) + : nullptr; } private: