Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graph: backend: dnnl: fix the null pointer issue and remove unused code #2504

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/graph/backend/dnnl/kernels/sdp_primitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,6 @@ void sdp_primitive_kernel_t<quantized>::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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you explain why remove these code?
Do we need to check if scratchpad is needed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sdp_primitive doesn't need scratchpad memory, so we set the scratchpad memory size is 0 in L227. So we don't need to set the data handle for the internal memory.

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 <bool quantized>
Expand Down
5 changes: 3 additions & 2 deletions src/graph/backend/dnnl/scratchpad.hpp
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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:
Expand Down
Loading