-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[microNPU] Add support for unary elementwise CLZ #9577
Conversation
def clz_imp(inp): | ||
# Assuming that it's a 32 bit int | ||
return 32 - te.log2(inp) |
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.
Can inp
be negative?
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.
Yes, the inp
can be negative, but for the operators we turn into extern_calls
the actual correctness of the compute expression doesn't really matter since we will pass to the NPU the parameters of the operation, but no specifics about the actual compute. That's probably why a "close enough" operation is used here...
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.
Yes, you are right.
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.
LGTM modulo the existing comments.
I think to avoid the rebasing overhead -- we could address the comments in a follow up.
oh bummer, it already have a conflict. |
It's a very simple rebasing fix, but considering the CI is broken now, there probably isn't much point in updating the PR before it is up again... |
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.
LGTM
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.
Just curious why tolerance of 1 is used? Otherwise LGTM!
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Change-Id: I4f4189c2b5f864117b85dbd31fd67ae1680dc13a
Ah well spotted, there is not reason to use tolerance one (I'd be quite worried if NPU couldn't count zeros accurately 😅 ). Removed it! |
Thanks @ekalda @lhutton1 @NicolaLancellotti ! Great work! |
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Add support for the CLZ (count leading zeros) operator and the codegen test. Co-authored-by: Rishabh Jain <rishabh.jain2@arm.com>
Add support for the CLZ (count leading zeros) operator
and the codegen test.
Co-authored-by: Rishabh Jain rishabh.jain2@arm.com