Commit Graph

50 Commits (master)

Author SHA1 Message Date
mwojcik 0a750c77e8 compiler: support subkernels 2023-10-08 17:11:51 +08:00
pca006132 9d43762695 test: fixed lit tests
Note that because we changed exception representation from using string
names as exception identifier into using integer IDs, we need to
initialize the embedding map in order to allocate the integer IDs. Also,
we can no longer print the exception names and messages from the kernel,
we will need the host to map exception IDs to names, and may need the
host to map string IDs to actual strings (messages can be static strings
in the firmware, or strings stored in the host only).

We now check for exception IDs for lit tests, which are fixed because we
preallocated all builtin exceptions.
2022-01-26 07:16:54 +08:00
pca006132 4644e105b1 compiler: modified exception representation
Exception name is replaced by exception ID, which requires no
allocation. Other strings in the exception can now be 'host-only'
strings, which is represented by a CSlice with len = usize::MAX and
ptr = key, to avoid the need for allocation when raising exceptions
through RPC.
2022-01-26 07:16:54 +08:00
David Nadlinger 292043a0a7 compiler: Raise AssertionErrors instead of abort()ing on all targets 2020-11-10 20:40:18 +01:00
David Nadlinger 4f311e7448 compiler: Raise exception on failed assert()s rather than panic
This allows assert() to be used on Zynq, where abort() is not
currently implemented for kernels. Furthermore, this is arguably
the more natural implementation of assertions on all kernel targets
(i.e. where embedding into host Python is used), as it matches host
Python behavior, and the exception information actually makes it to
the user rather than leading to a ConnectionClosed error.

Since this does not implement printing of the subexpressions, I
left the old print+abort implementation as default for the time
being.

The lit/integration/instance.py diff isn't just a spurious change;
the exception-based assert implementation exposes a limitation in
the existing closure lifetime tracking algorithm (which is not
supposed to be what is tested there).

GitHub: Fixes #1539.
2020-11-10 00:51:24 +01:00
whitequark 425cd7851e compiler: first monomorphize ints, then casts.
Fixes #1242.
2019-01-12 13:40:12 +00:00
whitequark fbf2c9a2fb compiler: hoist loads of kernel invariants to function entry block.
Addresses intraprocedural cases of #1007.
2018-05-25 02:18:13 +00:00
whitequark 9b4ad8b5af compiler: implement local variable demotion. 2018-05-19 17:05:34 +00:00
whitequark 4e7493843a compiler: Constness is a validator, not analysis. 2017-06-09 07:29:31 +00:00
whitequark 68de724554 compiler: monomorphize int64(round(x)) to not lose precision.
This applies to any expression with an indeterminate integer type
cast to int64(), not just round().
2016-12-02 15:02:44 +00:00
whitequark ac997daf95 compiler: disable remarks. 2016-11-21 19:12:11 +00:00
whitequark f5cca6b09e analyses.invariant_detection: implement (#622). 2016-11-20 12:48:26 +00:00
whitequark 0e76cbc414 artiq_compile: actually disable attribute writeback.
I wrote both halves of this condition but forgot to hook
them together.

Fixes #586.
2016-11-10 01:04:36 +00:00
whitequark a8c017bfcc runtime: port ksupport to Rust. 2016-10-16 16:32:43 +00:00
whitequark 640022122b embedding: refactor some more. 2016-05-16 14:38:09 +00:00
whitequark f4e6b18690 compiler: implement kernel constant attributes.
Part of #322.
2016-03-27 16:10:07 +00:00
whitequark 8d0566661a compiler: quote functions directly instead of going through a local. 2016-03-25 22:35:55 +00:00
whitequark 2e33084a5f transforms.llvm_ir_generator: implement instrumentation for attribute writeback. 2016-01-02 06:51:30 +08:00
whitequark 9ed6b54249 transforms.cfg_simplifier: remove.
Specifically, the following idiom broke our CFGSimplifier:

b1:
  branch_if %cond, %b2, %b3
b2:
  branch %b3
b3:
  %v = phi [ %b2 => 0, %b3 => 1 ]

This is very annoying to properly handle in general case, and also
this (specifically %b2) is exactly what broke LocalAccessValidator
in the first place. So, remove CFGSimplifier altogether.

Instead, teach LocalAccessValidator how to look through predecessors
in order to get a location.
2015-12-31 17:07:36 +08:00
whitequark 78fb3e1b7b compiler: validate local accesses after interleaving. 2015-12-30 15:26:30 +08:00
whitequark 8822db089f transforms.cfg_simplifier: implement.
This allows error reporting in LocalAccessValidator to proceed
even when the predecessor is an empty block with only a branch.
2015-12-29 02:15:57 +08:00
whitequark 3fbee2707b analyses.domination: consider unreachable blocks dominated by any other.
As a result, the dominator tree can now process arbitrary (reducible)
CFGs and we do not run DCE before analyses, risking loss of
correspondence to the AST, which would arbitrarily silence analyses.
2015-12-18 16:39:52 +08:00
whitequark 8cb7844621 transforms.interleaver: unroll loops. 2015-12-17 00:52:22 +08:00
whitequark 48a2bb10d5 transforms.interleaver: add boilerplate. 2015-11-17 05:22:20 +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 6ac82e1439 transforms.devirtualizer.FunctionResolver: implement. 2015-10-07 22:33:00 +03:00
whitequark 7a6fc3983c Make delay component of function type unifyable. 2015-09-30 18:41:14 +03:00
whitequark b971cc8cdf compiler.{iodelay,transforms.iodelay_estimator}: implement. 2015-09-02 17:55:48 -06:00
whitequark 501ba912c2 Implement {delay,now,at}{,_mu} and {mu,seconds}_to_{seconds,mu}. 2015-08-31 09:59:33 -06:00
whitequark 9b9fa1ab7c Allow embedding and RPC sending host objects. 2015-08-25 21:56:01 -07:00
whitequark 0e26cfb66e LocalAccessValidator: relax restrictions to accept def f(); def g(). 2015-08-22 13:31:09 -07:00
whitequark b26af5df60 Implement sending RPCs. 2015-08-09 02:17:19 +03:00
whitequark acc97a74f0 Fix compiler.module. 2015-08-07 14:21:53 +03:00
whitequark 50448ef554 Add support for referring to host values in embedded functions. 2015-08-07 13:24:01 +03:00
whitequark 7562d39750 compiler.module: split off inferencing from Module.__init__. 2015-08-06 08:25:53 +03:00
whitequark e8c107925c Implement shared object linking. 2015-07-29 20:35:16 +03:00
whitequark ece52062f2 Implement code generation for exception handling. 2015-07-25 05:37:37 +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
whitequark dff4ce7e3a Return LLVM IR module from LLVMIRGenerator.process. 2015-07-22 04:13:04 +03:00
whitequark 6f11fa6bb1 Add conversion to LLVM IR (except handling of exception handling). 2015-07-21 04:55:01 +03:00
whitequark ac491fae47 Add LocalAccessValidator. 2015-07-19 11:44:51 +03:00
whitequark bdcb24108b Add basic IR generator. 2015-07-14 08:56:51 +03:00
whitequark bfabca494b Remove regions from types.
Unification-based inference for regions is useful with a language
that has let bindings (which would propagate the regions) and
functions polymorphic over regions. For reasons of simplicity,
ARTIQ has neither, and making unification-based inference work would
essentially mean adding region coercions between most AST nodes,
and having every source subexpression have its own region variable,
with the appropriate subtyping relationship.

It's simpler to just keep that state outside of typedtree.
2015-07-02 22:55:12 +03:00
whitequark 0ae13ac1b9 Style fixes. 2015-07-02 22:38:55 +03:00
whitequark 7c833f0727 Move transforms.MonomorphismChecker to validators.MonomorphismValidator. 2015-07-02 21:54:31 +03:00
whitequark 02b41ea0f7 Add MonomorphismChecker. 2015-07-02 21:28:26 +03:00
whitequark 196acb37f6 Add IntMonomorphizer. 2015-07-02 19:57:27 +03:00
whitequark 7ce9bdf54d Move transforms to artiq.compiler.transforms, add artiq.Module. 2015-07-02 19:35:35 +03:00