[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.
Can inp be negative?
There was a problem hiding this comment.
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.
Yes, you are right.
manupak
left a comment
There was a problem hiding this comment.
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... |
lhutton1
left a comment
There was a problem hiding this comment.
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