Skip to content

Conversation

@seberg
Copy link
Member

@seberg seberg commented Nov 5, 2021

Fix for gh-20305 @Qiyu8 maybe you know where to best add some tests? I was hoping to add some parametrization and be done with it, but didn't really find the right test to parametrize for float16 that would fail without the fixes.

EDIT: In case anyone ever stumbles on this. The previous tests probably did run all the code paths, the problem is the missing fractional part. Using the wrong tempvar here, meant the accumulation was done in (u)int16. Without a fractional part, that ends up with the correct result though.

@BvB93 BvB93 linked an issue Nov 9, 2021 that may be closed by this pull request
@seberg seberg force-pushed the float16-einsum-fix branch from 6f25a26 to bfb4d00 Compare November 10, 2021 00:32
@seberg
Copy link
Member Author

seberg commented Nov 10, 2021

OK, I added somewhat ugly, but probably exhaustive tests. I validated:

  • That the modified code lines get run with float16
  • That at least some of the checks listed fail (4-5 I think, not all, but not all were broken)

For the fact whether the fix is complete: Well, I searched for all @from@ before.

@seberg seberg force-pushed the float16-einsum-fix branch from bfb4d00 to a1a131f Compare November 10, 2021 00:34
@seberg seberg added the 09 - Backport-Candidate PRs tagged should be backported label Nov 10, 2021
This hopefully tests things well enough, at least some/most of the
paths get triggered and led to errors without the previous float16
typing fixes.

I manually confirmed that all paths that were *modified* in the
previous commit actually get hit with float16 specialized loops.

NOTE: This test may be a bit fragile with floating point roundoff
errors, and can in parts be relaxed if this happens.
@seberg seberg force-pushed the float16-einsum-fix branch from a1a131f to d9dae76 Compare November 12, 2021 17:34
@charris charris merged commit 491564d into numpy:main Nov 12, 2021
@charris
Copy link
Member

charris commented Nov 12, 2021

Thanks Sebastian.

@seberg seberg deleted the float16-einsum-fix branch November 12, 2021 18:55
@joergdietrich
Copy link

Thanks for fixing this so fast!

@charris charris added this to the 1.21.5 release milestone Nov 18, 2021
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Nov 25, 2021
@charris charris removed this from the 1.21.5 release milestone Nov 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

BUG: einsum all zero for float16

3 participants