Skip to content
This repository was archived by the owner on Dec 22, 2021. It is now read-only.

Explicit rounding control per operation #61

Open
baryluk opened this issue Dec 28, 2018 · 3 comments
Open

Explicit rounding control per operation #61

baryluk opened this issue Dec 28, 2018 · 3 comments

Comments

@baryluk
Copy link

baryluk commented Dec 28, 2018

Hi,

add, sub, div, sqrt, mul, and float->integer conversions, should all have a third optional argument, to allow changing a rounding mode (nearest, toward plus infinity, towards minus infinity, to zero, out of zero, exact - last one excepting when result is not exact).

Default would be nearest and would generally create no overhead in code at all.

If the rounding is non standard / non default, it can translate to explicit rounding in instructions (AVX512 does that), or manipulate SSE control registers (preferably in optimized way to not switch there and back too much), to get proper behavior.

If not implemented in the first draft, at least make sure it can be added later without changing semantic or adding overheads.

@binji
Copy link
Member

binji commented Jan 8, 2019

This is mentioned briefly in FutureFeatures.md for scalar floats.

@arunetm
Copy link
Collaborator

arunetm commented Jan 8, 2019

Floating point vector rounding instructions are considered here: #7
Efficient implementations across platforms is a concern in exposing these.

@baryluk
Copy link
Author

baryluk commented May 29, 2020

@arunetm #7 only deals with explicit rounding of floating point conversions to integers. It doesn't deal with rounding control of all other arithmetic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants