Skip to content
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

Merged
merged 3 commits into from
Aug 21, 2023

Conversation

stiepan
Copy link
Member

@stiepan stiepan commented Jul 27, 2023

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:

  • Existing tests apply
  • New tests added
    • Python tests
    • GTests
    • Benchmark
    • Other
  • N/A

Checklist

Documentation

  • Existing documentation applies
  • Documentation updated
    • Docstring
    • Doxygen
    • RST
    • Jupyter
    • Other
  • N/A

DALI team only

Requirements

  • Implements new requirements
  • Affects existing requirements
  • N/A

REQ IDs: N/A

JIRA TASK: N/A

@klecki klecki self-assigned this Jul 27, 2023
@stiepan stiepan marked this pull request as draft July 27, 2023 16:36
@stiepan stiepan changed the title Fix check_batch test utility. Make RandAugment test failure more verbose. Fix abs diff computation in check_batch test utility Jul 28, 2023
@stiepan
Copy link
Member Author

stiepan commented Jul 28, 2023

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [9150585]: BUILD STARTED

@stiepan
Copy link
Member Author

stiepan commented Jul 28, 2023

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [9153258]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [9153258]: BUILD FAILED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [9153258]: BUILD PASSED

@stiepan stiepan marked this pull request as ready for review August 7, 2023 10:40


def _check_absdiff():
for i in range(-128, 127):
Copy link
Member Author

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.

Copy link
Contributor

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?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -128,6 +129,51 @@ def get_gpu_num():
return len(out_list)


def _get_absdiff(left, right):

def make_signed(dtype):
Copy link
Contributor

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?

Copy link
Member Author

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):
Copy link
Contributor

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>
@stiepan
Copy link
Member Author

stiepan commented Aug 21, 2023

!build

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [9451724]: BUILD STARTED

@dali-automaton
Copy link
Collaborator

CI MESSAGE: [9451724]: BUILD PASSED

@stiepan stiepan merged commit caf257a into NVIDIA:main Aug 21, 2023
5 checks passed
JanuszL pushed a commit to JanuszL/DALI that referenced this pull request Oct 13, 2023
* Fix check_batch abs diff computation
* Add one-time sanity check
---------

Signed-off-by: Kamil Tokarski <ktokarski@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants