-
Notifications
You must be signed in to change notification settings - Fork 392
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 Tensor<T> helper class for tests #7830
Open
copybara-service
wants to merge
1
commit into
master
Choose a base branch
from
test_727983393
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+901
−1,661
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bebff24
to
0e7f96a
Compare
Tensor<T>
, a helper class for multi-dimensional arrays that are frequently used in our tests (but currently are duplicating extent/stride computations frequently). Second is modifying two tests (slice and transpose) to make some changes:d25344a
to
5f8c80e
Compare
copybara-service bot
pushed a commit
that referenced
this pull request
Feb 19, 2025
…emory This causes crashes on windows, uncovered in #7830. PiperOrigin-RevId: 728501674
copybara-service bot
pushed a commit
that referenced
this pull request
Feb 19, 2025
…emory This causes crashes on windows, uncovered in #7830. This bug appears with `xnn_create_runtime_v4`, other paths that allocate workspaces have matching allocate/free calls. PiperOrigin-RevId: 728501674
copybara-service bot
pushed a commit
that referenced
this pull request
Feb 19, 2025
…emory This causes crashes on windows, uncovered in #7830. This bug appears with `xnn_create_runtime_v4`, other paths that allocate workspaces have matching allocate/free calls. PiperOrigin-RevId: 728501674
copybara-service bot
pushed a commit
that referenced
this pull request
Feb 19, 2025
…emory This causes crashes on windows, uncovered in #7830. This bug appears with `xnn_create_runtime_v4`, other paths that allocate workspaces have matching allocate/free calls. PiperOrigin-RevId: 728550543
e3acf6c
to
417981a
Compare
This CL does two things: first is adding `Tensor<T>`, a helper class for multi-dimensional arrays that are frequently used in our tests (but currently are duplicating extent/stride computations and other buffer related logic frequently). Second is modifying a few tests to make some changes: - Currently, subgraph tests compare subgraph to operator results. This changes tests to directly check the output, without running the operator code. - Currently, subgraph tests run a single random variation, and getting good coverage requires running the test many times. This changes the subgraph tests to test cover many more permutations in a single run. - Currently, subgraph tests dig into the internal implementation details of subgraphs (e.g. checking xnn_node_value state). This makes sense in some cases (e.g. fusion tests), but it is both hard to be certain that this covers real usage, and is brittle. IMO, tests should (as much as possible) attempt to verify the behavior is as expected via the APIs that are visible to the user of the thing they are testing. For the subgraph API, that means we should just make sure the subgraph works as expected. - Currently subgraph tests are very verbose. IMO this is a problem because it discourages writing tests. This CL adds bfloat16 test coverage for constant_pad (and enables that operation, which previously didn't work for any good reason) with just 3 marginal lines of code, whereas before it would have added several hundred lines of code (copy/paste + modifications) This change required a few minor cleanups: - `xnnpack::Buffer<T>` needs to be able to distinguish between "extra bytes" and real data. - There is now some overlap between `RuntimeTester` and `SubgraphTester`. I think we should deprecate `RuntimeTester` and consolidate everything in `SubgraphTester`, because we can't return `RuntimeTester` from the base class `SubgraphTester` builder methods. This is a minor difficulty, but it also seems like the reason to separate them is minor too. PiperOrigin-RevId: 727983393
417981a
to
51a0ed5
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add Tensor helper class for tests
This CL does two things: first is adding
Tensor<T>
, a helper class for multi-dimensional arrays that are frequently used in our tests (but currently are duplicating extent/stride computations and other buffer related logic frequently). Second is modifying a few tests to make some changes:This change required a few minor cleanups:
xnnpack::Buffer<T>
needs to be able to distinguish between "extra bytes" and real data.RuntimeTester
andSubgraphTester
. I think we should deprecateRuntimeTester
and consolidate everything inSubgraphTester
, because we can't returnRuntimeTester
from the base classSubgraphTester
builder methods. This is a minor difficulty, but it also seems like the reason to separate them is minor too.