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

Idea: Alternate operating mode which alters FP precision #11

Closed
HadrienG2 opened this issue Jun 19, 2018 · 2 comments
Closed

Idea: Alternate operating mode which alters FP precision #11

HadrienG2 opened this issue Jun 19, 2018 · 2 comments

Comments

@HadrienG2
Copy link
Contributor

HadrienG2 commented Jun 19, 2018

I am not sure if this could fall into the scope of Verrou, but if not maybe it could be food for thought for the associated Interflop project.

Most hardware architectures these days either favor (from a performance point of view) or outright mandate use of single-precision floating-point arithmetic. But most numerical algorithms are written in double precision as a safe default. Porting such algorithms to single precision usually involves a tedious process of locating and working on the code regions which are sensitive to use of reduced-precision arithmetic.

In principle, Verrou could help at this by offering an alternate operating mode where instead of twiddling the IEEE-754 rounding mode, it performs operations in reduced precision then casts back to the original floating-point format.

By integrating this functionality with delta-debugging, one could then easily locate which functions or code regions are most sensitive to use of reduced precisions. The double rounding would make this approach somewhat pessimistic with respect to an actual double -> float substitution in the code, but at least it could act as a good starting point for locating the precision-sensitive regions of the code.

What do you think about this idea?

@lathuili
Copy link
Contributor

We already have these kinds of ideas in mind ... so we like it. Indeed it is a good way to convince developers to use verrou. If your code is not stable, verrou will help you to correct it and if your code is stable verrou will help you to improve performance (computational time). For now it is not scheduled with high priority because we prefer to correct instable code before doing optimization of stable ones. Nevertheless there is a workaround : you can apply delta-debug on the wall code converted in float (usually easy in C++).

Anecdotally we got the idea of delta-debugging for localization thanks to the work with Promise (tools based on cadna to exhibit mixed precision configuration).

@HadrienG2
Copy link
Contributor Author

For others looking at this ticket: the functionality is now available in master. From experience with it, it is not a magic bullet and has some funny edge cases (see #20 for example), but remains nonetheless very helpful when doing f64 -> f32 ports or evaluating their relevance.

ffevotte pushed a commit that referenced this issue Nov 8, 2018
This version is based on Valgrind-3.14.0. (fixes gh-19)

### Added

- Preliminary filtering before Delta-Debugging: only functions performing
  floating-point operations are considered in the search for
  instabilities.

- Multiple variants of the Delta-Debugging algorithm: (fixes gh-14, gh-22)
  - srDDmin: variant of rDDmin, specifically tuned to accomodate for stochastic
    tests
  - drDDmin: variant of rDDmin where a preliminary binary search is performed in
    order to further reduce the search space.

- New reduced-precision backend (`--rounding-mode=float`). This back-end
  emulates the use of single-precision arithmetic for all double-precision
  variables. (fixes gh-11)

### Changed

- Python3 port of `verrou_dd`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants