-
Notifications
You must be signed in to change notification settings - Fork 6
Fix yet two more bugs #103
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
006af5d
Fix one-element sum accumulations
davschneller 16f7616
Fix action merging if we'd override a global variable
davschneller 7c0457d
Merge remote-tracking branch 'origin/master' into davschneller/more-bugs
davschneller 4db34df
Add tests
davschneller a29ba84
Merge remote-tracking branch 'origin/master' into davschneller/more-bugs
davschneller a58486c
refactor: address review
davschneller c4bef65
refactor: fix precommit
davschneller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| from yateto import * | ||
| from yateto.ast.node import Add | ||
|
|
||
| def add(g): | ||
| M = 32 | ||
| K = 40 | ||
| A = Tensor('A', (M, K)) | ||
| B = Tensor('B', (M, K)) | ||
| C = Tensor('C', (M, K)) | ||
|
|
||
| class Counter: | ||
| def __init__(self): | ||
| self.counter = 0 | ||
|
|
||
| counter = Counter() | ||
|
|
||
| def _(kernel): | ||
| counter.counter += 1 | ||
| g.add(f'kernel{counter.counter}', kernel) | ||
|
|
||
| # regression tests | ||
|
|
||
| # list bugs with their PR solving them here | ||
|
|
||
| # #103.1 | ||
| # allow one-element sum accumulations | ||
| _(B['ij'] <= Add() + A['ij']) | ||
|
|
||
| # #103.2 | ||
| # prevent overriding a global variable when action merging | ||
| _([ | ||
| B['ij'] <= A['ij'], | ||
| C['ij'] <= B['ij'] | ||
| ]) |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
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.
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.
Just to clarify, could you please elaborate a bit on this change?
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.
The computation also works for length 1 without adjustments (but not so for 0 I think, but I haven't tried it); so all we do here is make the assert more lenient for that exact case.
(it doesn't quite return the original tensor here; but will still generate a copy-scale-add operation—though that one should be, IIRC, optimized away or merged with other operations afterwards)
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.
How about we verify that it does not work for 0 first? If it also works for 0, maybe you could remove the assert.
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.
I tried it—it seems to fail on some more fronts (i.e. it takes longer than 10 mins to fix it).