Commit Graph

81 Commits

Author SHA1 Message Date
pca006132 6d00d4dabb nac3artiq: cache python data if possible 2021-12-05 20:30:03 +08:00
pca006132 65bc1e5fa4 nac3artiq: handle name_to_pyid in compilation
python variables can change between kernel invocations
2021-12-05 13:10:54 +08:00
pca006132 2938eacd16 nac3artiq: supports running multiple kernels 2021-12-05 13:10:54 +08:00
Sebastien Bourdeauducq 41f88095a5 min_artiq: add round64, floor64, ceil64 2021-12-04 20:35:52 +08:00
pca006132 c98f367f90 nac3artiq: enables inlining 2021-12-04 17:52:03 +08:00
Sebastien Bourdeauducq 4526c28edb Merge branch 'windows' 2021-12-02 22:26:55 +08:00
Sebastien Bourdeauducq 25fc9db66d cargo: specify inkwell LLVM target explicitly
Windows LLVM linking otherwise breaks on the non-existing targets.
2021-12-02 22:24:33 +08:00
Sebastien Bourdeauducq c683958e4a nac3artiq: clarify comment about virtual class 2021-12-01 22:49:20 +08:00
Sebastien Bourdeauducq 142f82f987 remove debug prints 2021-12-01 22:48:06 +08:00
ychenfo dfd3548ed2 TypeVar and virtual support in Symbol Resolver (#99)
Add `TypeVar` and `virtual` support for Symbol Resolver in nac3artiq and nac3standalone

Reviewed-on: M-Labs/nac3#99
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2021-12-01 22:44:53 +08:00
Sebastien Bourdeauducq 681d85d3be remove debug print 2021-11-28 12:57:28 +08:00
pca006132 b35075245b nac3artiq: remove debug print 2021-11-27 21:29:57 +08:00
pca006132 4b17511b4a Merge branch 'master' into KernelInvariant 2021-11-27 21:29:27 +08:00
ychenfo 4587088835 Constant Default Parameter Support (#98)
Add support for constant default parameter

Reviewed-on: M-Labs/nac3#98
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2021-11-23 07:32:09 +08:00
pca006132 f5ec103c82 nac3artiq: kernel invariant support 2021-11-20 21:15:15 +08:00
pca006132 ba08deada6 nac3core: refactor codegen 2021-11-20 19:50:25 +08:00
Sebastien Bourdeauducq 439cef636f runkernel: improve print_int debug functions 2021-11-19 12:39:57 +08:00
ychenfo 1e47b364c5 nac3artiq: support now-pinning on RISC-V with wide data bus (#97) 2021-11-16 17:37:40 +08:00
Sebastien Bourdeauducq 9ae08d6e3d nac3artiq: add stubs for now-pinning on rv32g (#97) 2021-11-13 12:10:55 +08:00
Sebastien Bourdeauducq d6b92adf70 nac3artiq: add stack guard 2021-11-12 20:03:52 +08:00
Sebastien Bourdeauducq 978eaf16a4 nac3artiq: support RISC-V with and without FPU. Closes #83 2021-11-11 23:43:50 +08:00
Sebastien Bourdeauducq 612b6768c0 nac3artiq: bail early on non-NAC3 classes 2021-11-11 16:35:40 +08:00
Sebastien Bourdeauducq c004da85f7 nac3artiq: drop host-only base classes. Closes #80 2021-11-11 16:08:29 +08:00
Sebastien Bourdeauducq b57b869c49 min_artiq: remove unused imports 2021-11-10 14:01:39 +08:00
Sebastien Bourdeauducq 50f1aca1aa nac3artiq: move module registration list to CPython side
In ARTIQ, we cannot create a global NAC3 object because we do not
know the ISA in advance.
2021-11-07 10:29:14 +08:00
pca006132 ffa89e9308 fix clippy warnings 2021-11-06 23:00:18 +08:00
pca006132 34cf303e6c nac3artiq: modified demo to use KernelInvariants 2021-11-06 22:50:28 +08:00
pca006132 b1e83a1fd4 nac3core: type check invariants
This rejects code that tries to assign to KernelInvariant fields and
methods.
2021-11-06 22:48:08 +08:00
Sebastien Bourdeauducq 7385b91113 nac3artiq: support kernel entry short form from original ARTIQ 2021-11-06 18:41:59 +08:00
Sebastien Bourdeauducq 016cbf2b90 nac3artiq: return bytes in compile_method_to_mem 2021-11-06 14:29:23 +08:00
Sebastien Bourdeauducq 37eae090e5 nac3artiq: fix linker inputs 2021-11-06 14:23:54 +08:00
Sebastien Bourdeauducq 204baabfd2 nac3artiq: add compile_method_to_mem 2021-11-06 14:14:53 +08:00
Sebastien Bourdeauducq 7d66195eae nac3artiq: embed linker script, put intermediate objects in temp dir 2021-11-06 13:04:00 +08:00
Sebastien Bourdeauducq afb94dd299 nac3artiq: move demo to dedicated folder 2021-11-05 18:28:31 +08:00
Sebastien Bourdeauducq d6f0607ff0 nac3artiq: rename class decorator to nac3 2021-11-05 18:08:36 +08:00
Sebastien Bourdeauducq 610448fa73 nac3artiq: include parallel in demo 2021-11-05 18:07:18 +08:00
Sebastien Bourdeauducq e8228710e7 min_artiq: remove unnecessary definitions 2021-11-05 17:50:26 +08:00
Sebastien Bourdeauducq bf7e2c295a integrate nac3parser 2021-11-03 17:11:00 +08:00
Sebastien Bourdeauducq bc0f82cad8 Revert "nac3artiq/codegen: fixed smax problem"
We have LLVM 12 now and can use the intrinsic.

This reverts commit 98d9f73afb.
2021-11-02 14:00:28 +08:00
Sebastien Bourdeauducq 624dfe8cd1 upgrade to LLVM 12 2021-11-02 14:00:20 +08:00
pca006132 e47597bb8a Merge branch 'context-manager' 2021-11-02 11:17:00 +08:00
pca006132 98d9f73afb nac3artiq/codegen: fixed smax problem
It turns out the smax intrinsic I use is a new one that is not supported
in LLVM11. Now implemented with signed integer compare and select.
2021-11-02 11:10:21 +08:00
Sebastien Bourdeauducq b37cf6de08 nac3artiq: share isa->time_fns map 2021-11-01 00:03:15 +08:00
pca006132 083eacc268 with parallel/sequential support
Behavior of parallel and sequential:
Each function call (indirectly, can be inside a sequential block) within a parallel
block will update the end variable to the maximum now_mu in the block.
Each function call directly inside a parallel block will reset the timeline after
execution. A parallel block within a sequential block (or not within any block) will
set the timeline to the max now_mu within the block (and the outer max now_mu will also
be updated).

Implementation: We track the start and end separately.
- If there is a start variable, it indicates that we are directly inside a
parallel block and we have to reset the timeline after every function call.
- If there is a end variable, it indicates that we are (indirectly) inside a
parallel block, and we should update the max end value.

Note: requires testing, it is difficult to inspect the output IR
2021-10-31 23:54:37 +08:00
Sebastien Bourdeauducq 443b95d909 nac3artiq: do not use custom linker script when targeting host 2021-10-31 23:51:50 +08:00
Sebastien Bourdeauducq 8b73a123cc nac3artiq: support compiling for the host 2021-10-31 23:02:21 +08:00
pca006132 84c5201243 with parallel/sequential support
Behavior of parallel and sequential:
Each function call (indirectly, can be inside a sequential block) within a parallel
block will update the end variable to the maximum now_mu in the block.
Each function call directly inside a parallel block will reset the timeline after
execution. A parallel block within a sequential block (or not within any block) will
set the timeline to the max now_mu within the block (and the outer max now_mu will also
be updated).

Implementation: We track the start and end separately.
- If there is a start variable, it indicates that we are directly inside a
parallel block and we have to reset the timeline after every function call.
- If there is a end variable, it indicates that we are (indirectly) inside a
parallel block, and we should update the max end value.

Note: requires testing, it is difficult to inspect the output IR
2021-10-31 17:16:21 +08:00
pca006132 279f47f633 nac3core/codegen: avoid sending unifiers
Previously, we have to copy types from one unification table to another,
and make the table sendable. This requires cloning (processing) the
whole table 3 times per function call which is not efficient and uses
more memory than required when the unification table is large.

We now use a concrete type table to only copy the type we need. This
reduces the overhead as we only need to process the unification table
for once (when we do the function codegen), and reduces memory usage by
a bit (but not noticeable when the unification table is small, i.e. the
types are simple).
2021-10-17 13:02:18 +08:00
pca006132 1f5bea2448 nac3core/codegen: refactor according to #23 2021-10-16 22:17:36 +08:00
pca006132 c4259d14d1 fixed some clippy warnings 2021-10-16 18:08:13 +08:00