-
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
[NPU] Use zero tensor to get correct data #27980
base: master
Are you sure you want to change the base?
Conversation
c718ff5
to
b1afd2c
Compare
b1afd2c
to
03a4df5
Compare
6f77e4d
to
a14a25b
Compare
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.
Halfway through, nothing major so far.
src/plugins/intel_npu/src/backend/include/zero_infer_request.hpp
Outdated
Show resolved
Hide resolved
src/plugins/intel_npu/src/common/include/intel_npu/common/sync_infer_request.hpp
Outdated
Show resolved
Hide resolved
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.
@MirceaDan99 Please let us know if you have anything before merging this.
continue; | ||
} | ||
|
||
if (std::dynamic_pointer_cast<ZeroRemoteTensor>(levelZeroTensor.at(SINGLE_TENSOR)) != nullptr) { |
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.
Since these three if
s share the same body, you may consider writing them in a more compact manner. That is: if (condition1 || condition2 || condition3) then common_body
.
I've also noticed you're using std::dynamic_pointer_cast<ZeroRemoteTensor>
quite often for determining whether the tensor is remote or not. You may consider creating a static method inside ZeroRemoteTensor
, perhaps called is_remote_tensor
, which does this check.
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.
Not sure about the second part of the comment. We still need to do the cast, correct? Since it is an ITensor as default. Can I call methods from the derivate class in this case?
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.
Was thinking you could do something like:
class ZeroRemoteTensor {
public:
static bool is_remote_tensor(const std::shared_ptr<ov::ITensor>& tensor) {
return std::dynamic_pointer_cast<ZeroRemoteTensor>(tensor) != nullptr;
}
};
And call it like: ZeroRemoteTensor::is_remote_tensor(tensor)
. So I guess in this case you would just place the helper function inside the ZeroRemoteTensor
"namespace" practically. Not sure if this is the best approach or the best place for the helper function, the suggestion is mainly about defining a helper for this wherever you think it belongs best.
} | ||
|
||
const auto inputDescriptor = _metadata.inputs.at(inputIndex); | ||
if (inputDescriptor.isShapeTensor || inputDescriptor.isStateInput) { |
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.
We sure we should skip state tensors? Just asking if you've considered this case hard enough, I haven't checked this yet. The tensor can be retrieved via SyncInferRequest::query_state
-> get_state
.
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.
Not sure yet how this is supposed to work with state tensors.
f505588
to
1b6d092
Compare
1b6d092
to
71035d6
Compare
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
Signed-off-by: Bogdan Pereanu <[email protected]>
71035d6
to
ae58e16
Compare
Signed-off-by: Bogdan Pereanu <[email protected]>
ae58e16
to
bd6c07b
Compare
Details:
Tickets: