Commit Graph

113 Commits

Author SHA1 Message Date
David Mak 23974feae7 meta: Restrict number of allowed lints 2024-06-12 16:10:57 +08:00
David Mak 40a3bded36 meta: Set clippy lints in {main,lib}.rs
So that this does not have to be manually passed to the `cargo clippy`
command-line every single time. Also allows incrementally addressing
these lints by removing and fixing them one-by-one.
2024-06-12 16:10:57 +08:00
lyken 8168692cc3 apply cargo fmt 2024-06-12 14:45:03 +08:00
David Mak 77de24ef74 core: Use BTreeMap for type variable mapping
There have been multiple instances where I had the need to iterate over
type variables, only to discover that the traversal order is arbitrary.

This commit fixes that by adding SortedMapping, which utilizes BTreeMap
internally to guarantee a traversal order. All instances of VarMap are
now refactored to use this to ensure that type variables are iterated in
 the order of its variable ID, which should be monotonically incremented
 by the unifier.
2024-03-04 23:56:04 +08:00
David Mak 49de81ef1e core: Apply clippy suggestions 2024-02-23 15:41:06 +08:00
David Mak 8492503af2 core: Update cargo dependencies 2024-02-23 15:41:04 +08:00
David Mak 2a922c7480 artiq: Fix source module of NDArray
Should be `numpy.typing` instead of `numpy`.
2024-01-17 10:40:08 +08:00
David Mak c395472094 core: Initial infrastructure for ndarray 2023-12-21 15:39:46 +08:00
David Mak bd792904f9 core: Add size_t to primitive store
Used for ndims in ndarray.
2023-12-21 15:20:31 +08:00
David Mak a19f1065e3 meta: Refactor to use more let-else bindings 2023-12-12 16:31:14 +08:00
David Mak 32746c37be core: Refactor to return errors by HashSet 2023-12-12 15:41:59 +08:00
David Mak beee3e1f7e artiq: Pass artiq builtins to NAC3 constructor 2023-12-12 11:28:03 +08:00
David Mak 95d0c3c93c artiq: Rename const_generic_dummy to const_generic_marker 2023-12-12 11:23:51 +08:00
David Mak bd3d67f3d6 artiq: Apply clippy pedantic changes 2023-12-11 15:16:23 +08:00
David Mak 02933753ca core: Apply clippy pedantic changes 2023-12-11 15:16:23 +08:00
David Mak d304afd333 meta: Apply clippy suggested changes 2023-12-11 15:16:23 +08:00
David Mak ef04696b02 meta: Lift return out of conditional statement 2023-12-11 15:16:23 +08:00
David Mak 5182453bd9 meta: Remove redundant path prefixes 2023-12-11 15:16:23 +08:00
David Mak 983f080ea7 artiq: Implement handling for const generic variables 2023-12-08 18:02:14 +08:00
David Mak 7fc2a30c14 Force single-threaded compilation if LLVM is not thread-safe 2023-10-16 15:55:10 +08:00
David Mak 2a38d5160e meta: Respect opt flags when performing whole-module optimization 2023-09-28 19:58:54 +08:00
David Mak ab2360d7a0 core: Remove emit_llvm from CodeGenLLVMOptions
We instead output an LLVM bitcode file when the option is specified on
the command-line.
2023-09-22 17:16:29 +08:00
David Mak 411837cacd artiq: Specify target CPU when creating LLVM target options
We can try to optimize for the host and Cortex-A9 chips; The RISC-V
ISAs do not target specific chips, so we will fallback to using the
generic CPU.
2023-09-18 11:35:20 +08:00
David Mak 048fcb0a69 core: Switch to LLVM New Pass Manager 2023-09-18 11:35:15 +08:00
David Mak 676d07657a core: Add target field to CodeGenLLVMOptions
For specifying the target machine options when optimizing and linking.

This field is currently unused but will be required in a future
commit.
2023-09-18 09:46:24 +08:00
David Mak 2482a1ef9b core: Add CodeGenTargetMachineOptions
Needed in a future commit.
2023-09-18 09:41:49 +08:00
David Mak 3993a5cf3f core: Add LLVM options to WorkerRegistry 2023-09-12 10:57:05 +08:00
David Mak d37287a33d Cargo: Update dependencies 2023-09-04 10:43:57 +08:00
z78078 8f95b79257 nac3artiq: throw error message when constructor use rpc decorator (#306)
Co-authored-by: z78078 <cc@m-labs.hk>
Co-committed-by: z78078 <cc@m-labs.hk>
2022-07-11 15:55:55 +08:00
z78078 ebd25af38b nac3standalone: allow classes without explicit init (#221)
Reviewed-on: #304
Co-authored-by: z78078 <cc@m-labs.hk>
Co-committed-by: z78078 <cc@m-labs.hk>
2022-07-07 10:36:25 +08:00
occheung 7cb9be0f81 nac3artiq: refactor compile methods
Avoids writing relocatable object to a file when linking with nac3ld.
2022-06-06 14:41:10 +08:00
occheung ac560ba985 nac3artiq: switch ld.lld to nac3ld for non-host target 2022-06-06 14:40:13 +08:00
occheung 48fc5ceb8e nac3artiq: demote global value to private
... except typeinfo & now symbols.
typeinfo will be read by the runtime linker; now is for now-pinning.
2022-05-30 22:46:41 +08:00
ychenfo 09820e5aed nac3artiq: return err instead of panic for host object attribute error 2022-05-18 02:54:42 +08:00
ychenfo ae6434696c nac3artiq: rename the filename of modinit
rename from __nac3_synthesized_modinit__ to <nac3_synthesized_modinit> to be more idomatic python
2022-05-11 03:52:16 +08:00
Sebastien Bourdeauducq 3fb22c9182 nac3artiq: treat host numpy.float64 as float. Closes #90 2022-04-12 10:33:28 +08:00
ychenfo 0e0871bc38 nac3core, artiq: to_basic_value_enum takes an argument indicating the expected type 2022-04-10 01:28:22 +08:00
Sebastien Bourdeauducq 201ca3f63d Revert "nac3artiq: use lld.exe on Windows"
This reverts commit 19182759cd.
2022-03-27 19:09:11 +08:00
Sebastien Bourdeauducq 19182759cd nac3artiq: use lld.exe on Windows 2022-03-27 18:41:38 +08:00
Sebastien Bourdeauducq 0600ee8efa nac3artiq: use correct lld invokation on Windows 2022-03-27 18:25:14 +08:00
pca006132 bf067e2481 nac3artiq: implement attribute writeback
We will only writeback attributes that are supported by the current RPC
implementation: primitives, tuple and lists of lists... of primitives.
2022-03-26 20:13:58 +08:00
ychenfo 80631fc92b Option type support (#224)
Co-authored-by: ychenfo <yc@m-labs.hk>
Co-committed-by: ychenfo <yc@m-labs.hk>
2022-03-26 15:09:15 +08:00
pca006132 1084ba2158 nac3core: fixed typevar with finite range
1. Function type variables should not include class type variables,
   because they are not bound to the function.
2. Defer type variable constraint evaluation until we get all fields
   definition.
2022-03-24 21:31:51 +08:00
pca006132 fb8553311c nac3artiq: remove accidentally added print 2022-03-17 15:13:00 +08:00
pca006132 04e7a7eb4b nac3artiq: support more exceptions 2022-03-17 15:03:22 +08:00
pca006132 642e3b2bad nac3core: moved all builtin errors to nac3artiq code
This remove the need for hard-coding those definition IDs.
2022-03-17 00:04:49 +08:00
pca006132 e126fef012 nac3artiq: support more builtin errors 2022-03-16 23:42:08 +08:00
ychenfo 79c469301a basic unsigned integer support 2022-03-08 13:34:02 +08:00
pca006132 294943e303 nac3core: get exception ID from symbol resolver
We need to store the exception class somewhere in order to create them
back in the host. Fixes #200
2022-03-05 00:26:35 +08:00
pca006132 d1e172501d nac3artiq: remove debug messages 2022-02-28 23:10:05 +08:00