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

ppc-symbolic: Indexes for registers #445

Merged
merged 5 commits into from
Sep 26, 2024
Merged

ppc-symbolic: Indexes for registers #445

merged 5 commits into from
Sep 26, 2024

Conversation

langston-barrett
Copy link
Contributor

Like #444, but for PPC.

@langston-barrett langston-barrett self-assigned this Sep 25, 2024
@langston-barrett langston-barrett marked this pull request as ready for review September 25, 2024 20:55
@langston-barrett
Copy link
Contributor Author

Huh, GHC 9.8 yields:

Error: cabal: Failed to build macaw-ppc-symbolic-0.1.0.0 (which is required by
test:macaw-ppc-symbolic-tests from macaw-ppc-symbolic-0.1.0.0). The build
process was killed (i.e. SIGKILL). The typical reason for this is that there
is not enough memory available (e.g. the OS killed a process using lots of
memory).

@RyanGlScott
Copy link
Contributor

Wow. I thought maybe that this was a CI fluke, but no: it's very reproducible. I can even reproduce it locally with my (fairly powerful) laptop.

The problem arises when compiling the MS.updateReg = archUpdateReg fields of GenArchVals in the GenArchInfo instnaces for AnyPPC V32 or AnyPPC V64 in Data.Macaw.Symbolic.PPC. Interestingly, if you mark Regs.updateReg as INLINE:

diff --git a/macaw-ppc-symbolic/src/Data/Macaw/PPC/Symbolic/Regs.hs b/macaw-ppc-symbolic/src/Data/Macaw/PPC/Symbolic/Regs.hs
index 3aeafb81..0931ff40 100644
--- a/macaw-ppc-symbolic/src/Data/Macaw/PPC/Symbolic/Regs.hs
+++ b/macaw-ppc-symbolic/src/Data/Macaw/PPC/Symbolic/Regs.hs
@@ -427,6 +427,7 @@ lookupReg r asgn =
     Nothing -> X.throwM (MissingRegisterInState (Some r))
     Just pair -> return (asgn Ctx.! MSB.crucibleIndex pair)
 
+{-# INLINE updateReg #-}
 updateReg :: forall v ppc m f tp
            . (MP.KnownVariant v,
                ppc ~ MP.AnyPPC v,

Then the problem goes away. Hm...

@langston-barrett
Copy link
Contributor Author

Yeah, I also see this locally with GHC 9.8. Seems like a regression in the compiler?

@langston-barrett
Copy link
Contributor Author

@RyanGlScott Are you good with merging this with the INLINE workaround, or would you like for us to do some additional digging into what exactly caused this compiler performance issue?

@RyanGlScott
Copy link
Contributor

I did spend some time attempting to minimize the issue, but I was ultimately unsuccessful. I do think that this is worth reporting upstream to GHC, so I've opened https://gitlab.haskell.org/ghc/ghc/-/issues/25301 to track this. That being said, I don't think we should wait until that is fixed before proceeding.

Could you cite this GHC issue in the comments next to updateReg? Then I think this would be ready to land.

@langston-barrett langston-barrett merged commit 30b4579 into master Sep 26, 2024
4 checks passed
@langston-barrett langston-barrett deleted the lb/ppc-regs branch September 26, 2024 20:25
RyanGlScott added a commit that referenced this pull request Dec 5, 2024
RyanGlScott added a commit that referenced this pull request Dec 10, 2024
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.

2 participants