-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[CPU]fix offset in store emitter issue #26083
[CPU]fix offset in store emitter issue #26083
Conversation
Please help change to fix the bug. Thanks! |
@a-sidorova , for store emitter, the offset of dst gpr is passed with input vec reg. This seems like confusing and not friendly to use, could error prone, such as this change:#22816. We moved the offset as part of dst gpr. Could you please taka a look? Thanks! |
@@ -676,7 +676,7 @@ void jit_store_emitter::emit_data() const { | |||
} | |||
|
|||
void jit_store_emitter::emit_impl(const std::vector<size_t> &in_idxs, const std::vector<size_t> &out_idxs) const { | |||
const int offset = in_idxs.size() == 2 ? in_idxs[1] : 0; | |||
const int offset = out_idxs.size() == 2 ? out_idxs[1] : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you please also add a description regarding offset for store and load emitter?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Otherwise this is sacred knowledge which is known by a few developers
As I remember, the purpose of using @dmitry-gorokhov could you please share your opinion about moving of passing |
There are no strict requirements on emitters arguments placement. So we can adjust in any way if the solution considered msot convinient. The point about offset as input parameter is correct, but seems it correponds to another level of abstraction: execution graph. In the graph Store operation may obtain offset as an input if this is simplier way to express pointer arithmetic. On the other hand Emitter is an abstraction over ISA which might be used in different contexts, not only inside Snippets. |
@@ -136,7 +136,7 @@ struct jit_move_scale_kernel : public jit_uni_move_scale_kernel, public jit_gene | |||
emitters[seed].reset(new jit_store_emitter(this, isa, src_prc, dst_prc, elt_num)); | |||
} | |||
|
|||
emitters[seed]->emit_code({static_cast<size_t>(vmm_src.getIdx()), 0}, {static_cast<size_t>(reg_dst.getIdx())}, | |||
emitters[seed]->emit_code({static_cast<size_t>(vmm_src.getIdx())}, {static_cast<size_t>(reg_dst.getIdx()), 0}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: offset = 0
is set by default in jit_store_emitter::emit_impl()
so we don't need to manually pass zero everywhere
@@ -676,7 +676,7 @@ void jit_store_emitter::emit_data() const { | |||
} | |||
|
|||
void jit_store_emitter::emit_impl(const std::vector<size_t> &in_idxs, const std::vector<size_t> &out_idxs) const { | |||
const int offset = in_idxs.size() == 2 ? in_idxs[1] : 0; | |||
const int offset = out_idxs.size() == 2 ? out_idxs[1] : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. Otherwise this is sacred knowledge which is known by a few developers
Signed-off-by: HU Yuan2 <[email protected]>
Signed-off-by: HU Yuan2 <[email protected]>
Signed-off-by: HU Yuan2 <[email protected]>
Signed-off-by: HU Yuan2 <[email protected]>
Signed-off-by: HU Yuan2 <[email protected]>
Signed-off-by: HU Yuan2 <[email protected]>
450cdfb
to
90c460c
Compare
@@ -676,7 +677,8 @@ void jit_store_emitter::emit_data() const { | |||
} | |||
|
|||
void jit_store_emitter::emit_impl(const std::vector<size_t> &in_idxs, const std::vector<size_t> &out_idxs) const { | |||
const int offset = in_idxs.size() == 2 ? in_idxs[1] : 0; | |||
// offset in store emitter is the offset of dst gpr register, should be parsed from out_ids. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: The best place for this comment in the corresponding header file before class definitions 😃 Another developer will take a look at interface and won't find the description for offset
. And only after searching in files, he will find this comment.
Signed-off-by: HU Yuan2 <[email protected]>
Details:
Tickets: