haskell / primitive

This package provides various primitive memory-related operations.
Other
114 stars 58 forks source link

cmm / min ghc version / uniform APIS #252

Open cartazio opened 5 years ago

cartazio commented 5 years ago

@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.

https://github.com/ghc/ghc/commit/5f48b24b303326599147223c64b10b0cfb016a48 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 commented 5 years ago

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

RyanGlScott commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

@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 commented 5 years ago

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

RyanGlScott commented 5 years ago

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:

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.