-
Notifications
You must be signed in to change notification settings - Fork 86
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
wgsl: Change *Unbounded[Interval|Vector|...] to *Infinite[Interval|Vector|...] #3208
Conversation
This is dependent on the |
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 code change generally looks good to me, thanks!
But I am not sure about the usage of name infinite
. If I get it right, we use "unbounded interval" to indicate that we accept any result of the given FP type, or as the WGSL spec said "indeterminate value". But technically yes, it is a interval of [-inf, inf].
I hope others can have comments on this.
|
For context, in PRs that depend on this change I am currently working on a rework of how OOB behaviour is tracked in the framework. Specifically instead of depending on checking the intervals bounds at the end of the calculation, I am adding a bit to the state of the interval that indicates whether or not it was created as the result of a calculation that went OOB, and this bit propegates, so if an earlier calculation goes OOB, but a later one pulls it back in bounds, there will still be the 'correct' bounds calculated, but the fact the result could be indeterminate will be preserved. In my prototype these usage of the Unbounded/Infinite interval constant drops off noticeabley, except for specific circumstantes like division by zero. The term 'unboundedInterval' becomes confusing because one has to distinguish between a regular FPInterval with the OOB bit set, which is unbounded for the purposes of checking expectations, and this constant interval with infinite endpoints. (I have split up my work changes so that PRs like this can be reviewed seperately/earlier, since I am not sure if I will have the entire change set ready before the winter break) |
I don't have strong opinions about the terminology here, but would like to better understand the new bit being added to the interval. @zoddicus - do you have anything (bug for example) that explains why we need to add this bit? Ideally, something that explains what isn't working right now, and how the bit fixes it? |
This is the issue that I have filed, #3139 In brief, for mix specifically, I have written a test case that goes OOB in one of the intermediate steps, but comes back in bounds by the end. This leads to a situation where (because of the intermediate OOB) the CTS should accept any input, but because we have an in bounds end interval, it is checking against that. As implemented the framework is supposed to have converted that OOB value to the infinite interval at the intermediate step (which I probably could find the bug and fix) but that would eliminate the endpoint values. For validation there is distinction between going OOB near the edge of the range versus being way out there, so retaining what the actual calculated endpoints are is going to be needed for the validation testing. |
The bit should resolve this issue by allowing .contains to be rewritten so that if bit == true return true at the beginning. |
This is roughly what I understood, but I'm vague about: Would it be possible to describe this in steps, with a concrete example, highlighting where the mismatch occurs? |
Took me a moment to come up with a solid example, because my new workstation apparently does the math in a higher precision, so wasn't causing the CTS to trip anymore 🙃 For mix one of the allowed formulas is
We have the following operations:
So the final result 4) is in bounds, but 1) went OOB, and if we are operating in f16, number in TS can accurately represent all of this. The framework for f16 currently returns [32752.0, 32768.0], which is in bounds. The current implementation isn't behaving as intended, because at 1) this should have be splatted to [-∞, ∞], which should have propegated through. This in theory could be fixed, but will need to be revisited for validation testing. Specifically https://www.w3.org/TR/WGSL/#floating-point-overflow states that if a value is OOB, but near the edge of the range, than it is fair for a platform to round into range, so doesn't nescarily cause a validation error. So how far things go OOB needs to be tracked, so this unbounded bit will probably need to be expanded to be a tri-state, always in bounds, always alteast near OOB, or went far OOB. |
…ctor|...] The current 'unbounded' constants are for [-∞, ∞] intervals. Changing the name to avoid confusion once the 'bounded' state bit is added to the interval class. Issue gpuweb#3201
bd95de9
to
8e36b80
Compare
Co-authored-by: jzm-intel <[email protected]>
26d1ec2
to
8ca165a
Compare
Thank you for the example!
So this is the bit that I'm confused about. For |
Ugh, so my test case was wrong, it should have been So I cannot reproduce the issue I was seeing before anywhere, which makes me suspicious that it might have been a bug in something on my previous workstation... I am going to port my mix patch to ToT and try determine if it is broken there or not. |
Abandoning for now, since I don't think the rework is needed to get mix tests working atm. I may revisit this if OOB bit tracking it needed in the future. |
The current 'unbounded' constants are for [-∞, ∞] intervals. Changing
the name to avoid confusion once the 'bounded' state bit is added to
the interval class.
Issue #3201
Requirements for PR author:
.unimplemented()
./** documented */
and new helper files are found inhelper_index.txt
.Requirements for reviewer sign-off:
When landing this PR, be sure to make any necessary issue status updates.