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
57dd163d37
transforms.artiq_ir_generator: fix decomposition of explicit delay_mu().
2015-11-21 03:27:06 +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
73c358a59a
Reformat.
2015-11-20 23:33:06 +08:00
whitequark
cc623c13b4
Reformat.
2015-11-20 21:45:34 +08:00
whitequark
d0f86e05d0
transforms.interleaver: add safety check.
2015-11-20 17:27:04 +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
025bfbe746
transforms.llvm_ir_generator: accept delay instructions.
...
The delay instruction is just like a branch (discontinuity
in instruction flow), but it also carries metadata: how long
did the execution of its basic block take. This metadata only
matters during inlining and interleaving, so we treat it here
as a mere branch.
2015-11-19 23:55:52 +08:00
whitequark
9639a831bc
transforms.artiq_ir_generator: correctly emit IfExpT with control flow.
...
This can happen with nested if expressions, as well as if
the if expression includes delays.
2015-11-19 23:44:39 +08:00
whitequark
2543daa5cf
transforms.artiq_ir_generator: don't emit delay instruction for zero delay.
...
Call nodes with iodelay=Const(0) can be generated outside of
`with parallel:`, where Interleaver won't and LLVMIRGenerator can't
lower them.
2015-11-19 23:24:46 +08:00
whitequark
58db347e01
transforms.iodelay_estimator: fix uninitialized access.
2015-11-19 23:23:39 +08:00
whitequark
48a2bb10d5
transforms.interleaver: add boilerplate.
2015-11-17 05:22:20 +03:00
whitequark
de9d7eb2e4
compiler: add delay
IR instruction.
2015-11-17 05:16:43 +03: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
9e0a5b9404
transforms.iodelay_estimator: skip statements, not modules on _UnknownDelay.
2015-11-17 01:00:10 +03:00
whitequark
44d0a35409
transforms.iodelay_estimator: actually iterate to fixpoint.
2015-11-17 00:59:40 +03:00
whitequark
10f82ff2c8
transforms.iodelay_estimator: do not unify indeterminate delays.
2015-11-17 00:59:09 +03:00
whitequark
eefa9e2ea6
transforms.inferencer: fix typo.
2015-11-17 00:02:15 +03:00
whitequark
b91ffa1b38
ir: fix default argument fiasco.
2015-10-14 17:02:59 +03:00
whitequark
5d64df829e
transforms.artiq_ir_generator: fix devirtualized call annotation.
2015-10-14 16:12:00 +03:00
whitequark
32ce33a1f9
transforms.artiq_ir_generator: emit ir.Parallel for with parallel:.
2015-10-09 03:10:39 +03:00
whitequark
48f1f48f09
transforms.artiq_ir_generator: devirtualize method calls.
2015-10-09 02:27:52 +03:00
whitequark
0bb793199f
transforms.artiq_ir_generator: devirtualize closure calls.
2015-10-09 01:32:27 +03:00
whitequark
7043b333a7
transforms.devirtualizer → analyses.devirtualization.
2015-10-09 00:29:31 +03:00
whitequark
962dd9de13
transforms.devirtualizer.MethodResolver: implement.
2015-10-07 22:33:08 +03:00
whitequark
6ac82e1439
transforms.devirtualizer.FunctionResolver: implement.
2015-10-07 22:33:00 +03:00
whitequark
42b0089a4c
transforms.asttyped_rewriter: simplify.
2015-10-07 22:03:24 +03:00
whitequark
7a6fc3983c
Make delay component of function type unifyable.
2015-09-30 18:41:14 +03:00
whitequark
60c985bf0b
Remove debug print.
2015-09-27 17:55:19 +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
156779007a
LLVMIRGenerator: implement quoting of lists.
2015-08-31 23:33:33 -06:00
whitequark
956c1985b1
ARTIQIRGenerator: evaluate SubscriptT index in non-assignment context.
2015-08-31 23:33:04 -06:00
whitequark
3ca5967cea
LLVMIRGenerator: don't map sret LLVM argument to any ARTIQ arguments.
2015-08-31 14:02:02 -06:00
whitequark
5e0ec3a6ea
ARTIQIRGenerator: fix keyword/optional argument codegen in calls.
2015-08-31 13:42:36 -06:00
whitequark
501ba912c2
Implement {delay,now,at}{,_mu} and {mu,seconds}_to_{seconds,mu}.
2015-08-31 09:59:33 -06:00
whitequark
2124ff9e91
Fix tests.
2015-08-28 05:28:58 -05:00
whitequark
37811f690b
ARTIQIRGenerator: support comparisons against None.
2015-08-28 05:14:52 -05:00
whitequark
c621b1f275
compiler: handle language.core.int during embedding.
2015-08-28 03:24:15 -05:00
whitequark
83ebb999c8
transforms.Inferencer: improve attribute unification diagnostic.
2015-08-28 03:23:15 -05:00
whitequark
9fd25a1cc4
LLVMIRGenerator: fix syscall emission.
2015-08-28 03:03:12 -05:00
whitequark
9936768603
ARTIQIRGenerator: fix non-nullary method calls.
2015-08-28 02:11:05 -05:00
whitequark
c21387dc09
compiler.embedding: support calling methods marked as @kernel.
2015-08-27 19:46:50 -05:00
whitequark
84e32db622
LLVMIRGenerator: handle self-referential class types.
2015-08-27 15:40:46 -05:00
whitequark
71ebe1778d
LLVMIRGenerator: remove debug print.
2015-08-27 15:40:15 -05:00
whitequark
c62b16d5e1
compiler.embedding: support RPC functions as host attribute values.
2015-08-27 05:53:18 -05:00
whitequark
cb225269ff
Allow accessing attributes of embedded host objects.
2015-08-27 05:01:04 -05:00
whitequark
9b9fa1ab7c
Allow embedding and RPC sending host objects.
2015-08-25 21:56:01 -07:00
whitequark
526d7c4e46
Fix a typo.
2015-08-22 14:01:55 -07:00
whitequark
a557445e05
LocalAccessValidator: assume variables with "$" in name are internal.
...
Internal variables are assumed to be scoped correctly
(including not being accessed uninitialized).
This was changed from "." because artiq.compiler.embedding uses
"." in module prefix of function names.
2015-08-22 13:56:17 -07:00
whitequark
0e26cfb66e
LocalAccessValidator: relax restrictions to accept def f(); def g().
2015-08-22 13:31:09 -07:00
whitequark
b39e76ae28
Remove debug print.
2015-08-22 12:22:26 -07:00
whitequark
27a697920a
LLVMIRGenerator: use sret when returning large structures.
2015-08-19 15:06:03 -07:00
whitequark
afc3f36104
ARTIQIRGenerator: fix polymorphic print on closures.
2015-08-19 12:37:22 -07:00
whitequark
53b4d87647
LLVMIRGenerator: attach debug metadata to all emitted LLVM instructions.
2015-08-19 12:18:20 -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
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
c72267ecf5
Implement syscalls for the new compiler.
2015-08-10 20:26:06 +03:00
whitequark
b28a874274
Inferencer: range() does not accept a float argument.
2015-08-10 17:06:55 +03:00
whitequark
f53a5ff202
Remove syscall builtin.
2015-08-10 16:44:29 +03:00
whitequark
c63ec70c53
LLVMIRGenerator: emit debug information.
2015-08-10 15:11:52 +03:00
whitequark
8f510a4407
compiler.ir.Function: add loc field.
2015-08-10 13:14:52 +03:00
whitequark
22570afbda
LLVMIRGenerator: allocate less.
2015-08-10 09:12:34 +03:00
whitequark
dfc91a35f2
ARTIQIRGenerator.polymorphic_print: str([x]) uses repr(x), not str(x).
2015-08-09 20:27:04 +03:00
whitequark
f7b64db8f4
LLVMIRGenerator: fixup phis on expansion of ARTIQ instructions.
2015-08-09 20:24:16 +03:00
whitequark
d4270cf66e
Implement receiving data from RPCs.
2015-08-09 20:17:00 +03:00
whitequark
02b1543c63
Implement receiving exceptions from RPCs.
2015-08-09 16:16:41 +03:00
whitequark
9c5ca2ae29
LLVMIRGenerator: add target data layout to LLVM modules.
2015-08-09 14:39:21 +03:00
whitequark
153592f1cc
Naming.
2015-08-09 02:25:58 +03:00
whitequark
b26af5df60
Implement sending RPCs.
2015-08-09 02:17:19 +03:00
whitequark
22457bc19c
Ensure uwtable is added to all generated functions.
2015-08-08 21:48:21 +03:00
whitequark
ee3f35c608
Improve error message on passing an argument twice.
2015-08-08 21:06:13 +03:00
whitequark
bdcf7f100b
ARTIQIRGenerator: add semantic locs to all other implicitly raised exceptions.
2015-08-08 16:26:53 +03:00
whitequark
acd8d6355f
transforms.ARTIQIRGenerator: IndexError loc should point to "[".
2015-08-08 16:18:57 +03:00
whitequark
27d2390fed
Add zero-cost exception support to runtime and host.
2015-08-08 16:01:31 +03:00
whitequark
a7633f75c7
Show origin of expansion in diagnostics for synthesized code.
2015-08-07 13:56:18 +03:00
whitequark
50448ef554
Add support for referring to host values in embedded functions.
2015-08-07 13:24:01 +03:00
whitequark
353f454a29
Add basic support for embedded functions with new compiler.
2015-08-07 11:44:49 +03:00
whitequark
1a969aa9e4
compiler.transforms.inferencer: accept and ignore @kernel decorator.
2015-08-07 07:54:35 +03:00
whitequark
7562d39750
compiler.module: split off inferencing from Module.__init__.
2015-08-06 08:25:53 +03:00
whitequark
ca52b2fdd0
compiler.transforms.ARTIQIRGenerator: fix typo.
2015-08-06 08:25:53 +03:00
whitequark
e8c107925c
Implement shared object linking.
2015-07-29 20:35:16 +03:00
whitequark
3378dd57b8
Fold llvmlite patches into m-labs/llvmlite repository.
2015-07-29 13:54:00 +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
47f13bf921
Always load the personality library in JIT testbench, if available.
2015-07-27 04:44:40 +03:00
whitequark
692791f0bd
Make sure a landing pad returns {i8*} to soothe LLVM codegen.
2015-07-25 07:01:25 +03:00
whitequark
ece52062f2
Implement code generation for exception handling.
2015-07-25 05:37:37 +03:00
whitequark
65121b437f
Rework internal logic of slices.
2015-07-23 07:57:49 +03:00
whitequark
9db199cad9
Handle closure effects appropriately in LocalAccessValidator.
2015-07-23 03:15:36 +03:00
whitequark
acb8810e62
Add tests for lambdas and functions.
2015-07-23 03:07:30 +03:00