Skip to content

[Outdated, see #13790][CPU] StackAllocator for JIT kernels#13132

Closed
lohika-denis-kotov wants to merge 20 commits into
openvinotoolkit:masterfrom
lohika-denis-kotov:feature/stack_allocator
Closed

[Outdated, see #13790][CPU] StackAllocator for JIT kernels#13132
lohika-denis-kotov wants to merge 20 commits into
openvinotoolkit:masterfrom
lohika-denis-kotov:feature/stack_allocator

Conversation

@lohika-denis-kotov
Copy link
Copy Markdown
Contributor

@lohika-denis-kotov lohika-denis-kotov commented Sep 20, 2022

Description

StackAllocator that helps to allocate memory on stack with some automatic deallocation

Edit by @lohika-vmostovy :
I've created a new PR #13790 because I can't modify this one in order to address comments. Please, leave new comments in a new PR.

@lohika-denis-kotov lohika-denis-kotov requested review from a team as code owners September 20, 2022 17:17
@lohika-denis-kotov lohika-denis-kotov changed the base branch from feature/stack_allocator to master September 20, 2022 17:17
@lohika-denis-kotov
Copy link
Copy Markdown
Contributor Author

@ceciliapeng2011 @maxnick @nshchego Please, review this PR

Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp
Comment thread src/plugins/intel_cpu/tests/unit/nodes/kernels/stack_allocator.cpp Outdated

StackAllocator(x64::jit_generator& code_gen,
const Xbyak::Reg& bp,
const size_t alignment)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When do we need the stack aligned > 1?

Copy link
Copy Markdown
Contributor Author

@lohika-denis-kotov lohika-denis-kotov Oct 8, 2022

Choose a reason for hiding this comment

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

Yes, for example most of sse4.1 commands requires address to be aligned

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@ceciliapeng2011 Do you have some questions related to alignment ?
If no, please resolve conversation

Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp Outdated
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp Outdated
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp Outdated
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp Outdated
@lohika-denis-kotov lohika-denis-kotov force-pushed the feature/stack_allocator branch 2 times, most recently from 6e38ad5 to 8fd8b0b Compare October 13, 2022 09:25
@lohika-denis-kotov
Copy link
Copy Markdown
Contributor Author

@maxnick @dmitry-gorokhov @ceciliapeng2011 @nshchego Could you review this PR ?
This PR is a request for #12991

Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp Outdated
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp Outdated
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp Outdated
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp Outdated
@lohika-denis-kotov lohika-denis-kotov force-pushed the feature/stack_allocator branch 3 times, most recently from 4f56dea to 670934d Compare November 2, 2022 10:33
Copy link
Copy Markdown
Contributor

@maxnick maxnick left a comment

Choose a reason for hiding this comment

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

In general LGTM, we need to resolve a few comment regarding namespace usage and class names.

Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp
Comment thread src/plugins/intel_cpu/src/nodes/kernels/stack_allocator.hpp
namespace intel_cpu {

using namespace dnnl::impl::cpu;
namespace x64 = dnnl::impl::cpu::x64;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As far as I can see only x64::cpu_isa_t is used. M.b. it does make sense to use an alias for this type on the RegistersPool level:

class RegistersPool {
public:
    using cpu_isa_t = dnnl::impl::cpu::x64::cpu_isa_t;

So, within this header it can be accessed just as follows RegistersPool::cpu_isa_t
What do you think?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We also have other references to x64 namespace in this header like x64::cpu_isa_traits and cpu_isa_t enum members.

Copy link
Copy Markdown
Contributor

@maxnick maxnick Nov 2, 2022

Choose a reason for hiding this comment

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

Do not see an elegant solution here, since the whole class is intended to be used with dnnl::impl::cpu::x64::cpu_isa_t members, and we do not have a possibility to import enumeration to the class (it has been introduced in c++20). I guess we should think about wrapping some dnnl entities on jit_base level.

@lohika-vmostovy lohika-vmostovy changed the title [CPU] StackAllocator for JIT kernels [Outdated, see #13790][CPU] StackAllocator for JIT kernels Nov 2, 2022
@dmitry-gorokhov
Copy link
Copy Markdown

Closed as outdated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: CPU OpenVINO CPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants