Commit Graph

1538 Commits

Author SHA1 Message Date
6265d53ad5 [artiq] Fix intermittent class resolution failures
In the past, modules (and therefore its members) are not added or
analyzed in order of appearance, as it is stored in a HashMap with the
PythonId as its key.

While this never posed an issue in the past, the refactoring performed
in #535 assumed that the classes *are* ordered by appearance, causing
the bug to manifest. Furthermore, this bug will only manifest
iff a base class has a PythonId greater than the derived class,
explaining why the bug only occurs on occasion.

Fix this by using an IndexMap, which preserves the order of insertion
while also performing deduplication.
2025-02-11 17:02:57 +08:00
36d502dc31 [meta] Apply clippy suggestions 2025-02-11 16:52:28 +08:00
82a580c5c6 flake: update ARTIQ source used for PGO 2025-02-10 16:53:35 +08:00
715dc71396 nac3artiq: acquire special python identifiers 2025-02-10 16:42:49 +08:00
064aa0411f [core] codegen: Add Exception{Type,Value} 2025-02-10 11:29:58 +08:00
57552fb2f6 [core] codegen: Add Option{Type,Value} 2025-02-10 11:29:58 +08:00
35e9c5b38e [core] codegen: Add String{Type,Value} 2025-02-10 11:29:58 +08:00
0a761cb263 [core] Use more TupleType constructors 2025-02-10 11:29:58 +08:00
67f42185de [core] codegen/expr: Add concrete ndims value to error message 2025-02-10 11:29:58 +08:00
69542c38a2 [core] codegen: Rename TupleValue::{store,load} -> {insert,extract}
Better matches the underlying operation.
2025-02-10 11:29:55 +08:00
2df22e29f7 [core] codegen: Simplify TupleType::construct 2025-02-10 11:26:45 +08:00
a078481cd2 [meta] Minor simplification for PrimStore extraction 2025-02-10 11:26:45 +08:00
c37c7e8975 [core] codegen/expr: Simplify gen_*_expr_with_values return value
These functions always return `BasicValueEnum` because they operate on
`BasicValueEnum`s, and they also always return a value.
2025-02-10 11:26:45 +08:00
0d8cb909dd [core] codegen/expr: Fix and use gen_unaryop_expr for boolean not ops
While refactoring, I ran into the issue where `!true == true`, which was
caused by the same upper 7-bit of booleans being undefined issue that
was encountered before. It turns out the implementation in
`gen_unaryop_expr` is also inadequate, as `(~v & (i1) 0x1)`` will still
leave upper 7 bits undefined (for whatever reason).

This commit fixes this issue once and for all by using a combination of
`icmp` + `zext` to ensure that the resulting value must be `0 | 1`, and
refactor to use that whenever we need to invert boolean values.
2025-02-10 11:26:45 +08:00
529fa67855 [core] codegen: Add bool_to_int_type to replace bool_to_{i1,i8}
Unifies the implementation for both functions.
2025-02-10 11:26:45 +08:00
f52ba9f151 [core] codegen/irrt: Refactor IRRT to use more create/infer fns 2025-02-10 10:56:24 +08:00
6bcdc3ce00 [core] codegen/extern_fns: Change expansion pattern
Makes more sense to attach the parameter delimiter to the end of each
parameter.
2025-02-10 10:56:22 +08:00
c32c68b0b0 flake: update dependencies 2025-02-05 15:42:23 +08:00
d394b24304 [meta] flake: Add LLVM bintools to artiq-{instrumented,pgo} 2025-02-03 13:10:13 +08:00
68da9b0ecf [core] codegen: Implement StructProxy on existing proxies 2025-02-03 11:51:57 +08:00
eec62c3bbb [core] codegen: Refactor StructField getters and setters 2025-02-03 11:51:57 +08:00
b521bc0c82 [core] codegen: Add Proxy{Type,Value}::as_abi_{type,value}
Needed for PtrToOrBasic{Type,Value}.
2025-02-03 11:51:57 +08:00
96e98947cc [core] codegen: Add StructProxy{Type,Value} 2025-02-03 11:51:57 +08:00
87a637b448 [core] codegen: Refactor Proxy{Type,Value} for StructProxy{Type,Value} 2025-02-03 11:51:57 +08:00
bdeeced122 [core] codegen: Normalize RangeType factory functions
Better matches factory functions of other ProxyTypes.
2025-02-03 11:51:57 +08:00
37df08b803 [meta] Update dependencies 2025-02-03 11:51:57 +08:00
05fd1a5199 [meta] Use lld as linker 2025-02-03 10:56:35 +08:00
f817d3347b [artiq] cleanup module functionality tests 2025-01-20 10:24:08 +08:00
2d275949b8 move tests from artiq to standalone 2025-01-17 13:10:35 +08:00
2783834cb1 nac3artiq/demo: merge EmbeddingMap into min_artiq 2025-01-17 12:45:51 +08:00
879b063968 [artiq] add tests for module support 2025-01-16 12:42:13 +08:00
14e80dfab7 update snapshots 2025-01-16 12:41:30 +08:00
5fdbc34b43 [core] implement codegen for modules 2025-01-16 12:40:56 +08:00
32f24261f2 [artiq] add global variables to modules 2025-01-16 12:40:14 +08:00
ce40a46f8a [core] add module type 2025-01-16 12:40:06 +08:00
f15a64cc1b [artiq] register modules 2025-01-16 11:13:04 +08:00
7fac801936 [artiq] add module primitive type 2025-01-16 11:13:04 +08:00
febfd1241d [core] add module type 2025-01-16 11:13:04 +08:00
4bd5349381 [core] add attributes to class string 2025-01-16 11:13:04 +08:00
c15062ab4c msys2: update 2025-01-15 21:33:58 +08:00
933804e270 update dependencies 2025-01-15 21:18:45 +08:00
1cfaa1a779 [core] toplevel: Implement np_{any,all} 2025-01-15 16:09:32 +08:00
18e8e5269f [core] codegen/values/ndarray: Add fold utilities
Needed for np_{any,all}.
2025-01-15 16:09:32 +08:00
357970a793 [core] codegen/stmt: Add build_{break,continue}_branch functions 2025-01-15 16:09:32 +08:00
762a2447c3 [core] codegen: Remove obsolete comments
Comments regarding the need for `llvm.stack{save,restore}` is obsolete
now that `NDIter::indices` is allocated at the beginning of the
function.
2025-01-15 16:09:32 +08:00
8e614d83de [core] codegen: Add ProxyType::new overloads and refactor to use them 2025-01-15 13:23:19 +08:00
bd66fe48d8 [core] codegen: Refactor to use CodeGenContext::get_size_type
Simplifies a lot of API usage.
2025-01-15 13:23:19 +08:00
c59fd286ff [artiq] Move get_llvm_* to Isa, use TargetMachine to infer size_t 2025-01-15 13:23:19 +08:00
f8530e0ef6 [core] codegen: Add CodeGenContext::get_size_type
Convenience method for getting the `size_t` LLVM type without the use of
`CodeGenerator`.
2025-01-15 13:22:50 +08:00
3ebd4ba5d1 [core] codegen: Add assertion verifying size_t is compatible 2025-01-14 18:25:00 +08:00