Skip to content

Commit

Permalink
Merge pull request #317 from uwplse/release-1.4
Browse files Browse the repository at this point in the history
Release Herbie 1.4
  • Loading branch information
pavpanchekha authored Jul 20, 2020
2 parents f775348 + 67cd4ad commit cd03acd
Show file tree
Hide file tree
Showing 48 changed files with 659 additions and 702 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/hamming.yml

This file was deleted.

69 changes: 67 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
name: Unit Tests
name: Unit, Integration, and Plugin tests

on: [push]

env:
RUST_BACKTRACE: full

jobs:
build:
unit-tests:
name: "Unit Tests"
runs-on: ubuntu-latest
steps:
- name: "Install Packages"
Expand All @@ -14,3 +18,64 @@ jobs:
- name: "Install dependencies"
run: raco pkg install --name herbie --no-cache --auto src/
- run: raco test src/ infra/

hamming:
name: "Integration tests (Hamming)"
runs-on: ubuntu-latest
strategy:
matrix:
racket-version: [ '7.5', '7.6', '7.7' ]
precision: [ 'binary32', 'binary64' ]
steps:
- name: "Install Packages"
run: sudo apt-get install -y libmpfr6 libmpfr-dev
- name: "Install Racket"
uses: Bogdanp/[email protected]
with:
version: ${{ matrix.racket-version }}
- uses: actions/checkout@master
- name: "Install dependencies"
run: raco pkg install --name herbie --no-cache --auto src/
- run: racket infra/travis.rkt --precision ${{ matrix.precision }} --seed 0 bench/hamming/

softposit:
name: "Plugin tests (Posits)"
runs-on: ubuntu-latest
needs: [ 'hamming' ]
steps:
- name: "Install Packages"
run: sudo apt-get install -y libmpfr6 libmpfr-dev
- name: "Install Racket"
uses: Bogdanp/[email protected]
- uses: actions/checkout@master
- name: "Install dependencies"
run: raco pkg install --name herbie --no-cache --auto src/
- name: "Check out softposit-herbie master"
uses: actions/checkout@master
with:
repository: herbie-fp/softposit-herbie
path: plugin
- name: "Install SoftPosit support"
run: raco pkg install --no-cache --auto --name softposit-herbie plugin/
- run: racket infra/travis.rkt --precision posit16 --seed 0 plugin/bench/posits.fpcore

complex:
name: "Plugin tests (Complex)"
runs-on: ubuntu-latest
needs: [ 'hamming' ]
steps:
- name: "Install Packages"
run: sudo apt-get install -y libmpfr6 libmpfr-dev
- name: "Install Racket"
uses: Bogdanp/[email protected]
- uses: actions/checkout@master
- name: "Install dependencies"
run: raco pkg install --name herbie --no-cache --auto src/
- name: "Check out complex-herbie master"
uses: actions/checkout@master
with:
repository: herbie-fp/complex-herbie
path: plugin
- name: "Install Complex support"
run: raco pkg install --no-cache --auto --name complex-herbie plugin/
- run: racket infra/travis.rkt --seed 0 plugin/test.fpcore
24 changes: 0 additions & 24 deletions .github/workflows/trigger-posits.yml

This file was deleted.

4 changes: 1 addition & 3 deletions infra/travis.rkt
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#lang racket

(require racket/date racket/cmdline)
(require "../src/common.rkt" "../src/points.rkt" "../src/plugin.rkt")
(require "../src/alternative.rkt" "../src/sandbox.rkt")
(require "../src/syntax/read.rkt" "../src/datafile.rkt")
(require "../src/alternative.rkt" "../src/sandbox.rkt" "../src/syntax/read.rkt")

;; Load all the plugins
(load-herbie-plugins)
Expand Down
2 changes: 1 addition & 1 deletion src/config.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
(if (equal? out "") default out))
default))

(define *herbie-version* "1.3")
(define *herbie-version* "1.4")

(define *hostname* (run-command "hostname"))

Expand Down
2 changes: 1 addition & 1 deletion src/core/alt-table.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

(require racket/hash)
(require "../common.rkt" "../alternative.rkt" "../points.rkt"
"../interface.rkt" "../timeline.rkt" "../programs.rkt")
"../timeline.rkt" "../programs.rkt")

(provide
(contract-out
Expand Down
2 changes: 1 addition & 1 deletion src/core/periodicity.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

(require racket/match)
(require "../common.rkt" "../programs.rkt" "../alternative.rkt" "../points.rkt"
"../float.rkt" "../interface.rkt")
"../interface.rkt")

(struct annotation (expr loc type coeffs) #:transparent)
(struct lp (loc periods) #:prefab)
Expand Down
4 changes: 0 additions & 4 deletions src/core/reduce.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
(define fn-inverses
(map rule-input (filter (λ (rule) (variable? (rule-output rule))) (*rules*))))

(define (eval-const-expr expr)
;; When we are in nonffi mode, we don't use repr, so pass in #f
((eval-prog `(λ () ,expr) 'nonffi #f)))

(define (simplify expr*)
(define expr ((get-evaluator) expr*))
(match expr
Expand Down
2 changes: 1 addition & 1 deletion src/core/simplify.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
simplify-batch-egg]
[else
(warn 'simplify #:url "faq.html#egg-herbie"
"Falling back on racket egraph because egg-herbie package not installed")
"Falling back on regraph because egg-herbie package not installed")
simplify-batch-regraph]))

(debug #:from 'simplify "Simplifying using " driver ":\n " (string-join (map ~a exprs) "\n "))
Expand Down
2 changes: 1 addition & 1 deletion src/datafile.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#lang racket

(require racket/date json)
(require "common.rkt" "float.rkt")
(require "common.rkt")

(provide
(struct-out table-row) (struct-out report-info)
Expand Down
14 changes: 3 additions & 11 deletions src/errors.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(struct-out exn:fail:user:herbie)
(struct-out exn:fail:user:herbie:syntax)
(struct-out exn:fail:user:herbie:sampling)
warn warning-log expect-warning)
warn warning-log *warnings-disabled*)

(struct exn:fail:user:herbie exn:fail:user (url)
#:extra-constructor-name make-exn:fail:user:herbie)
Expand Down Expand Up @@ -68,25 +68,17 @@

(define warnings-seen (mutable-set))
(define warning-log '())
(define *warnings-disabled* (make-parameter true))

(define (warn type message #:url [url #f] #:extra [extra '()] . args)
(unless (set-member? warnings-seen type)
(unless (or (*warnings-disabled*) (set-member? warnings-seen type))
(set-add! warnings-seen type)
(define url* (and url (format "https://herbie.uwplse.org/doc/~a/~a" *herbie-version* url)))
(set! warning-log (cons (list type message args url* extra) warning-log))
(eprintf "Warning: ~a\n" (apply format message args))
(for ([line extra]) (eprintf " ~a\n" line))
(when url (eprintf "See <~a> for more.\n" url*))))

(define (expect-warning type thunk)
(define already-silent #f)
(dynamic-wind
(λ ()
(set! already-silent (set-member? warnings-seen type))
(set-add! warnings-seen type))
thunk
(λ () (unless already-silent (set-remove! warnings-seen type)))))

(register-reset
(λ ()
(set-clear! warnings-seen)
Expand Down
3 changes: 1 addition & 2 deletions src/float.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@


(require math/bigfloat math/base)
(require "common.rkt" "interface.rkt" "syntax/types.rkt"
"syntax/syntax.rkt" "errors.rkt")
(require "common.rkt" "interface.rkt" "syntax/types.rkt" "errors.rkt")
(module+ test (require rackunit))

(provide
Expand Down
2 changes: 2 additions & 0 deletions src/herbie.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
(*num-points* (string->number num))]
[("--num-enodes") num "The number of enodes to use during simplification"
(*node-limit* (string->number num))]
[("--num-analysis") num "The number of input analysis iterations to use"
(*max-find-range-depth* (string->number num))]
#:multi
[("-o" "--disable") flag "Disable a flag (formatted category:name)"
(define tf (parse-flag flag))
Expand Down
6 changes: 3 additions & 3 deletions src/info.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
("egg-herbie-windows" #:platform "win32\\x86_64" #:version "1.4")
("egg-herbie-osx" #:platform "x86_64-macosx" #:version "1.4")
("egg-herbie-linux" #:platform "x86_64-linux" #:version "1.4")
"regraph"
"rival"
"fpbench"))
("regraph" #:version "1.4")
("rival" #:version "1.4")
("fpbench" #:version "2.0")))

(define build-deps
'("rackunit-lib"))
Expand Down
2 changes: 1 addition & 1 deletion src/points.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
(require racket/runtime-path)
(define-runtime-path benchmarks "../bench/")
(define exprs
(let ([tests (expect-warning 'duplicate-names (λ () (load-tests benchmarks)))])
(let ([tests (load-tests benchmarks)])
(append (map test-program tests) (map test-precondition tests))))
(check = (count (compose not (curryr expr-supports? 'ival) program-body) exprs) 0))

Expand Down
2 changes: 1 addition & 1 deletion src/programs.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#lang racket

(require math/bigfloat rival)
(require "common.rkt" "syntax/types.rkt" "syntax/syntax.rkt" "float.rkt" "interface.rkt")
(require "syntax/types.rkt" "syntax/syntax.rkt" "float.rkt" "interface.rkt")

(module+ test (require rackunit))

Expand Down
2 changes: 1 addition & 1 deletion src/sampling.rkt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#lang racket
(require math/bigfloat rival math/base
(only-in fpbench interval range-table-ref condition->range-table [expr? fpcore-expr?]))
(require "searchreals.rkt" "common.rkt" "programs.rkt" "config.rkt" "errors.rkt" "float.rkt"
(require "searchreals.rkt" "programs.rkt" "config.rkt" "errors.rkt" "float.rkt"
"interface.rkt" "timeline.rkt" "syntax/types.rkt")
(module+ test (require rackunit))
(provide make-sampler)
Expand Down
2 changes: 1 addition & 1 deletion src/sandbox.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

(define (compute-result test)
(parameterize ([*debug-port* (or debug-port (*debug-port*))]
[*timeline-disabled* false])
[*timeline-disabled* false] [*warnings-disabled* true])
(define start-time (current-inexact-milliseconds))
(when seed (set-seed! seed))
(random) ;; Child process uses deterministic but different seed from evaluator
Expand Down
2 changes: 1 addition & 1 deletion src/searchreals.rkt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#lang racket
(require math/bigfloat rival)
(require "common.rkt" "programs.rkt" "interface.rkt" "timeline.rkt")
(require "interface.rkt" "timeline.rkt")

(module+ test (require rackunit))

Expand Down
13 changes: 8 additions & 5 deletions src/web/demo.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
(option ([value "binary64"]) "Double-precision floats")
(option ([value "binary32"]) "Single-precision floats")))
(ul ([id "errors"]))
(input ([type "submit"])))
(button ([type "submit"] [tabindex "-1"])))

(if (*demo?*)
`(p "To handle the high volume of requests, web requests are queued; "
Expand All @@ -125,10 +125,13 @@
"expressions, including the top-level " (code "FPCore") " form, "
"using only the following supported functions:")
`(p ([id "mathjs-instructions"] [style "display: none;"])
"You can write ordinary mathematical expressions (parsed with "
(a ([href "https://mathjs.org"]) "math.js") ") using the standard "
(code "math.h") " functions, including:")

"Use ordinary mathematical syntax (parsed by "
(a ([href "https://mathjs.org"]) "math.js") ")"
" and "
(a ([href ,(format "https://herbie.uwplse.org/doc/~a/input.html" *herbie-version*)])
"standard functions")
" like:")

(function-list
'((+ - * / abs) "The usual arithmetic functions")
'((and or) "Logical connectives (for preconditions)")
Expand Down
13 changes: 7 additions & 6 deletions src/web/history.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
(match altn
[(alt prog 'start (list))
(list
`(li (p "Initial program " (span ([class "error"] [title ,err2]) ,err))
`(li (p "Initial program " (span ([class "error"] [title ,err2]) "Error: " ,err " bits"))
(div ([class "math"]) "\\[" ,(core->tex (program->fpcore (resugar-program prog prec))) "\\]")))]
[(alt prog `(start ,strategy) `(,prev))
`(,@(render-history prev pcontext pcontext2 repr)
Expand All @@ -76,32 +76,33 @@

[(alt prog `(taylor ,pt ,loc) `(,prev))
`(,@(render-history prev pcontext pcontext2 repr)
(li (p "Taylor expanded around " ,(~a pt) " " (span ([class "error"] [title ,err2]) ,err))
(li (p "Taylor expanded around " ,(~a pt) " "
(span ([class "error"] [title ,err2]) "Error: " ,err " bits"))
(div ([class "math"]) "\\[\\leadsto " ,(core->tex (program->fpcore (resugar-program prog prec))
#:loc loc #:color "blue")
"\\]")))]

[(alt prog `(simplify ,loc) `(,prev))
`(,@(render-history prev pcontext pcontext2 repr)
(li (p "Simplified" (span ([class "error"] [title ,err2]) ,err))
(li (p "Simplified" (span ([class "error"] [title ,err2]) "Error: " ,err " bits"))
(div ([class "math"]) "\\[\\leadsto " ,(core->tex (program->fpcore (resugar-program prog prec))
#:loc loc #:color "blue")
"\\]")))]

[(alt prog `initial-simplify `(,prev))
`(,@(render-history prev pcontext pcontext2 repr)
(li (p "Initial simplification" (span ([class "error"] [title ,err2]) ,err))
(li (p "Initial simplification" (span ([class "error"] [title ,err2]) "Error: " ,err " bits"))
(div ([class "math"]) "\\[\\leadsto " ,(core->tex (program->fpcore (resugar-program prog prec))) "\\]")))]

[(alt prog `final-simplify `(,prev))
`(,@(render-history prev pcontext pcontext2 repr)
(li (p "Final simplification" (span ([class "error"] [title ,err2]) ,err))
(li (p "Final simplification" (span ([class "error"] [title ,err2]) "Error: " ,err " bits"))
(div ([class "math"]) "\\[\\leadsto " ,(core->tex (program->fpcore (resugar-program prog prec))) "\\]")))]

[(alt prog (list 'change cng) `(,prev))
`(,@(render-history prev pcontext pcontext2 repr)
(li (p "Applied " (span ([class "rule"]) ,(~a (rule-name (change-rule cng))))
(span ([class "error"] [title ,err2]) ,err))
(span ([class "error"] [title ,err2]) "Error: " ,err " bits"))
(div ([class "math"]) "\\[\\leadsto " ,(core->tex (program->fpcore (resugar-program prog prec))
#:loc (change-location cng) #:color "blue")
"\\]")))]
Expand Down
2 changes: 1 addition & 1 deletion src/web/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ a:hover {text-decoration: underline; color: #295785}
display: block; text-align: right; margin-top: .5em;
cursor: pointer;
}
#formula input[type=submit] { display: none; }
#formula button[type=submit] { visibility: hidden; height: 0; }
label { display: inline-block; width: 20%; line-height: 3; }
input, select { width: 80%; }
#errors li { color: #800; }
Expand Down
Loading

0 comments on commit cd03acd

Please sign in to comment.