Skip to content
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

llvm: Add option to select 32bit floating point representation #2400

Merged
merged 31 commits into from
Apr 29, 2022

Conversation

jvesely
Copy link
Collaborator

@jvesely jvesely commented Apr 29, 2022

Add --fp-precision pytest cmdline option, accepted values are 'fp64' and 'fp32', 'fp64' is the default.
Consolidate tests of compiler builtin helpers.
Refactor implementation of hyperbolic functions (tanh, coth, csch) to handle corner cases that result in the infinite value of exponential.
Adjust tests and add fp32 results for cases where the lower precision and rounding give different results.

jvesely added 29 commits April 14, 2022 10:42
Fixes parallel execution when using fp32 type.

Signed-off-by: Jan Vesely <[email protected]>
Predator-prey runs both fp32 and fp64 variant irrespective of the
--fp-precision setting.

Signed-off-by: Jan Vesely <[email protected]>
Add tests.
Conversion from double -> half is not accurate,
because of an issue with a call to runtime library [0].

[0] numba/llvmlite#834

Signed-off-by: Jan Vesely <[email protected]>
llvmlite does not handle special FP string values for other than fp64
precision [0]

[0] numba/llvmlite#833

Signed-off-by: Jan Vesely <[email protected]>
Make sure we always have fp64 variant available.
Add type specific tests.

Signed-off-by: Jan Vesely <[email protected]>
Bump vector length to 1500 to span more than one 4kB page.

Signed-off-by: Jan Vesely <[email protected]>
Add const dimension variant to every tested op.
Convert arguments to the right fp type.

Signed-off-by: Jan Vesely <[email protected]>
This is tested in test_builtins_matrix.py const dimensions tests.

Signed-off-by: Jan Vesely <[email protected]>
This should switch to using pytest.mark if it gets more widespread

Signed-off-by: Jan Vesely <[email protected]>
The original formula would return NaN if the input was large enough so
that exp(2x) == Inf and would need an extra condition check.

The new formula handles large inputs without extra checks.

Add tests with extreme value to builtins tests.

Signed-off-by: Jan Vesely <[email protected]>
…le in fp32

There are no special input values in the tests might as well make them
representable in 32b floating point.

Fixes fp32 test failures in SUB operation tests.

Signed-off-by: Jan Vesely <[email protected]>
The original formula would return NaN if the input was large enough so
that exp(2x) == Inf and would need an extra condition check.

The new formula handles large inputs without extra checks.
Add tests with extreme values to builtins tests.

Signed-off-by: Jan Vesely <[email protected]>
The original formula would return NaN if the input was large enough so
that exp(2x) == Inf and would need an extra condition check.

The new formula handles large inputs without extra checks.
Add tests with extreme value to builtins tests.

Use stricter tolerance for fp64 tests.

Signed-off-by: Jan Vesely <[email protected]>
Move expected values out of param list.
Integrate test names into param list.
Re-enable small drift rate test, override expected results on windows
and mac.
Enable small drift rate test in compiled mode, override expected
results.
Add more small drift rate tests.

Signed-off-by: Jan Vesely <[email protected]>
The results differ from fp64 because of rounding and use of Philox PRNG.

Signed-off-by: Jan Vesely <[email protected]>
These are now high/low enough to work with fp32 Philox random sequence.
Make sure initializer values are different from the test values.

Signed-off-by: Jan Vesely <[email protected]>
Drop the hack using inf input values to select PRNG.

Signed-off-by: Jan Vesely <[email protected]>
@jvesely jvesely added the compiler Runtime Compiler label Apr 29, 2022
@jvesely jvesely added the CUDA CUDA target for the runtime compiler label Apr 29, 2022
@github-actions
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):

No differences!

...

See CI logs for the full diff.

1 similar comment
@github-actions
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):

No differences!

...

See CI logs for the full diff.

jvesely added 2 commits April 29, 2022 01:30
PTX results for fp32 DDA function with neg input differ due to operation
accuracy/rounding.

Signed-off-by: Jan Vesely <[email protected]>
@github-actions
Copy link

This PR causes the following changes to the html docs (ubuntu-latest-3.7-x64):

No differences!

...

See CI logs for the full diff.

@jvesely jvesely merged commit f939a97 into PrincetonUniversity:devel Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler Runtime Compiler CUDA CUDA target for the runtime compiler
Projects
Development

Successfully merging this pull request may close these issues.

1 participant