Skip to content

Commit 021ae4a

Browse files
committed
Merge remote-tracking branch 'origin/main' into spec-split
# Conflicts: # src/api/run.rkt # src/syntax/platform.rkt # src/syntax/read.rkt
2 parents 4bbd5d2 + 65090f0 commit 021ae4a

40 files changed

Lines changed: 1214 additions & 288 deletions

AGENTS.md

Lines changed: 28 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
11

2+
# Structure
3+
4+
- `src/core` has key algorithms and `src/syntax` key concepts; these
5+
are the most critical and highest value parts of the project. Should
6+
be fast and effective, complex algorithms could well be worth it.
7+
- `src/core/explain.rkt` and `src/core/localize.rkt` are sorta-kinda
8+
deprecated. Keep them working, but can get slower or worse.
9+
- The rest of `src` is, conceptually, glue code. Simple is best,
10+
optimize for maintainability. All of `src` goes through human code
11+
review and should match surrounding style.
12+
- Modules layer `utils < syntax < core < reports < api`. Lower layers
13+
do not import higher layers.
14+
- `infra/` is for development only. Some code in there is abandon-ware
15+
of AI-written and unreviewed. Don't reference for code style and not
16+
all features in there are actually used. Changing users often easier
17+
than code heroics.
18+
219
# Formatting
320

421
- Use `map` over `for/list` only if it avoids a `lambda`.
@@ -7,45 +24,43 @@
724
- Do not code defensively. Do not do runtime type checks or fallback.
825
Prefer to examine all callers to establish types, or if they can
926
differ prefer `match` with explicit patterns for all cases, to
10-
ensure that an unanticipated values at any point cause errors.
27+
ensure that unanticipated value cause explicit errors.
1128
- Format Racket code with `make fmt` at the top level.
1229
- Check `git diff` and delete dead code before finishing a task.
1330
- Update docs in `www/doc/2.3/` if you change user-visible options.
14-
- Enforce module layering `utils < syntax < core < reports < api`: do not add imports from a lower layer to a higher layer.
1531

1632
# Testing
1733

1834
- If you change the Herbie core, test that your changes work with
1935
`racket src/main.rkt report bench/tutorial.fpcore tmp`. This should
2036
take about 5-10 seconds and all of the tests should pass with
2137
perfect accuracy. You can also use other benchmark suites if asked.
22-
- If you need to store two reports name the folders `tmp-X` for some X.
2338
- Arguments come after the word `report` before any other arguments.
24-
- Herbie prints a seed every time it runs; you can pass `--seed N`
25-
after the "report" argument to fix the seed reproducibly.
26-
- You can pass `--timeout T` to time out a benchmark after T seconds.
27-
- After running tests, `tmp` will have one directory per benchmark.
39+
- Herbie prints a seed every time it runs; pass `--seed N` for
40+
reproducibility.
41+
- Pass `--timeout T` to time out a benchmark after T seconds.
2842
Each has a detailed `graph.html`, including tracebacks for crashes.
43+
- After running tests, `tmp` will have one directory per benchmark.
44+
- For multiple reports name the folders `tmp-<whatever>`.
2945
- The default e-graph backend is `egg`; pass `--enable generate:egglog`
30-
to enable the `egglog` backend. You may need to add `~/.cargo/bin`
31-
to the `PATH`.
46+
to enable the `egglog` backend.
3247
- Some files have unit tests; run them with `raco test <file>`.
3348

3449
# Observability
3550

36-
- `jq` is installed, use it
3751
- If you're investigating a single benchmark, copy it to a file named
3852
`test.fpcore` and run just that file.
3953
- Herbie runs output a `tmp/<benchmark>/timeline.json` with rich
4054
observability data for each benchmark.
41-
- A timeline is a list of phases, each a map from key to "table",
55+
- This timeline is a list of phases, each a map from key to "table",
4256
each table is a list of fixed-length arrays.
4357
- Timeline types are defined in `src/utils/timeline.rkt`; HTML
4458
generation is defined in `src/reports/timeline.rkt`.
4559
- Add to the timeline with `(timeline-push! 'type val1 val2 ...)`. The
4660
`val`s must be JSON-compatible, so convert symbols to strings.
47-
- Herbie runs generates a profile in `tmp/<benchmark>/profile.json`.
61+
- Herbie runs generate a profile in `tmp/<benchmark>/profile.json`.
4862
- You can also dump GC/memory data to `dump-trace.json` with `--enable
4963
dump:trace`, Rival commands with `--enable dump:rival`, and egglog
5064
commands with `--enable dump:egglog`. Dumps go in `dump-XXX` in the
51-
current directory. Clean that directory when done.
65+
current directory. New runs *add files* to those directories, so
66+
clean up when done.

bench/hamming/series.fpcore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
:alt
5858
(! :herbie-platform c
5959
(+ (/ 1 a) (/ 1 b)))
60+
:alt
61+
(! :herbie-platform c
62+
(+ eps (+ (/ (if (== (* a eps) 0) 1 (/ (* eps a) (expm1 (* eps a)))) a)
63+
(/ (if (== (* b eps) 0) 1 (/ (* eps b) (expm1 (* eps b)))) b))))
6064

6165
(/
6266
(* eps (- (exp (* (+ a b) eps)) 1))

0 commit comments

Comments
 (0)