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
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
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
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
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
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
d1dcfa19ff
CodeGenerator: Add with_target_machine factory function
...
Allows creating CodeGenerator with the LLVM target machine to infer the
expected type for size_t.
2025-01-13 14:55:33 +08:00
8baf111734
[meta] Apply clippy suggestions
2025-01-06 17:11:31 +08:00
2271b46b96
[core] codegen/values/ndarray: Fix Vec allocation
2025-01-06 16:53:33 +08:00
12fddc3533
[core] codegen/ndarray: Make ndims non-optional
...
Now that everything is ported to use strided impl, dynamic-ndim ndarray
instances do not exist anymore.
2025-01-03 15:43:08 +08:00
3ac1083734
[core] codegen: Reimplement np_dot() for scalars and 1D
...
Based on 693b7f37
: core/ndstrides: implement np_dot() for scalars and 1D
2025-01-03 15:43:08 +08:00
66b8a5e01d
[core] codegen/ndarray: Reimplement matmul
...
Based on 73c2203b
: core/ndstrides: implement general matmul
2025-01-03 15:43:06 +08:00
ebbadc2d74
[core] codegen: Reimplement ndarray cmpop
...
Based on 56cccce1
: core/ndstrides: implement cmpop
2025-01-03 15:15:13 +08:00
a2f1b25fd8
[core] codegen: Reimplement ndarray unary op
...
Based on bb992704
: core/ndstrides: implement unary op
2025-01-03 15:15:12 +08:00
59f19e29df
[core] codegen: Reimplement ndarray binop
...
Based on 9e40c834
: core/ndstrides: implement binop
2025-01-03 15:15:12 +08:00
6cbba8fdde
[core] codegen: Reimplement builtin funcs to support strided ndarrays
...
Based on 7f3c4530
: core/ndstrides: update builtin_fns to use ndarray
with strides
2025-01-03 15:15:12 +08:00
e6dab25a57
[core] codegen/ndarray: Add NDArrayOut, broadcast_map, map
...
Based on fbfc0b29
: core/ndstrides: add NDArrayOut, broadcast_map and map
2025-01-03 15:15:11 +08:00
2dc5e79a23
[core] codegen/ndarray: Implement subscript assignment
...
Based on 5bed394e
: core/ndstrides: implement subscript assignment
Overlapping is not handled. Currently it has undefined behavior.
2025-01-03 15:15:11 +08:00
dcde1d9c87
[core] codegen/values/ndarray: Add more ScalarOrNDArray utils
...
Based on f731e604
: core/ndstrides: add more ScalarOrNDArray and
NDArrayObject utils
2025-01-03 15:15:10 +08:00
7375983e0c
[core] codegen/ndarray: Implement np_transpose without axes argument
...
Based on 052b67c8
: core/ndstrides: implement np_transpose() (no axes
argument)
The IRRT implementation knows how to handle axes. But the argument is
not in NAC3 yet.
2025-01-03 15:15:08 +08:00
43e440d2fd
[core] codegen/ndarray: Reimplement broadcasting
...
Based on 9359ed96
: core/ndstrides: implement broadcasting &
np_broadcast_to()
2025-01-03 15:14:59 +08:00
8d975b5ff3
[core] codegen/ndarray: Implement np_reshape
...
Based on 926e7e93
: core/ndstrides: implement np_reshape()
2025-01-03 14:56:16 +08:00
aae41eef6a
[core] toplevel: Add view functions category
...
Based on 9e0f636d
: core: categorize np_{transpose,reshape} as 'view
functions'
2025-01-03 14:47:59 +08:00
132ba1942f
[core] toplevel: Implement np_size
...
Based on 2c1030d1
: core/ndstrides: implement np_size()
2025-01-03 14:16:29 +08:00