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

Give evaluator acces to inscope let-bindings #2571

Merged
merged 3 commits into from
Nov 3, 2023

Conversation

christiaanb
Copy link
Member

Without it, Clash goes into an infinite loop on T1354A in combination with: clash-lang/ghc-typelits-knownnat#47

There is a tiny performance regression.

Before:

$ cabal run clash-benchmark-normalization -- examples/Reducer.hs --time-limit 30
GHC: Setting up GHC took: 0.489s
GHC: Compiling and loading modules took: 1.125s
Clash: Parsing and compiling primitives took 0.159s
benchmarking normalization of examples/Reducer.hs
time                 684.4 ms   (674.0 ms .. 694.0 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 680.6 ms   (674.9 ms .. 684.7 ms)
std dev              8.784 ms   (4.641 ms .. 12.23 ms)
variance introduced by outliers: 11% (moderately inflated)

after:

$ cabal run clash-benchmark-normalization -- examples/Reducer.hs --time-limit 30
GHC: Setting up GHC took: 0.496s
GHC: Compiling and loading modules took: 1.135s
Clash: Parsing and compiling primitives took 0.157s
benchmarking normalization of examples/Reducer.hs
time                 696.5 ms   (689.5 ms .. 711.9 ms)
                     1.000 R²   (0.999 R² .. 1.000 R²)
mean                 687.1 ms   (679.4 ms .. 692.8 ms)
std dev              11.01 ms   (8.152 ms .. 15.16 ms)
variance introduced by outliers: 11% (moderately inflated)

@leonschoorl
Copy link
Member

When you rebase that ffi:example failure should now be solved

Base automatically changed from fix_benchmark to master August 29, 2023 14:22
where
localBinders acc [] = acc
localBinders !acc (h:hs) = case h of
-- LetBinding _ ls -> localBinders (acc <> mkVarEnv ls) hs
Copy link
Member

Choose a reason for hiding this comment

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

Remove or add this case

GHC 9.4+ differentiates between regular unfoldings and unfoldings
of loop breakers. Previously we wouldn't load unfoldings of loop
breakers, unintentionally marking them as primitives. Now we load
all unfoldings from interface files, even loop breakers.
Without it, Clash goes into an infinite loop on T1354A in
combination with:

clash-lang/ghc-typelits-knownnat#47
It generates core that pattern matches on the constructor of the
Index data type. This can mess up certain parts of the Clash
compiler.
@christiaanb christiaanb merged commit 1323074 into master Nov 3, 2023
13 checks passed
@christiaanb christiaanb deleted the eval_inscope_let_bindings branch November 3, 2023 14:37
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.

3 participants