Commit Graph

104 Commits

Author SHA1 Message Date
David Nadlinger ad34df3de1 compiler: Support numpy.float
This would previously crash the compiler.
2020-08-09 17:08:43 +01:00
David Nadlinger 1c645d8857 compiler: Unbreak quoting of 1D ndarrays
Lists and arrays no longer have the same representation all
the way through codegen, as used to be the case.

This could/should be made more efficient later, eliding the
temporary copies.
2020-08-09 03:54:42 +01:00
David Nadlinger 4d48470320 compiler: Support common numpy.* math functions
Relies on the runtime to provide the necessary
(libm-compatible) functions.

The test is nifty, but a bit brittle; if this breaks in the
future because of optimizer changes, do not hesitate to convert
this into a more pedestrian test case.
2020-08-09 03:54:41 +01:00
David Nadlinger d37503f21d compiler: T{C -> External}Function, clarify docs [nfc] 2020-08-09 03:54:41 +01:00
David Nadlinger 8f518c6b05 compiler: Allow `None` in type hints
Similar to how Python itself interprets None as type(None),
make it translate to TNone in ARTIQ compiler type hints.
2019-12-19 09:36:45 +08:00
David Nadlinger 594ff45750 compiler: Revert support for `None` as `TNone`
This was mistakenly included in fb2b634c4a, and broke the test
case verifying that using None as an ARTIQ type annotation in fact
generates an error message.
2019-12-18 13:23:40 +00:00
David Nadlinger fb2b634c4a compiler, language: Implement @kernel_from_string
With support for polymorphism (or type erasure on pointers to
member functions) being absent in the ARTIQ compiler, code
generation is vital to be able to implement abstractions that
work with user-provided lists/trees of objects with uniform
interfaces (e.g. a common base class, or duck typing), but
different concrete types.

@kernel_from_string has been in production use for exactly
this use case in Oxford for the better part of a year now
(various places in ndscan).

GitHub: Fixes #1089.
2019-12-18 10:51:04 +08:00
David Nadlinger f9af058b96 compiler: Quote tuples as TTuple values
Previously, they would end up being TInstances,
rendering them useless.
2019-03-31 23:40:21 +08:00
whitequark 49682d0159 Improve Python 3.7 compatibility.
async is now a full (non-contextual) keyword.

There are two more instances:
   - artiq/frontend/artiq_client.py
   - artiq/devices/thorlabs_tcube/driver.py

It is not immediately clear how to fix those, so they are left for
later work.
2019-01-12 13:17:59 +00:00
whitequark f7e08ec46b Unbreak f35f1001. 2018-04-28 01:03:08 +00:00
whitequark f35f100110 compiler: don't crash printing locations of specialized functions.
Fixes #987.
2018-04-28 00:49:25 +00:00
whitequark e9564b15c8 compiler: add support for bytearray type (#714). 2017-06-09 07:15:24 +00:00
whitequark dba4e1a28b compiler: add support for bytes type and b"x" literals (#714). 2017-06-09 07:10:48 +00:00
whitequark bb64992395 compiler: remove dead code. 2017-04-21 18:38:43 +00:00
whitequark 3a1fc729cf compiler: refactor type annotations recognizing in kernels.
The new implementation is much more generic, more robust,
and shares code with the same for syscalls as well as RPCs.

Fixes #713.
2017-04-13 08:26:10 +00:00
whitequark 1bd4d13391 artiq_compile: make print() write to core log, not an invalid op.
Fixes #710.
2017-04-11 03:16:34 +00:00
whitequark 8c9f157563 compiler.embedding: fix an overly lax hasher. 2017-03-02 15:28:24 +00:00
whitequark 4107938fd8 compiler.embedding: use attribute count in fixpoint condition.
Before this commit, we had a hack where inferencing would run
one more time, in case we can still infer more attributes even
after all the type information is there. This doesn't work
if *that* round of inferencing brings even more code, e.g.
this is easy to trigger with context managers.
2017-02-28 21:28:40 +00:00
whitequark 6acdcbb82a Fix 2f37b1d. 2017-01-30 10:25:11 +00:00
whitequark 2f37b1d1c0 compiler: support methods defined on singleton instances.
Fixes #638.
2017-01-30 10:10:21 +00:00
whitequark b5a684830d compiler: fix parsing of TList annotations (fixes #632). 2016-12-05 03:18:56 +00:00
whitequark cd68577dbc compiler: add support for async RPCs. 2016-10-30 00:57:31 +00:00
whitequark ed60ba8c4c compiler: skip kernel_invariant linting for exception types. 2016-09-14 23:34:57 +00:00
whitequark feeb089505 compiler: warn about unused kernel_invariant entries.
Fixes #543.
2016-09-14 23:28:55 +00:00
whitequark 5a2306ae5a compiler.embedding: implement type annotations for function arguments.
Fixes #318.
2016-08-08 03:28:25 +00:00
whitequark 5a79fcf9ba embedding: reimplement 373578bc properly.
The core of the problem that 373578bc was attempting to solve is
that diagnostics sometimes should be chained; one way of chaining
is the loc.expanded_from feature, which handles macro-like expansion,
but another is providing context.

Before this commit, context was provided using an ad-hoc override
of a diagnostic engine, which did not work in cases where diagnostic
engine was not threaded through the call stack. This commit uses
the newly added pythonparser context feature to elegantly handle
the problem.
2016-07-07 11:49:21 +00:00
whitequark 373578bc02 embedding: fix location for diagnostics on quoted values.
Fixes #489.
2016-07-07 08:32:56 +00:00
whitequark d90fd7dc00 compiler: implement numpy.full (#424). 2016-07-07 06:33:38 +00:00
whitequark 7a671fb2fd embedding: treat numpy.{int32,int64,array} specially (#424).
Also, remove them from prelude to not pollute the namespace.
2016-07-07 06:33:38 +00:00
whitequark 933ea53c77 compiler: add basic numpy array support (#424). 2016-07-06 09:51:57 +00:00
whitequark 906db876a6 language: replace coredevice int with numpy.{int32,int64}.
Fixes #453.
2016-07-06 04:44:21 +00:00
whitequark ef2af8c331 compiler.embedding: use the builtin print as RPC.
Fixes #206.
2016-06-28 04:42:41 +00:00
whitequark 21574bdfa9 compiler.embedding: rename user-defined types with identical names.
Fixes #478.
2016-06-22 01:32:01 +00:00
whitequark f2ae24da39 compiler: add support for Python modules.
Fixes #408.
2016-06-21 23:35:07 +00:00
whitequark c0e42bbfc8 compiler.embedding: always do one final inference pass.
Fixes #477.
2016-06-16 14:18:43 +00:00
whitequark 355af3e569 embedding: specialize inherited functions.
Fixes #414.
2016-05-16 15:59:26 +00:00
whitequark 640022122b embedding: refactor some more. 2016-05-16 14:38:09 +00:00
whitequark d085d5a372 embedding: refactor. 2016-05-16 14:38:09 +00:00
whitequark 4e5d752951 compiler: fix quoting of methods (fixes #423). 2016-05-09 12:25:57 +00:00
whitequark f7d83e9bdf compiler: make kernel_invariant an instance, not class, property.
Fixes #409.
2016-04-29 13:06:11 +00:00
whitequark aa0882a06f embedding: ignore empty lines, like annotations, before kernel functions.
Fixes #363.
2016-04-26 02:25:08 +00:00
whitequark a88425b66b compiler: allow RPCing builtin functions.
Fixes #366.
2016-04-26 01:31:17 +00:00
whitequark 1464bae6b7 compiler: don't typecheck RPCs except for return type.
Fixes #260.
2016-04-26 01:12:36 +00:00
whitequark 9cc9e8b276 embedding: s/kernel_constant_attributes/kernel_invariants/g
Requested in #359.
2016-04-06 22:38:31 +00:00
whitequark 1038f1321f compiler: allow specifying per-function "fast-math" flags.
Fixes #351.
2016-03-28 21:44:08 +00:00
whitequark 6f5332f892 compiler: allow flagging syscalls, providing information to optimizer.
This also fixes a crash in test_cache introduced in 1d8b0d46.
2016-03-28 19:56:56 +00:00
whitequark f4e6b18690 compiler: implement kernel constant attributes.
Part of #322.
2016-03-27 16:10:07 +00:00
whitequark 186a564ba8 compiler: make quoted functions independent of outer environment. 2016-03-26 20:46:45 +00:00
whitequark 8d0566661a compiler: quote functions directly instead of going through a local. 2016-03-25 22:35:55 +00:00
whitequark 9492464ed9 Commit missing parts of 78fa5be. 2016-03-18 02:15:36 +00:00