Commit Graph

124 Commits

Author SHA1 Message Date
whitequark 6a6d7dab19 transforms.artiq_ir_generator: add support for user-defined context managers. 2016-01-05 04:10:40 +00:00
whitequark dfbf55fed2 transforms/inferencer: add support for user-defined context manager. 2016-01-05 00:11:03 +08:00
whitequark 05fa80818a transforms.inferencer: make sure parallel/sequential is lone manager. 2016-01-04 21:26:03 +08:00
whitequark 05bdd5c4a9 Commit missing parts of 8aa34ee9. 2015-12-31 22:42:21 +08:00
whitequark 424ca53fa0 Commit missing parts of 78fb3e1b. 2015-12-30 15:31:56 +08:00
whitequark 502e570e86 compiler: embed host exception constructors as such (fixes #204). 2015-12-26 03:17:29 +08:00
whitequark d1a5ec27b1 Commit missing parts of e4615e7. 2015-12-21 08:02:04 +08:00
whitequark 95af6daa28 transforms.inferencer: accept round(width=n) form (#198). 2015-12-20 01:02:57 +08:00
whitequark 0755aa38ff transforms.iodelay_estimator: allow goto in zero-iodelay while statements. 2015-12-18 21:14:40 +08:00
whitequark 2759310662 transforms.iodelay_estimator: reject control flow in 'with parallel:' (fixes #195). 2015-12-18 21:02:53 +08:00
whitequark 7f4490a543 Remove garbage. 2015-12-17 14:37:06 +08:00
whitequark 8cb7844621 transforms.interleaver: unroll loops. 2015-12-17 00:52:22 +08:00
whitequark 142b9b059b lit-test: add tests for control flow in parallel blocks. 2015-12-16 19:39:07 +08:00
whitequark e755e1ba9e validators.escape: support arrays in multiple assignment. 2015-12-14 16:31:03 +08:00
whitequark 25027f6907 compiler: fix tests. 2015-12-10 23:16:36 +08:00
whitequark 2d906daf7f compiler: implement 'with watchdog' support. 2015-12-10 23:11:00 +08:00
whitequark 3ec9b677b2 Revert "transforms.artiq_ir_generator: treat builtins in 'with' syntactically."
This reverts commit ccc993071b.
2015-12-10 22:25:15 +08:00
whitequark ccc993071b transforms.artiq_ir_generator: treat builtins in 'with' syntactically. 2015-12-10 21:29:16 +08:00
whitequark 0d90d88eff lit-test: use coverage in parallel mode. 2015-12-03 16:36:06 +08:00
whitequark 8e01d0b9a1 lit-test: collect coverage if ran with COVERAGE=1. 2015-12-03 16:24:37 +08:00
whitequark 8cb2215edb transforms.inferencer: only instantiate RPC function types, not regular. 2015-12-02 21:48:14 +08:00
whitequark ffd065961f lit-test: fix inferencer/class. 2015-12-02 20:37:13 +08:00
whitequark 5b1b49413a lit-test: fix devirtualization/*. 2015-12-02 20:36:49 +08:00
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 651e6b1b7a Remove build products from git. 2015-09-30 18:41:47 +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