Skip to content

Commit becae91

Browse files
committed
Fix a crash & add instructions for next time
1 parent 6e0966e commit becae91

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@
88
- Run `racket src/main.rkt report bench/tutorial.fpcore tmp` to test
99
that your changes work; this should take about 5-10 seconds and all
1010
of the tests should pass, getting basically perfect accuracy.
11+
- After running tests, you should be able to look into `tmp`, and see
12+
one directory per benchmark. Each directory has a `graph.html` with
13+
more detail on what happened, including tracebacks for crashes.
14+
- Herbie prints a seed every time it runs; you can pass --seed N after
15+
the "report" argument to fix a seed. That should be perfectly
16+
reproducible.
1117
- You can also run the unit tests with `raco test <file>`, when unit
1218
tests exist. Often they don't.
1319

src/core/egg-herbie.rkt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,11 @@
287287
[`(Explanation ,body ...) `(Explanation ,@(map (lambda (e) (loop e type)) body))]
288288
[(list 'Rewrite=> rule expr) (list 'Rewrite=> (get-canon-rule-name rule rule) (loop expr type))]
289289
[(list 'Rewrite<= rule expr) (list 'Rewrite<= (get-canon-rule-name rule rule) (loop expr type))]
290+
[(list op args ...)
291+
#:when (string-prefix? (symbol->string op) "sound-")
292+
(define op* (string->symbol (substring (symbol->string op) (string-length "sound-"))))
293+
(define args* (drop-right args 1))
294+
(cons op* (map loop args* (map (const 'real) args*)))]
290295
[(list op args ...)
291296
;; Unfortunately the type parameter doesn't tell us much because mixed exprs exist
292297
;; so if we see something like (and a b) we literally don't know which "and" it is

0 commit comments

Comments
 (0)