Commit graph

39 commits

Author SHA1 Message Date
Leonardo de Moura
0556412f8d refactor(*): add runtime folder
@kha The runtime folder includes what is needed to link a
standalone Lean program. It is still contains some unnecessary files.
We will be able to remove them after we release Lean4.
2018-05-14 14:23:56 -07:00
Leonardo de Moura
173eb1c6b7 refactor(util/fresh_name): implement fresh_name using unique thread id
@kha This commit is retracting the experiment using
`mk_fresh_name_generator_child` when creating new tasks.
The names get too long.

I'm still refactoring the code and trying to eliminate all occurrences
of `mk_fresh_name`. I still have a long way to go, but I am merging
this branch into master since it has many other fixes.
2018-02-23 10:35:04 -08:00
Leonardo de Moura
799cc9b03d feat(util/fresh_name): implement mk_fresh_name using name_generator 2018-02-21 15:04:19 -08:00
Leonardo de Moura
78d8ff8031 feat(*): add reset_thread_local 2018-02-21 15:04:19 -08:00
Gabriel Ebner
34d5c0f769 fix(library/mt_task_queue): work around non-recursive lock 2017-06-06 19:57:04 +02:00
Leonardo de Moura
56215b36e8 fix(*): [[fallthrough]] ==> /* fall-thru */
Older gcc compilers generate a warning when the attribute is used.
I found out that GCC 7 will not produce a warning if comments
such as /* fall-thru */ or /* FALLTHRU */ are used instead of the
attribute [[fallthrough]]
2017-05-31 21:18:47 -07:00
Leonardo de Moura
ac17270894 fix(*): more gcc 7 warnings 2017-05-31 17:29:30 -07:00
Gabriel Ebner
0d4f829ada fix(library/mt_task_queue): fix abort 2017-03-23 15:37:52 +01:00
Gabriel Ebner
28c71d7dba fix(library/mt_task_queue): do not wait on freed condition_variables 2017-03-23 09:00:59 +01:00
Gabriel Ebner
901cef6629 refactor(util/thread): simplify thread life-cycle 2017-03-23 09:00:59 +01:00
Gabriel Ebner
7fc190c730 fix(mt_task_queue): fix reference cycle between closure and lthread 2017-03-23 09:00:59 +01:00
Gabriel Ebner
667d06108a chore(*): fix clang warnings 2017-03-23 09:00:58 +01:00
Gabriel Ebner
d22bfbd12a feat(util/debug): add version of lean_assert that also works in non-debug builds 2017-03-23 08:57:56 +01:00
Gabriel Ebner
5e94f63b3e feat(library/mt_task_queue): kill all idle workers 2017-03-23 08:57:56 +01:00
Gabriel Ebner
667381b8bd fix(library/mt_task_queue): bump_prio: handle unsubmitted tasks 2017-03-23 08:57:56 +01:00
Gabriel Ebner
56aceae435 fix(library/mt_task_queue): ensure precondition for execute 2017-03-23 08:57:56 +01:00
Gabriel Ebner
1524979dbf feat(emacs,shell/server): add different region-of-interest options 2017-03-23 08:57:56 +01:00
Gabriel Ebner
45820531c4 refactor(util/task): remove switch to disable priority inversion 2017-03-23 08:57:56 +01:00
Gabriel Ebner
26ba9c23a7 refactor(util/task): add eager execution 2017-03-23 08:57:56 +01:00
Gabriel Ebner
3eba8d3ffc refactor(util/task): do not propagate errors 2017-03-23 08:57:56 +01:00
Gabriel Ebner
5f872912e0 refactor(shell/lean): set exit status 1 iff at least one error was reported 2017-03-23 08:57:56 +01:00
Gabriel Ebner
595cbb8fe9 refactor(*): task<T>, log_tree, cancellation_token 2017-03-23 08:57:52 +01:00
Leonardo de Moura
01eb27d4a4 feat(util): "deterministic timeout" option
closes #1134

see #1362

This feature is implemented using a "hearbeat" thread local counter.
We reset the counter whenever we start a new task.
The counter is incremented when:

  1- An object is allocated using small_object_allocator (e.g., VM object)
  2- An object is allocated using memory_pool (e.g., expr, level, rb_tree nodes, list cons-cells, etc)
  3- check_system(...) invocations

We check if the threshold was reached at check_system.
The option --timeout=num can be used to set the limit (in thousands).
The default is unbounded in batch mode.
In server mode, the default is 100000. We can compile the standard library with --timeout=12000

I did not perform many experiments to check how precise this counter is.
I added a new Emacs configuration setting to change the server default.

Here is the wall clock time for different values of --timeout for the
command used on issue #1134

time ../../bin/lean -j 0 --timeout=20000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.070s
user	0m1.032s
sys	0m0.036s

time ../../bin/lean -j 0 --timeout=40000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.777s
user	0m1.676s
sys	0m0.044s

time ../../bin/lean -j 0 --timeout=50000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m1.985s
user	0m1.920s
sys	0m0.056s

time ../../bin/lean -j 0 --timeout=100000 loop.lean
loop.lean:1:0: error: (deterministic) timeout detected at 'expression equality test' (potential solution: increase timeout threshold)

real	0m3.587s
user	0m3.564s
sys	0m0.020s
2017-02-07 13:56:12 -08:00
Gabriel Ebner
c2d95c4cb6 fix(library/mt_task_queue): handle lazy depdendencies of tasks without priority inversion 2017-02-05 16:34:46 +01:00
Gabriel Ebner
952f444710 feat(init/meta/task): allow task creation from VM 2017-01-28 08:27:23 +01:00
Gabriel Ebner
bc09a53f71 feat(library/task_queue): add flag to prevent priority inversion 2017-01-05 18:09:28 -08:00
Gabriel Ebner
f6b8eb6821 feat(util/task_queue): lazy tasks 2017-01-04 16:30:22 -08:00
Gabriel Ebner
902df5d134 feat(shell/server,emacs): show list of currently running tasks 2016-12-12 12:40:40 -08:00
Gabriel Ebner
a972c13ce9 refactor(library/task_queue): move task queue to util 2016-12-12 10:01:34 -05:00
Gabriel Ebner
6c34d42025 refactor(library/task_queue): break dependency on message_buffer 2016-12-12 09:44:05 -05:00
Gabriel Ebner
f584d11072 refactor(library/task_queue): do not hardcode friendship to mt_task_queue 2016-12-12 09:32:13 -05:00
Gabriel Ebner
29bf483e2a refactor(library/task_queue): extract library-specific code 2016-12-12 08:43:43 -05:00
Gabriel Ebner
d5372e770f fix(shell/lean): wait for all tasks to finish 2016-12-05 13:26:00 -08:00
Leonardo de Moura
a9d3f36f76 feat(util/thread,library/mt_task_queue): add lthread 2016-12-03 11:29:22 -08:00
Leonardo de Moura
aea8fd943e fix(library/mt_task_queue): save stack info at thread starting
We need this information to get accurate stack information.
2016-12-02 20:01:32 -08:00
Gabriel Ebner
a3daaee2e0 fix(library/mt_task_queue): reverse dependencies may already be queued
When we check whether the dependencies for a task have already been
evaluated and then accordingly move the task from waiting to queued, we
do not remove it from the reverse dependency lists it appears in.
2016-12-01 17:43:53 -08:00
Gabriel Ebner
cc9f52ade6 refactor(library/mt_task_queue): more precise task_result_states
The task result state now distinguishes created/waiting/queued, which is
useful for debugging.  mt_task_queue now also correctly waits for all
tasks during destruction.
2016-12-01 11:06:08 -08:00
Leonardo de Moura
73e5367fb6 fix(library/mt_task_queue): make sure thread finalizers are executed even if lean was compiled without pthread support 2016-11-30 11:42:29 -08:00
Gabriel Ebner
3ecfddcbd5 fix(*): fix build 2016-11-29 11:12:43 -08:00
Renamed from src/util/mt_task_queue.cpp (Browse further)