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

Add tests for ResourceUtilizationCalculator #1341

Merged
merged 5 commits into from
Jan 27, 2025
Merged

Add tests for ResourceUtilizationCalculator #1341

merged 5 commits into from
Jan 27, 2025

Conversation

irenaby
Copy link
Collaborator

@irenaby irenaby commented Jan 26, 2025

Pull Request Description:

Add unit tests for Resource Utilization Calculator.
Minor updates, mostly validations and errors.

Checklist before requesting a review:

  • I set the appropriate labels on the pull request.
  • I have added/updated the release note draft (if necessary).
  • I have updated the documentation to reflect my changes (if necessary).
  • All function and files are well documented.
  • All function and classes have type hints.
  • There is a licenses in all file.
  • The function and variable names are informative.
  • I have checked for code duplications.
  • I have added new unittest (if necessary).

@irenaby irenaby requested a review from elad-c January 26, 2025 12:19
@irenaby irenaby force-pushed the ru_refactor_test branch 2 times, most recently from 6adeb9b to 575dfd9 Compare January 26, 2025 13:56
@@ -0,0 +1,943 @@
# Copyright 2024 Sony Semiconductor Israel, Inc. All rights reserved.
Copy link
Collaborator

Choose a reason for hiding this comment

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

25 :)

@irenaby irenaby requested a review from reuvenperetz January 26, 2025 16:29
@irenaby
Copy link
Collaborator Author

irenaby commented Jan 26, 2025

@reuvenperetz please look at the github workflows. If we still need to exclude anything from coverage, let's talk.

enable_weights_quantization=pos_attr[1]),
activation_quantization_method=QuantizationMethod.POWER_OF_TWO,
quantization_preserving=False,
supported_input_activation_n_bits=[2, 4, 8],
Copy link
Collaborator

Choose a reason for hiding this comment

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

are these values relevant for testing or just a placeholder? because 2 and 4 are not relevant values for "real scenarios" so unless they are used to test some specific behavior, maybe change them to 8, 16 which are the relevant options for this field

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

They are just a placeholder, but anyway the calculator is not and should not be aware of what real scenarios are. If anything I would change it to some random values, but it's not used so it doesn't really matter

pass


def build_node(name='node', canonical_weights: dict=None, qcs=None, input_shape=(4, 5, 6), output_shape=(4, 5, 6),
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems that the setup for this test (tpc configs, node configs, graph mock, etc.) is a very good setup for many tests that would require such objects.
Maybe we extract it to a 'util' tests section so it would also be available in other tests?
It's probably better to do it in a separate PR, but maybe we can create a kind of "utils API for tests", otherwise I see a case where all this code is duplicated across many tests without changing anything.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

My only concern is that as a util it will be constantly extended to be more and more configurable, and become a mess. Also someone can decide to change the functionality a bit thinking it doesn't matter, when some previous tests count on that. We should be careful what is really a common utility, and what is the minimal implementation for a specific test.

@irenaby irenaby merged commit 4cb7162 into main Jan 27, 2025
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants