Closed Bug 1818526 Opened 2 years ago Closed 2 years ago

[wpt-sync] Sync PR 38677 - [webnn] Update float32 gemm tests to avoid catastrophic cancellation

Categories

(Testing :: web-platform-tests, task, P4)

task

Tracking

(firefox112 fixed)

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: wpt-sync, Unassigned)

References

(Depends on 1 open bug, )

Details

(Whiteboard: [wptsync downstream])

Sync web-platform-tests PR 38677 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/38677
Details from upstream follow.

BruceDai <feng.dai@intel.com> wrote:

[webnn] Update float32 gemm tests to avoid catastrophic cancellation

@fdwr I've updated previous gemm tests and also added some new tests to address your last comment to avoid catastrophic cancellation, PTAL, thanks.

gemm calculation follows the expression `alpha * A x B + beta * C`, 

first = alpha * A
second = B
third = beta * C
Each of these parts should match signs.

It's okay if alpha * A have the same sign as B.
And it's okay if alpha * A x B and beta * C have the same sign.

So if alpha * A x B is positive, then C and beta can both be positive,
or C can be negative if beta is also negative. 

Similarly, if B is positive, then it's fine for A to be negative
if alpha is also negative, because alpha * B is positive.

@Honry @dontcallmedom Please also help review this pr, thanks.

Whiteboard: [wptsync downstream] → [wptsync downstream error]
Whiteboard: [wptsync downstream error] → [wptsync downstream]
Pushed by wptsync@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0e66de72bf80 [wpt PR 38677] - [webnn] Update float32 gemm tests to avoid catastrophic cancellation, a=testonly
Test result changes from PR not available.
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
You need to log in before you can comment on or make changes to this bug.