summaryrefslogtreecommitdiff
path: root/rts/Sparks.h
Commit message (Collapse)AuthorAgeFilesLines
* nonmoving: Fix collection of sparksBen Gamari2020-03-091-1/+1
| | | | | | | | | | Previously sparks living in the non-moving heap would be promptly GC'd by the minor collector since pruneSparkQueue uses the BF_EVACUATED flag, which non-moving heap blocks do not have set. Fix this by implementing proper support in pruneSparkQueue for determining reachability in the non-moving heap. The story is told in Note [Spark management in the nonmoving heap].
* cpp: Use #pragma once instead of #ifndef guardsBen Gamari2017-04-231-4/+1
| | | | | | | | | | | | | | This both says what we mean and silences a bunch of spurious CPP linting warnings. This pragma is supported by all CPP implementations which we support. Reviewers: austin, erikd, simonmar, hvr Reviewed By: simonmar Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3482
* Use C99's boolBen Gamari2016-11-291-4/+4
| | | | | | | | | | | | Test Plan: Validate on lots of platforms Reviewers: erikd, simonmar, austin Reviewed By: erikd, simonmar Subscribers: michalt, thomie Differential Revision: https://phabricator.haskell.org/D2699
* Remove comments and flag for GranSimThomas Miedema2015-03-191-1/+1
| | | | | | | | | The GranSim code was removed in dd56e9ab and 297b05a9 in 2009, and perhaps other commits I couldn't find. Reviewed By: austin Differential Revision: https://phabricator.haskell.org/D737
* Revert "rts: add Emacs 'Local Variables' to every .c file"Simon Marlow2014-09-291-8/+0
| | | | This reverts commit 39b5c1cbd8950755de400933cecca7b8deb4ffcd.
* rts: add Emacs 'Local Variables' to every .c fileAustin Seipp2014-07-281-0/+8
| | | | | | | | This will hopefully help ensure some basic consistency in the forward by overriding buffer variables. In particular, it sets the wrap length, the offset to 4, and turns off tabs. Signed-off-by: Austin Seipp <austin@well-typed.com>
* Move allocation of spark pools into initCapabilityDuncan Coutts2011-07-181-1/+1
| | | | | | Rather than a separate phase of initSparkPools. It means all the spark stuff for a capability is initialisaed at the same time, which is then becomes a good place to stick an initial spark trace event.
* Fix wrong arg name in a C function prototypeDuncan Coutts2011-07-181-1/+1
|
* Classify overflowed sparks separatelyDuncan Coutts2011-07-181-0/+1
| | | | | | | | | | | When you use `par` to make a spark, if the spark pool on the current capability is full then the spark is discarded. This represents a loss of potential parallelism and it also means there are simply a lot of sparks around. Both are things that might be of concern to a programmer when tuning a parallel program that uses par. The "+RTS -s" stats command now reports overflowed sparks, e.g. SPARKS: 100001 (15521 converted, 84480 overflowed, 0 dud, 0 GC'd, 0 fizzled)
* Use a struct for the set of spark countersDuncan Coutts2011-07-181-0/+9
|
* Change tryStealSpark so it does not consume fizzled sparksDuncan Coutts2011-07-181-1/+22
| | | | | We want to count fizzled sparks accurately. Now tryStealSpark returns fizzled sparks, and the callers now update the fizzled spark count.
* Improve the newSpark dud test by using the pointer tag bitsDuncan Coutts2011-07-181-0/+7
| | | | | | | | newSpark() checks if the spark is a dud, and if so does not add it to the spark pool. Previously, newSpark would discard the pointer tag bits and just check closure_SHOULD_SPARK(p). We can take advantage of the tag bits which can tell us if the pointer points to a value. If it is, it's a dud spark and we don't need to add it to the spark pool.
* Fix the symbol visibility pragmasSimon Marlow2010-06-171-2/+2
|
* Make sparks into weak pointers (#2185)Simon Marlow2010-05-251-1/+1
| | | | | The new strategies library (parallel-2.0+, preferably 2.2+) is now required for parallel programming, otherwise parallelism will be lost.
* Omit visibility pragmas on Windows (fixes warnings/validate failures)Simon Marlow2009-09-091-2/+2
|
* Declare RTS-private prototypes with __attribute__((visibility("hidden")))Simon Marlow2009-08-051-0/+4
| | | | | | | | | | This has no effect with static libraries, but when the RTS is in a shared library it does two things: - it prevents the function from being exposed by the shared library - internal calls to the function can use the faster non-PLT calls, because the function cannot be overriden at link time.
* Remove old GUM/GranSim codeSimon Marlow2009-06-021-4/+0
|
* Refactor the spark queue implementation into a generic work-stealing dequeSimon Marlow2009-02-051-68/+22
| | | | So we can use this abstraction elsewhere in the RTS
* we shouldn't update topBound in discardSparks()Simon Marlow2008-11-211-1/+2
|
* Remove incorrect assertions in steal()Simon Marlow2008-11-191-1/+6
|
* fix ASSERT_SPARK_POOL_INVARIANTS(): top>bottom is validSimon Marlow2008-11-061-3/+5
|
* Run sparks in batches, instead of creating a new thread for each oneSimon Marlow2008-11-061-2/+2
| | | | | Signficantly reduces the overhead for par, which means that we can make use of paralellism at a much finer granularity.
* traverse the spark pools only once during GC rather than twiceSimon Marlow2008-10-221-1/+1
|
* Refactoring and reorganisation of the schedulerSimon Marlow2008-10-221-31/+46
| | | | | | | | | | | | | | | | | Change the way we look for work in the scheduler. Previously, checking to see whether there was anything to do was a non-side-effecting operation, but this has changed now that we do work-stealing. This lead to a refactoring of the inner loop of the scheduler. Also, lots of cleanup in the new work-stealing code, but no functional changes. One new statistic is added to the +RTS -s output: SPARKS: 1430 (2 converted, 1427 pruned) lets you know something about the use of `par` in the program.
* Work stealing for sparksberthold@mathematik.uni-marburg.de2008-09-151-27/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | Spark stealing support for PARALLEL_HASKELL and THREADED_RTS versions of the RTS. Spark pools are per capability, separately allocated and held in the Capability structure. The implementation uses Double-Ended Queues (deque) and cas-protected access. The write end of the queue (position bottom) can only be used with mutual exclusion, i.e. by exactly one caller at a time. Multiple readers can steal()/findSpark() from the read end (position top), and are synchronised without a lock, based on a cas of the top position. One reader wins, the others return NULL for a failure. Work stealing is called when Capabilities find no other work (inside yieldCapability), and tries all capabilities 0..n-1 twice, unless a theft succeeds. Inside schedulePushWork, all considered cap.s (those which were idle and could be grabbed) are woken up. Future versions should wake up capabilities immediately when putting a new spark in the local pool, from newSpark(). Patch has been re-recorded due to conflicting bugfixes in the sparks.c, also fixing a (strange) conflict in the scheduler.
* Separate pruning from marking of spark poolsSimon Marlow2008-09-091-1/+1
| | | | Fixes crash when using compacting GC in parallel programs
* Undo fix for #2185: sparks really should be treated as rootsSimon Marlow2008-07-231-1/+1
| | | | | Unless sparks are roots, strategies don't work at all: all the sparks get GC'd. We need to think about this some more.
* fix bug in sparkPoolSize (affects debug output only)Simon Marlow2008-07-231-1/+1
|
* FIX #2185: sparks should not be treated as roots by the GCSimon Marlow2008-04-241-26/+3
|
* Reorganisation to fix problems related to the gct register variableSimon Marlow2008-04-161-0/+1
| | | | | | | | | - GCAux.c contains code not compiled with the gct register enabled, it is callable from outside the GC - marking functions are moved to their relevant subsystems, outside the GC - mark_root needs to save the gct register, as it is called from outside the GC
* move markSparkQueue into GC.c, as it needs the register variable definedSimon Marlow2008-01-091-1/+0
|
* have each GC thread call GetRoots()simonmar@microsoft.com2007-12-131-1/+1
|
* Free various things we allocateIan Lynagh2006-12-151-0/+1
|
* move newSpark() prototype to RtsExternal.h to avoid warningsSimon Marlow2006-11-071-4/+0
|
* Reorganisation of the source treeSimon Marlow2006-04-071-0/+104
Most of the other users of the fptools build system have migrated to Cabal, and with the move to darcs we can now flatten the source tree without losing history, so here goes. The main change is that the ghc/ subdir is gone, and most of what it contained is now at the top level. The build system now makes no pretense at being multi-project, it is just the GHC build system. No doubt this will break many things, and there will be a period of instability while we fix the dependencies. A straightforward build should work, but I haven't yet fixed binary/source distributions. Changes to the Building Guide will follow, too.