Skip to content

Commit bed20c8

Browse files
authored
Merge pull request #1423 from herbie-fp/preprocessing-flag
Add preprocessing flag
2 parents e2cb929 + 34111c0 commit bed20c8

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/config.rkt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
(define default-flags
1010
#hash([precision . ()]
11-
[setup . (search)]
11+
[setup . (search preprocess)]
1212
[localize . ()]
1313
[generate . (rr taylor proofs evaluate)]
1414
[reduce . (regimes binary-search branch-expressions)]

src/core/mainloop.rkt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#lang racket
22

3-
(require "../utils/alternative.rkt"
3+
(require "../config.rkt"
4+
"../utils/alternative.rkt"
45
"../utils/common.rkt"
56
"../utils/timeline.rkt"
67
"../syntax/platform.rkt"
@@ -45,7 +46,10 @@
4546

4647
(define (run-improve! initial specification context pcontext)
4748
(timeline-event! 'preprocess)
48-
(define preprocessing (find-preprocessing specification context))
49+
(define preprocessing
50+
(if (flag-set? 'setup 'preprocess)
51+
(find-preprocessing specification context)
52+
'()))
4953
(timeline-push! 'symmetry (map ~a preprocessing))
5054
(define pcontext* (preprocess-pcontext context pcontext preprocessing))
5155
(*pcontext* pcontext*)

www/doc/2.3/options.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,14 @@ <h2>Search options</h2>
206206
points</a>" error more often. Instead of turning this option off,
207207
try adjusting the <kbd>--num-analysis</kbd> flag.</dd>
208208

209+
<dt><code>setup:preprocess</code></dt>
210+
<dd>This option, on by default, uses identities of the input
211+
expression (like even or symmetric expressions) to perform
212+
rewriting more effectively. If turned off, Herbie will skip
213+
preprocessing and work directly with the original expression. This
214+
can be faster but may produce less accurate results for
215+
expressions with exploitable symmetries.</dd>
216+
209217
<dt><code>generate:rr</code></dt>
210218
<dd>This option, on by default, uses algebraic rewriting to
211219
generate candidate programs. This is Herbie's primary method of

0 commit comments

Comments
 (0)