Commit Graph

47 Commits

Author SHA1 Message Date
whitequark
16ae0fb6eb compiler.embedding: instantiate RPC method types (fixes #180). 2015-11-27 16:29:13 +08:00
whitequark
14993e89e2 compiler.embedding: show suggestions for mistyped host object attributes. 2015-11-24 17:44:58 +08:00
whitequark
fec5c2ebf0 transforms.interleaver: add a diagnostic for interleave inlining failure. 2015-11-24 02:57:03 +08:00
whitequark
e53f26dba0 lit-test: add interleaving/pure_impure_tie. 2015-11-24 00:21:53 +08:00
whitequark
37b80247f1 lit-test: fix breakage from abb36b4 and 02f2763. 2015-11-24 00:20:00 +08:00
whitequark
82b470891f transforms.interleaver: handle function calls (as atomic so far).
This commit solves issue #2 described in 50e7b44; a function call
is now a valid decomposition for a delay instruction, and this
metadata is propagated when the interleaver converts delays.

However, the interleaver does not yet detect that a called function
is compound, i.e. it is not correct.
2015-11-21 03:34:24 +08:00
whitequark
cb3b811fd7 compiler: maintain both the IR and iodelay forms of delay expressions.
After this commit, the delay instruction (again) does not generate
any LLVM IR: all heavy lifting is relegated to the delay and delay_mu
intrinsics. When the interleave transform needs to adjust the global
timeline, it synthesizes a delay_mu intrinsnic. This way,
the interleave transformation becomes composable, as the input and
the output IR invariants are the same.

Also, code generation is adjusted so that a basic block is split off
not only after a delay call, but also before one; otherwise, e.g.,
code immediately at the beginning of a `with parallel:` branch
would have no choice but to execute after another branch has already
advanced the timeline.

This takes care of issue #1 described in 50e7b44 and is a step
to solving issue #2.
2015-11-21 03:22:47 +08:00
whitequark
50e7b44d04 compiler: actually implement interleaving correctly (calls are still broken).
The previous implementation was completely wrong: it always advanced
the global timeline by the same amount as the non-interleaved basic
block did.

The new implementation only advances the global timeline by
the difference between its current time and the virtual time of
the branch, which requires it to adjust the delay instructions.

Previously, the delay expression was present in the IR twice: once
as the iodelay.Expr transformation-visible form, and once as regular
IR instructions, with the latter form being passed to the delay_mu
builtin and advancing the runtime timeline.

As a result of this change, this strategy is no longer valid:
we can meaningfully mutate the iodelay.Expr form but not the IR
instruction form. Thus, IR instructions are no longer generated for
delay expressions, and the LLVM lowering pass now has to lower
the iodelay.Expr objects as well.

This works OK for flat `with parallel:` expressions, but breaks down
outside of `with parallel:` or when calls are present. The reasons
it breaks down are as follows:

  * Outside of `with parallel:`, delay() and delay_mu() must accept
    any expression, but iodelay.Expr's are not nearly expressive
    enough. So, the IR instruction form must actually be kept as well.

  * A delay instruction is currently inserted after a call to
    a user-defined function; this delay instruction introduces
    a point where basic block reordering is possible as well as
    provides delay information. However, the callee knows nothing
    about the context in which it is called, which means that
    the runtime timeline is advanced twice. So, a new terminator
    instruction must be added that combines the properties of delay
    and call instructions (and another for delay and invoke as well).
2015-11-21 00:02:47 +08:00
whitequark
88b7990714 transforms.iodelay_estimator: fail statements with indeterminate delay inside with parallel. 2015-11-20 17:10:25 +08:00
whitequark
00ec574d73 transforms.interleaver: implement (without inlining). 2015-11-20 00:03:26 +08:00
whitequark
b9bb5fba6a lit-test: fix iodelay/class test (broken in 506725f). 2015-11-19 23:28:50 +08:00
whitequark
a04d0f8fbd lit-test: fix inferencer/error_class test (broken in b0c6b70). 2015-11-19 23:28:00 +08:00
whitequark
e619154c81 transforms.iodelay_estimator: fix handling of with sequential. 2015-11-17 01:22:48 +03:00
whitequark
506725f78a transforms.iodelay_estimator: fix handling of methods. 2015-11-17 01:19:22 +03:00
whitequark
b0c6b70971 transforms.asttyped_rewriter: fix class redefinition diagnostic. 2015-11-17 01:17:25 +03:00
whitequark
80f0bfe0ad lit-test: add test for iodelay order invariance. 2015-11-17 01:04:20 +03:00
whitequark
3fb12b74d6 lit-test: update to follow IR serialization changes. 2015-11-17 01:04:08 +03:00
whitequark
73c22b0b1e Fix tests. 2015-11-07 15:17:31 +03:00
whitequark
e9adfd639e Merge branch 'master' into new-py2llvm 2015-10-14 16:09:57 +03:00
whitequark
bd5b324fc2 Merge branch 'master' into new-py2llvm 2015-10-13 19:24:45 +03:00
whitequark
48f1f48f09 transforms.artiq_ir_generator: devirtualize method calls. 2015-10-09 02:27:52 +03:00
whitequark
b6c8c9f480 transforms.artiq_ir_generator: add tests for devirtualization. 2015-10-09 01:37:28 +03:00
whitequark
7a6fc3983c Make delay component of function type unifyable. 2015-09-30 18:41:14 +03:00
whitequark
867a0689ad transforms.Inferencer: narrow range() element type. 2015-09-02 17:55:48 -06:00
whitequark
b971cc8cdf compiler.{iodelay,transforms.iodelay_estimator}: implement. 2015-09-02 17:55:48 -06:00
whitequark
995245b786 compiler.embedding: default RPC return annotation is -> TNone. 2015-09-01 08:38:38 -06:00
whitequark
501ba912c2 Implement {delay,now,at}{,_mu} and {mu,seconds}_to_{seconds,mu}. 2015-08-31 09:59:33 -06:00
whitequark
9936768603 ARTIQIRGenerator: fix non-nullary method calls. 2015-08-28 02:11:05 -05:00
whitequark
13e612c11b Fix tests. 2015-08-28 00:51:31 -05:00
whitequark
7c1abb25ec compiler.embedding: test all diagnostics.
Also, unify and improve diagnostic messages.
2015-08-28 00:47:28 -05:00
whitequark
0e26cfb66e LocalAccessValidator: relax restrictions to accept def f(); def g(). 2015-08-22 13:31:09 -07:00
whitequark
51c591f01a Unbreak tests. 2015-08-18 22:44:09 -07:00
whitequark
6c8de9b6d4 Implement methods. 2015-08-18 22:39:22 -07:00
whitequark
1040a409c3 lit-test: fix tests incorrectly assuming an OutputCheck step. 2015-08-18 15:05:43 -07:00
whitequark
94a2d5f5fa Implement class attribute access through instances. 2015-08-15 11:07:54 -04:00
whitequark
00efc8c636 Implement class definitions and class attribute access. 2015-08-15 09:45:16 -04:00
whitequark
786fde827a Unbreak tests. 2015-08-11 00:41:31 +03:00
whitequark
2cd25f85bf Rename artiq.compiler.testbench.{module → signature}. 2015-07-29 14:32:34 +03:00
whitequark
edffb40ef2 On uncaught exception, execute finally clauses and collect backtrace. 2015-07-27 13:51:24 +03:00
whitequark
2939d4f0f3 Add tests for finally clause and reraising. 2015-07-27 12:36:21 +03:00
whitequark
a83e7e2248 Add tests for exceptional control flow. 2015-07-27 10:22:28 +03:00
whitequark
90be44c596 Add tests for non-exceptional control flow across finally. 2015-07-27 10:13:22 +03:00
whitequark
7c77dd317a Implement __artiq_personality. 2015-07-27 09:10:20 +03:00
whitequark
bb5fe60137 Implement exception raising. 2015-07-27 05:46:43 +03:00
whitequark
47f13bf921 Always load the personality library in JIT testbench, if available. 2015-07-27 04:44:40 +03:00
whitequark
14c7b15785 Add a test harness for exceptions.
The libunwind.h is duplicated here so that it would be possible
to test the Python parts without pulling in misoc.
2015-07-27 04:18:12 +03:00
whitequark
862ac1f90d lit-test/compiler -> lit-test/test.
Other directories in lit-test will host various parts of
the test harness.
2015-07-27 04:13:29 +03:00