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

Benchmarking #768

Closed
wants to merge 5 commits into from
Closed

Benchmarking #768

wants to merge 5 commits into from

Conversation

min-nguyen
Copy link
Collaborator

@min-nguyen min-nguyen commented Sep 27, 2023

I've gone for something like this for the graph-based EvalGaloisConnection, where we abstract away the concrete and terms into functions that directly operate on them.

type EvalGaloisConnection g a b = GaloisConnection a b
   ( selecte𝔹 :: a -> Expr 𝔹
   , selectv𝔹 :: b -> Val 𝔹
   , runδv :: (Val 𝔹 -> Val 𝔹) -> b
   , g :: g
   )

graphGC { g, n, γα } e = do
   (g' × _) ××<- do
      runWithGraphAllocT (g × n) $ do<- alloc e
         vα <- eval γα eα S.empty
         pure (eα × vα)
   let
      selecte𝔹 αs = select𝔹s eα αs
      selectv𝔹 αs = select𝔹s vα αs
      runδv δv = selectαs (δv (botOf vα)) vα
      fwd αs = G.vertices (fwdSlice αs g') `intersection` vertices vα
      bwd αs = G.vertices (bwdSlice αs g') `intersection` sinks g'
   pure { selecte𝔹, selectv𝔹, runδv, g: g', fwd, bwd }

This removes some repeated references to and in Test.Util. You can now also write something like:

  e <- desug s
  gc <- graphGC gconfig e

  let e𝔹_all = (gc.selecte𝔹 <<< gc.bwd <<< gc.runδv) topOf

I'm afraid we can't always write things compositionally like this though (sometimes we want the intermediate results, like αs_out). What are your thoughts?

@min-nguyen min-nguyen requested a review from rolyp September 27, 2023 09:44
@min-nguyen min-nguyen closed this Sep 27, 2023
@rolyp rolyp deleted the benchmarking branch September 27, 2023 14:59
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.

1 participant