-
Notifications
You must be signed in to change notification settings - Fork 609
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
Fix abs diff computation in check_batch test utility #4957
Conversation
e4c30b8
to
77cad6e
Compare
!build |
CI MESSAGE: [9150585]: BUILD STARTED |
!build |
CI MESSAGE: [9153258]: BUILD STARTED |
CI MESSAGE: [9153258]: BUILD FAILED |
CI MESSAGE: [9153258]: BUILD PASSED |
|
||
|
||
def _check_absdiff(): | ||
for i in range(-128, 127): |
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.
In principle, overflow on signed int is UB (that we rely on anyway without this PR). The following one-time check aims to verify it works as expected.
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.
Maybe we should explain it in a comment in the code rather than in the PR?
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.
done
dali/test/python/test_utils.py
Outdated
@@ -128,6 +129,51 @@ def get_gpu_num(): | |||
return len(out_list) | |||
|
|||
|
|||
def _get_absdiff(left, right): | |||
|
|||
def make_signed(dtype): |
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.
Isn't it make_unsigned?
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 it is.:)
|
||
|
||
def _check_absdiff(): | ||
for i in range(-128, 127): |
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.
Maybe we should explain it in a comment in the code rather than in the PR?
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
d652935
to
ce41e78
Compare
!build |
CI MESSAGE: [9451724]: BUILD STARTED |
CI MESSAGE: [9451724]: BUILD PASSED |
* Fix check_batch abs diff computation * Add one-time sanity check --------- Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Category:
Other (e.g. Documentation, Tests, Configuration)
Description:
The
check_batch
utility reports wrong abs differences for unsigned types if the actual difference is bigger than the half of the range of the type. (Take uint8 and 1 vs 254 - the abs diff is 253 while the chekc_batch would report 3).Additional information:
Affected modules and functionalities:
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A