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

cmm / min ghc version / uniform APIS #252

Open
cartazio opened this issue Jun 3, 2019 · 6 comments
Open

cmm / min ghc version / uniform APIS #252

cartazio opened this issue Jun 3, 2019 · 6 comments
Labels
enhancement task Something that needs to be done (not a bug fix)

Comments

@cartazio
Copy link
Contributor

cartazio commented Jun 3, 2019

@RyanGlScott @andrewthad
I'm thinking that it'd be nice to avoid having ghc version conditional apis, and I then realized most of the operation differences are out of line CMM primops.

ghc/ghc@5f48b24 makes em think >=7.8 ghc lower bound on build plans would be induced if we wanna do high level / sane CMM hackery , not sure, though explicit ABI / low level cmm may be needed depending on how we want large / bulk operations to interact with the scheduler

@cartazio
Copy link
Contributor Author

cartazio commented Jun 3, 2019

tldr; cmm :)
i can totes do that hackery, would be nice to have zero conditional exports

@RyanGlScott
Copy link
Member

I have approximately zero experience with bundling CMM in Haskell libraries, so I doubt I can be much help here. If it works, however, that would be a huge win. I think it would justify the price tag of requiring a lower bound on GHC of >=7.8 (if it does come to that).

@chessai
Copy link
Member

chessai commented Jun 3, 2019

I know @ekmett has experience with bunding cmm with haskell. Perhaps he may have some insight into how we should approach this/the doability of it?

@cartazio
Copy link
Contributor Author

cartazio commented Jun 3, 2019

@chessai i'm comfortable with cmm :), i'm happy to do the hacking

@chessai / @RyanGlScott what i could use some help with is

  1. which current apis are conditional
  2. which ones should we add that we've avoided because they require TOO new a primop (eg ghc head or whatever, i dont care :) )

@cartazio
Copy link
Contributor Author

cartazio commented Jun 3, 2019

(i want to make sure we have a coherent list to track so i dont lose the plot)

@RyanGlScott
Copy link
Member

RyanGlScott commented Jun 3, 2019

It's quite straightforward to calculate the list of functions that satisfy (1)—just look at everything that's guarded behind #if __GLASGOW_HASKELL__ ... #endif in an export list. By my count, that's:

  • copyPtrToMutablePrimArray in Data.Primitive.Ptr
  • copyByteArrayToAddr, copyMutableByteArrayToAddr, isByteArrayPinned, and isMutableByteArrayPinned in Data.Primitive.ByteArray (as well as the upcoming shrinkMutableByteArray)
  • shrinkMutablePrimArray, copyPrimArrayToPtr, and copyMutablePrimArrayToPtr in Data.Primitive.PrimArray

There's also some functions that are exported on all versions of GHC that primitive supports but are slightly less efficient on old versions of GHC due to lacking certain primops. I'll defer the task of discovering all of those functions for a later day, since they're arguably lower priority.

As for (2), I'm not sure if we've ever deliberately chose not to add something because of a dependency on new GHC features.

@cartazio cartazio added enhancement task Something that needs to be done (not a bug fix) labels Jul 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement task Something that needs to be done (not a bug fix)
Projects
None yet
Development

No branches or pull requests

3 participants