whitequark
d14ad6727a
compiler.embedding: avoid showing wildly incorrect suggestions.
2015-11-24 17:50:46 +08:00
whitequark
14993e89e2
compiler.embedding: show suggestions for mistyped host object attributes.
2015-11-24 17:44:58 +08:00
whitequark
e1cd2ccd40
compiler: pull in dependencies in more finely grained way ( fixes #181 ).
2015-11-24 17:32:04 +08:00
whitequark
66b1388a63
transforms.artiq_ir_generator: never put TVars in dicts.
...
A TVar looks just like whatever it points to, but it does not
compare equal, nor is its hash the same.
2015-11-24 02:59:15 +08:00
whitequark
fec5c2ebf0
transforms.interleaver: add a diagnostic for interleave inlining failure.
2015-11-24 02:57:03 +08:00
whitequark
8527e306c3
testbench.embedding: use dmgr to get core and export it.
2015-11-24 02:02:34 +08:00
whitequark
2bfc72fba9
testbench.embedding: fix ref_period mismatch.
2015-11-24 00:54:20 +08:00
whitequark
d3f0059cab
compiler.iodelay: correctly fold max(0, [0, ]...).
2015-11-24 00:46:55 +08:00
whitequark
9bc62fa3d2
transforms.iodelay_estimator: correctly handle functions with empty body.
2015-11-24 00:46:26 +08:00
whitequark
32fe4a8a0c
transforms.llvm_ir_generator: don't assert on inlined functions.
2015-11-24 00:20:33 +08:00
whitequark
abb36b42be
compiler.iodelay: fold and eval SToMU to an int, not float.
2015-11-24 00:19:33 +08:00
whitequark
178ff74da2
transforms.interleaver: inline calls.
2015-11-24 00:02:07 +08:00
whitequark
2a82eb7219
compiler.ir: return dict from Delay.substs, not pair iterable.
2015-11-24 00:01:10 +08:00
whitequark
02f2763ea8
compiler.iodelay: always fully fold SToMU and MUToS.
2015-11-23 23:59:59 +08:00
whitequark
f3da227e2d
compiler.ir: change argument order for BasicBlock.insert.
2015-11-23 23:59:25 +08:00
whitequark
f0fd6cd0ca
compiler.algorithms.inline: implement.
2015-11-23 23:58:37 +08:00
whitequark
a4525b21cf
compiler.ir: print even blocks without predecessors.
2015-11-23 23:55:12 +08:00
whitequark
d92b3434a0
compiler.ir: print basic blocks in reverse postorder for readability.
2015-11-23 21:44:38 +08:00
whitequark
c73b2c1a78
compiler.ir: fix typo.
2015-11-23 21:21:01 +08:00
whitequark
0bf425eefa
compiler.ir: maintain use lists while mutating instructions.
2015-11-23 19:18:58 +08:00
whitequark
03b4e4027c
transforms.interleaver: fix IR type/value mismatch.
2015-11-23 18:53:42 +08:00
whitequark
73845279ae
transforms.interleaver: determine when inlining is not necessary.
2015-11-23 18:08:33 +08:00
whitequark
a01e328b4a
transforms.interleaver: don't assume all delay expressions are folded.
2015-11-21 17:24:00 +08:00
whitequark
5cd12ffd28
compiler.iodelay: fold MUToS and SToMU.
2015-11-21 17:23:20 +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
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
cb9e7d15bf
compiler.iodelay: subtraction certainly shouldn't be commutative.
2015-11-20 22:15:03 +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
956d2afcb2
compiler.iodelay: fold Max further.
2015-11-17 03:06:07 +03:00
whitequark
7d2fca291d
compiler.iodelay: add missing import.
2015-11-17 01:30:19 +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
841e01a8bb
compiler.iodelay: fix typo in Var.__eq__.
2015-11-17 00:53:12 +03:00
whitequark
a2d73c8b05
compiler.types: dump type variable iodelay explicitly.
2015-11-17 00:51:56 +03:00
whitequark
e67705dc27
compiler.iodelay: fix typo in BinOp.__eq__.
2015-11-17 00:51:37 +03:00
whitequark
629aacec09
compiler.iodelay: add forgotten Conv.__eq__.
2015-11-17 00:51:22 +03:00
whitequark
fd46690cf5
compiler: make IR dumps vastly more readable.
2015-11-17 00:23:34 +03:00
whitequark
eefa9e2ea6
transforms.inferencer: fix typo.
2015-11-17 00:02:15 +03:00
whitequark
c8cfa7c7bd
compiler: give suggestions in diagnostics for unbound variable.
...
This uses the Jaro-Winkler edit distance, which seemed like the best
fit for identifiers, even though it is intended for people's names.
2015-11-15 23:09:40 +03:00
whitequark
9670939ca6
compiler.analyses.domination: fix PostDominatorTree.
2015-11-09 12:49:27 +03:00
whitequark
19fae9181c
compiler.analyses.domination: implement new dominator tree algorithm.
2015-11-09 11:51:54 +03:00
whitequark
a0c6f75f9b
compiler.types: fix obsolete iodelay references.
2015-11-07 15:14:19 +03:00
whitequark
3a1b77ae6b
analyses.domination: add PostDominatorTree.
2015-11-01 09:49:39 +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
bd5b324fc2
Merge branch 'master' into new-py2llvm
2015-10-13 19:24:45 +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
6922bd5638
analyses.devirtualization: look up functions in outer scopes.
2015-10-09 01:32:05 +03:00
whitequark
844d37ff18
compiler.testbench.embedding: allow compiling only.
2015-10-09 01:24:44 +03:00
whitequark
7bcba52d6a
compiler.embedding: fix loc.
2015-10-09 00:53:14 +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
2ca84f9fea
Highlight source range in IR dumps using colors.
2015-10-04 02:11:17 +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
995245b786
compiler.embedding: default RPC return annotation is -> TNone.
2015-09-01 08:38:38 -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
b03efbc94d
compiler.embedding: maintain correct column numbers in debug info.
2015-08-31 22:18:49 -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
5151adb9a8
compiler.targets: correctly pass CPU features to LLVM.
2015-08-30 16:56:58 -05:00
whitequark
b263a55b1a
compiler.testbench.perf_embedding: implement.
2015-08-30 12:23:16 -05: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
bcba86de7e
compiler.embedding: handle errors during initial kernel call.
2015-08-28 05:14:06 -05:00
whitequark
b35051cb08
compiler.embedding: handle calls into lambdas (poorly).
2015-08-28 05:13:38 -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
6a29775bf0
compiler.types.Type: more useful __str__.
2015-08-28 02:53:12 -05:00
whitequark
ac92aabce1
Fix default argument fiasco.
2015-08-28 02:50:40 -05:00
whitequark
edf33f1643
compiler.targets: dump module signature with ARTIQ_DUMP_SIG=1.
2015-08-28 02:22:35 -05:00
whitequark
677cc69643
compiler.embedding: actually use qualified name when embedding methods.
...
Previous commit 6b55e3b
only did this for embedded types.
2015-08-28 02:22:16 -05:00
whitequark
9936768603
ARTIQIRGenerator: fix non-nullary method calls.
2015-08-28 02:11:05 -05:00
whitequark
d473d58b41
artiq_{compile,run}: adapt to new compiler.
2015-08-28 01:43:46 -05:00
whitequark
6b55e3bd80
compiler.embedding: use qualified name when embedding methods.
2015-08-28 01:14:19 -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
c21387dc09
compiler.embedding: support calling methods marked as @kernel.
2015-08-27 19:46:50 -05:00
whitequark
d0fd61866f
compiler.types: print fields of instance types.
2015-08-27 17:25:01 -05:00
whitequark
9791cbba4d
compiler.embedding: use typedtree hash to iterate inference to fixpoint.
2015-08-27 17:04:28 -05:00
whitequark
a3284f8978
compiler.types: fix module paths in __repr__.
2015-08-27 15:46:36 -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
f7c8625f61
compiler.embedding: support calling methods via RPC as well.
2015-08-27 05:56:46 -05:00
whitequark
c62b16d5e1
compiler.embedding: support RPC functions as host attribute values.
2015-08-27 05:53:18 -05:00
whitequark
04bd2421ad
compiler.embedding: dedent kernel functions before parsing.
2015-08-27 05:44:56 -05:00
whitequark
cb225269ff
Allow accessing attributes of embedded host objects.
2015-08-27 05:01:04 -05:00
whitequark
422208a0e9
Fix copy-paste error.
2015-08-25 22:05:34 -07: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
62e6f8a03d
compiler.embedding.Stitcher: refactor.
2015-08-10 20:26:07 +03:00
whitequark
c72267ecf5
Implement syscalls for the new compiler.
2015-08-10 20:26:06 +03:00
whitequark
435559fe50
Allow type annotations on remotely called functions.
2015-08-10 17:48:35 +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
261515dfe5
compiler.targets.OR1KTarget: fix typo.
2015-08-10 15:47:44 +03:00
whitequark
75532d10aa
Display full core device backtraces.
2015-08-10 15:12:22 +03:00
whitequark
c63ec70c53
LLVMIRGenerator: emit debug information.
2015-08-10 15:11:52 +03:00
whitequark
4f02f6e667
compiler.types: make all hashable.
2015-08-10 13:15:42 +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
8b7d38d203
Add ARTIQ_DUMP_ASSEMBLY.
2015-08-09 15:47:29 +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