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

Add mergable changes from platforms #789

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

broughjt
Copy link
Contributor

Changes:

  • accelerator.rkt Refactor of the accelerator API
  • core/egg-herbie.rkt Exclude an egg-herbier
  • core/matcher.rkt, core/rr.rkt Move rule-apply, rewrite-once, and rewrite-expressions to a new rr.rkt file
  • patch.rkt Make compatible with new expand-accelerators interface
  • platforms.rkt Change names to platform-impl-cost and platform-impl-repr
  • plugin.rkt Change internals module exports to match accelerator changes

Copy link
Contributor

@pavpanchekha pavpanchekha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few issues. Didn’t review accelerators changes, I see that as “unstable” and the platforms team can go wild with the API.

:precision ,(table-row-precision row)
:herbie-conversions ,(table-row-conversions row)
,@(if (eq? (table-row-pre row) 'TRUE) '() `(:pre ,(table-row-pre row)))
,@(if (equal? (table-row-preprocess row) empty) '() `(:herbie-preprocess ,(table-row-preprocess row)))
,@(if (table-row-target-prog row) `(:alt ,(table-row-target-prog row)) '())
,(table-row-output row)))
,@(if (table-row-target-prog row) `(:herbie-target ,(table-row-target-prog row)) '())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don’t think this is right, we just switched to :alt

src/syntax/type-check.rkt Outdated Show resolved Hide resolved
@pavpanchekha
Copy link
Contributor

Any idea why test are failing? Also merge main so nightlies can pass, before we merge.

Comment on lines +128 to +132
(define-accelerator (expm1 real) real (lambda (x) (- (exp x) 1)))
(define-accelerator (log1p real) real (lambda (x) (log (+ 1 x))))
(define-accelerator (hypot real real) real (lambda (x y) (sqrt (+ (* x x) (* y y)))))
(define-accelerator (fma real real real) real (lambda (x y z) (+ (* x y) z)))
(define-accelerator (erfc real) real (lambda (x) (- 1 (erf x))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This lost the ability to provide interval versions, like ival-log1p. This is what's causing the test failures. There are a two possible fixes:

  • The most expedient fix is to bring that capability back, it's not hard.
  • The longer but eventually better fix is to desugar accelerators on the way into sampling, and then sugar them back inside sampling. This is the long-term plan in sampling.
    Luckily we can do both at once, so I say @broughjt you do the first one and I'll work on the second.

@pavpanchekha
Copy link
Contributor

I think this is good, now that it's passing tests? I'd like to merge it if possible.

Comment on lines +56 to +57
(define spec1 (expand-accelerators (prog->spec p1)))
(define spec2 (expand-accelerators (prog->spec p2)))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, this is fine but not ideal—if you write a benchmark with expm1 in it Herbie might fail to sample it.

I guess this isn't the end of the world and we can merge now and wait for some later time to fix this properly.

(for ([pt points])
(with-check-info (['point (map list fv pt)])
(define v1 (apply prog1 pt))
(define v2 (apply prog1 pt))
(define v2 (apply prog2 pt))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lololol

@pavpanchekha
Copy link
Contributor

Any reason we're not merging?

@pavpanchekha
Copy link
Contributor

I looked at the most recent nightly run and the "simple fma test" and "Given's rotation SVD example, simplified" benchmarks are different. Notably these are the two benchmarks that use accelerators in the spec. So something there is still going wrong.

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

Successfully merging this pull request may close these issues.

None yet

2 participants