herbie-fp / herbie

Optimize floating-point expressions for accuracy

Home Page:https://herbie.uwplse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unknown preprocess #s(symmetry-group (a b c))

etiennebirling opened this issue · comments

Reusing herbie-generated .fpcore files as input for herbie raises an exception:

herbie shell --seed 1884498005
(FPCore
 (x0 x1 x2)
 :name
 "test01_sum3"
 :precision
 binary32
 :pre
 (and (< 1 x0 2) (< 1 x1 2) (< 1 x2 2))
 (let ((p0 (- (+ x0 x1) x2)) (p1 (- (+ x1 x2) x0)) (p2 (- (+ x2 x0) x1)))
   (+ (+ p0 p1) p2)))

returns

(FPCore
 (x0 x1 x2)
 :herbie-status
 ex-start
 :herbie-time
 2622.51708984375
 :herbie-error-input
 ((256 0.368332598053356) (8000 0.36052702213822424))
 :herbie-error-output
 ((256 0.1568627450980392) (8000 0.13876734591823978))
 :name
 "test01_sum3"
 :precision
 binary32
 :herbie-conversions
 ()
 :pre
 (and (and (and (< 1.0 x0) (< x0 2.0)) (and (< 1.0 x1) (< x1 2.0)))
      (and (< 1.0 x2) (< x2 2.0)))
 :herbie-preprocess
 (#s(symmetry-group (x0 x1 x2)))
 (+ x1 (+ x0 x2)))

and then (basically reusing this first output as input for herbie)

herbie shell --seed 1884498005
(FPCore
 (x0 x1 x2)
 :herbie-status
 ex-start
 :herbie-time
 2622.51708984375
 :herbie-error-input
 ((256 0.368332598053356) (8000 0.36052702213822424))
 :herbie-error-output
 ((256 0.1568627450980392) (8000 0.13876734591823978))
 :name
 "test01_sum3"
 :precision
 binary32
 :herbie-conversions
 ()
 :pre
 (and (and (and (< 1.0 x0) (< x0 2.0)) (and (< 1.0 x1) (< x1 2.0)))
      (and (< 1.0 x2) (< x2 2.0)))
 :herbie-preprocess
 (#s(symmetry-group (x0 x1 x2)))
 (+ x1 (+ x0 x2)))

fails in

unknown preprocess #s(symmetry-group (x0 x1 x2))
  context...:
   .../private/map.rkt:40:19: loop
   /home/etienne/herbie/src/syntax/read.rkt:38:0: parse-test
   /home/etienne/herbie/src/shell.rkt:25:2
   body of (submod "/home/etienne/herbie/src/herbie.rkt" main)

Is that an unexpected feature or actually a bug?
The same problem happens with .fpcore files.
I pulled herbie today again and checked again that the problem still exists

Oh interesting, that's a bug. I'm not sure why the output is being generated like this. I have a big refactor of this whole code path pending (I got busy) but I'll look into solving this particular instance.

Hi @etiennebirling I ended up just merging the big refactor to fix this bug. So it was fixed by #424. Thanks for the bug report!