[GHC] #8972: Investigate adding fast compare-and-swap Int type/primops

GHC ghc-devs at haskell.org
Thu Apr 24 19:07:00 UTC 2014


#8972: Investigate adding fast compare-and-swap Int type/primops
-------------------------------------+------------------------------------
        Reporter:  tibbe             |            Owner:  tibbe
            Type:  feature request   |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.9
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:  8157, 7883
-------------------------------------+------------------------------------

Comment (by jberryman):

 Replying to [comment:6 rrnewton]:

 > By the way, I started peeking at the benchmark code.  I don't have a
 good sense currently of how many cycles each of the following takes in
 practice:
 >
 >  * between a forkIO and the new thread waking up on another CPU.

 .......

 >  * between two forkIO's from a parent thread waking up (gang synchrony)

 Good question! Don't have enough cores on my real machine to look at that
 right now.

 >  * delta between two threads blocked on the same MVar waking up
 >
 > I noticed the third method used in MainN.hs and I think this is very
 standard.  However, I wonder if it is worth having all the test threads
 busy-wait on a memory location to start with a greater degree of
 synchrony.  That way we can have them run for exactly the same time
 interval and maximize contention over the whole time period ;-).

 I think that's a good idea. I started doing that in later
 tests/benchmarks: pass an `IORef Int` to each forked thread, each thread
 increments the ref and then busy-waits until the counter reaches the
 target.

 >
 > In any case, these benchmarks are great.  I'd like to run these on a few
 different machines with our nightly benchmarking stuff.  I read the README
 but I can't currently build the benchmarks because I don't have chan-
 split-fast -- where is that?

 Sorry, this whole project is really just my personal messy scratchwork;
 even the README is just personal notes that are out of date anyway, and I
 should probably just remove it. You'll have a hard time building it for a
 number of reasons, and might have better luck just copy-pasting what looks
 interesting. I'm happy to help extract and clean up any of them that
 you're interested in.

 >
 > P.S. We currently accumulate benchmark data into Google Fusion Tables
 (but we'd like to switch to Big Query or Cloud SQL or something).
 HSBencher does the upload, but it doesn't yet integrate with criterion
 well.  It's more focused on long-running (parallel) benchmarks rather than
 statistically significant sampling of short runs.  Still, adding support
 for consuming criterion reports would be great.

 Oh cool, I'd like to look into how you're doing all that. Yeah I was
 initially nervous about using criterion for these kinds of benchmarks
 (involving concurrency) but it's actually worked really well, and seeing
 the distributions has been really enlightening.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8972#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list