Commit Graph

546 Commits

Author SHA1 Message Date
Michael Walker
858f286e05 Move defaults from Test.DejaFu.SCT to Test.DejaFu. 2017-02-20 02:08:38 +00:00
Michael Walker
a240b48d1f Generalise all dejafu*' functions to work with any Way. 2017-02-20 02:05:19 +00:00
Michael Walker
bc8b123cdd Add an abstraction over 'sctBound' and 'sctRandom'. 2017-02-20 01:50:12 +00:00
Michael Walker
6c8ef4ca09 Implement a weighted random scheduler. 2017-02-20 01:03:18 +00:00
Michael Walker
c06615b001 Merge 'sctBound' and 'sctBounded'. 2017-02-20 00:45:51 +00:00
Michael Walker
75d2b6ca73 Merge branch 'subconcurrency' 2017-02-18 20:45:15 +00:00
Michael Walker
0fd9ea7613 Avoid some allocation.
A few notes:

- The removal of the `preEmps` stuff from `findSchedulePrefix`:

    This has been in dejafu from near the beginning, on the assumption
    that it was somehow an optimisation which would lead to a more
    efficient exploration of the schedules. I can't really remember
    the original justification. Well, it's not, it's actually a huge
    pessimisation.

- The removal of the `pruneCommits` stuff from `sctBounded`:

    Another algorithmic "optimisation" that is actually a large
    pessimisation! Past-barrucadu should be ashamed. It's conceivable
    that `pruneCommits` is a win in programs which have a large
    amount of relaxed memory *and* synchronised stuff going on, but I
    can't really think of such a use-case.

- The un-tupling of `dependency` and `updateDepState`:

    This makes me sad. I find the tuples to be good extra
    documentation in the types, as the things which were paired
    logically go together and shouldn't be separated. However, the
    tuples were constructed at the call-site, and deconstructed in the
    body, so the allocation was just a waste.

- Catenating lists:

    If the order doesn't matter, then it's better to put the shorter
    list first, this is because the spine of the first argument to
    `(++)` gets reallocated. Even better, rewrite the code to not
    concat: can it operate on the list of lists directly?

- Data structures as control structures:

    It's often said that in Haskell we use laziness to let us use data
    structures as control structures. This is true, but don't use it
    as an excuse to write really naive code and just trust the data
    structures to magically make everything better for us!

- Not forcing full evaluation in the DPOR scheduler:

    This was definitely a win at one time, avoiding a huge
    multi-gigabyte space leak. Laziness is a fickle beast, however,
    and this is no longer a win.

    As the NFData instances are no longer used anywhere, they are
    removed and the deepseq dependency is dropped.

- Inline inner loops:

    (this may be an effect of compiling with profiling messing up the
    inliner)

    If a small function is used as the inner "loop" of a recursive
    definition, try sticking an `{-# INLINE ... #-}` pragma on
    it. Allocation seems to go up a little but time tends to go down
    more.

Net effect of this commit on the execution of dejafu-tests, compiled
with profiling, on my desktop:

Before:

> total time  = 298.20 secs   (298199 ticks @ 1000 us, 1 processor)
> total alloc = 111,135,182,008 bytes  (excludes profiling overheads)

After:

> total time  = 140.70 secs   (140702 ticks @ 1000 us, 1 processor)
> total alloc = 46,653,034,384 bytes  (excludes profiling overheads)
2017-02-18 17:30:43 +00:00
Michael Walker
df82f42d5f Don't infer SCT dependencies across subconcurrency boundaries. 2017-02-08 15:00:55 +00:00
Michael Walker
39b1fe0c80 Inline most of stepThread. 2017-02-05 15:37:40 +00:00
Michael Walker
9e4d808d54 Refactor runThreads to allocate fewer lists. 2017-02-02 22:03:59 +00:00
Michael Walker
a77a4d83a9 Refactor runThreads and stepThreads to use a context record. 2017-02-02 21:33:18 +00:00
Michael Walker
5114fd37a1 Make things monomorphic over the STM type.
Only `STMLike n r` is used, so passing around the type variable and
STM runner is just noise.
2017-02-02 14:45:24 +00:00
Michael Walker
1b0adc541d tid /= initialThread is only possible if M.size threads > 1 2017-02-02 14:37:08 +00:00
Michael Walker
8fd3e5900b Messy implementation of subconcurrency.
This makes `stepThread` messier, and doesn't actually prevent nesting
currently - although it does prevent usage when there are multiple
threads, which may be enough.
2017-02-02 12:26:40 +00:00
Michael Walker
68e2372cfc Skeleton implementation of subconcurrency: always fails. 2017-02-02 02:23:25 +00:00
Michael Walker
26b5b26900 Detect some missing CRef dependencies. 2017-01-13 01:43:00 +00:00
Michael Walker
f48b462a07 Merge pull request #60 from barrucadu/merge-dpor
Merge dpor into dejafu
2016-12-05 09:18:31 +00:00
Michael Walker
7101eefecb Unexport some things. 2016-12-05 07:48:27 +00:00
Michael Walker
ad4d6aa07e Specialise and partially-evaluate SCT.Internal functions. 2016-12-05 07:48:27 +00:00
Michael Walker
bc98b422bb Skip testing old dejafu versions.
Also make sure concurrency builds before trying dejafu.
2016-12-05 07:48:19 +00:00
Michael Walker
5accde895e Specialise types in 'Test.DPOR.Internal' and rename.
This breaks backwards compatibility, as things which were polymorphic
are no longer.
2016-12-05 07:36:00 +00:00
Michael Walker
1fc5aa5565 Rename 'Test.DPOR.Schedule' to 'Test.DejaFu.Schedule' 2016-12-05 07:36:00 +00:00
Michael Walker
db5d5cda17 Merge 'Test.DPOR' with 'Test.DejaFu.SCT'. 2016-12-05 07:35:59 +00:00
Michael Walker
0418f28507 Drop 'Test.DPOR.Random' module. 2016-12-05 07:35:59 +00:00
Michael Walker
f684320fc7 Merge dpor into dejafu. 2016-12-05 07:35:56 +00:00
Michael Walker
49ab3aa8fa Document necessity of 'tryDaemons', and simplify. 2016-12-04 19:04:37 +00:00
Michael Walker
d794a7ea0d (travis) fetch GHC with stack. 2016-10-22 16:02:31 +01:00
Michael Walker
be5c51df3d HUnit-1.4/5 compat. 2016-10-22 14:36:10 +01:00
Michael Walker
7b75c5f0b5 Build on travis with lts-7. 2016-09-16 01:55:32 +01:00
Michael Walker
51e4cb51aa I accidentally a word. 2016-09-10 13:58:59 +01:00
Michael Walker
78834ca770 Document why to use concurrency over alternatives. 2016-09-10 12:39:34 +01:00
Michael Walker
a0181bde42 Document transformer instance behaviour with fork. 2016-09-10 12:25:34 +01:00
Michael Walker
c4884badb8 Don't include thread 0 in the key. 2016-08-29 18:34:27 +01:00
Michael Walker
e1162dc033 Add missing module headers to {hunit,tasty}-dejafu. 2016-08-26 11:16:59 +01:00
Michael Walker
2065253f73 More comprehensive README. 2016-08-26 00:06:59 +01:00
Michael Walker
8d6cdb6aff Traces include thread names now. 2016-08-25 17:22:34 +01:00
Michael Walker
cb17a19add More descriptive summary for "concurrency" package. 2016-08-25 16:57:21 +01:00
Michael Walker
373ba952ca Sub "MVar" for "CVar" in a comment. 2016-08-25 16:56:58 +01:00
Michael Walker
ccb6d5e5d8 Merge pull request #56 from barrucadu/dejafu-0.4
Merge dejafu-0.4 branch
2016-08-25 14:23:02 +01:00
Michael Walker
75fbad38a1 Rename Deterministic to Conc.
Closes #45
2016-07-21 19:33:49 +01:00
Michael Walker
97a06c7094 Bump default GHC version to 8 2016-07-21 19:33:49 +01:00
Michael Walker
6788274f7f async-dejafu now requires dejafu-0.4 2016-07-21 19:33:49 +01:00
Michael Walker
2f0f51ceb6 Split concurrency modules into a separate package.
The new 'concurrency' package is starting at version 1.0.0.0 because the
API is already very mature (copied from base).

This breaks the dejafu-0.2 compatibility of async-dejafu.

Closes #51.
2016-07-21 19:33:49 +01:00
Michael Walker
f3c546f591 Add a non-monadic peekTicket'
Also removes the APeekTicket/PeekTicket/WillPeekTicket constructors.
2016-07-21 19:33:49 +01:00
Michael Walker
b47e95735c Drop TH boilerplate functions and lineNum.
The TH boilerplate was really fragile, and by dropping lineNum as well
the entire template-haskell dependency can be dropped. This is a small
sacrifice, as the name needed to be passed in explicitly anyway, and
there are probably more meaningful names than just the line number.
2016-07-21 19:33:49 +01:00
Michael Walker
fe251512f5 Make autocheck' functions take the schedule bounds
Closes #47.
2016-07-21 19:33:49 +01:00
Michael Walker
43b2dd3913 Make runTestIO monad-polymorphic
This + 7652ad5, 77aec63, 9375a61 closes #44.
2016-07-21 19:33:49 +01:00
Michael Walker
2aa2b8f447 Unify IO and ST instances
Closes #44
2016-07-21 19:33:49 +01:00
Michael Walker
c742da2bfd Drop _concKnows stuff and fix litmus tests.
Removing the stuff broke some of the litmus tests, which is bad. It
probably means that those actions were being put into sleep sets, and so
hiding actually interesting interleavings from the POR implementation. I
need to improve the lookahead behaviour to ignore these invisible
actions.

Closes #46.
2016-07-21 19:33:49 +01:00
Michael Walker
25718a6162 Move common internal stuff to Test.DejaFu.Common 2016-07-21 19:33:49 +01:00