bd66fe48d8
[core] codegen: Refactor to use CodeGenContext::get_size_type
...
Simplifies a lot of API usage.
2025-01-15 13:23:19 +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
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
12358c57b1
[core] codegen/ndarray: Implement np_{shape,strides}
...
Based on 40c24486
: core/ndstrides: implement np_shape() and np_strides()
These functions are not important, but they are handy for debugging.
`np.strides()` is not an actual NumPy function, but `ndarray.strides` is
used.
2025-01-03 13:58:47 +08:00
35e3042435
[core] Refactor/Remove redundant and unused constructs
...
- Use ProxyValue.name where necessary
- Remove NDArrayValue::ptr_to_{shape,strides}
- Remove functions made obsolete by ndstrides
- Remove use statement for ndarray::views as it only contain an impl
block.
- Remove class_names field in Resolvers of test sources
2024-12-30 14:13:48 +08:00
a4f53b6e6b
[core] codegen: Refactor ProxyType and ProxyValue
...
Accepts generator+context object for generic type checking. Also
implements more default trait impl for easier delegation.
2024-11-19 13:46:25 +08:00
9d9ead211e
[core] Move Proxies to their own modules
2024-11-19 13:46:23 +08:00
a98f33e6d1
[meta] Reorganize order of use declarations - Phase 2
...
Some more rules:
- For module-level imports, prefer no prefix > super > crate.
- Use crate instead of super if super refers to the crate-level module
2024-10-17 15:57:33 +08:00
fe06b2806f
[meta] Reorganize order of use declarations
...
Use declarations are now grouped into 4 groups:
- Declarations from the standard library
- Declarations from external crates
- Declarations from other crates in this project
- Declarations from within this module
Furthermore, all use declarations are grouped together to enhance
readability. super::super is also replaced by an equivalent crate::
declaration.
2024-10-04 12:52:01 +08:00
2cf64d8608
apply clippy comment changes
2024-08-21 11:21:10 +08:00
973dc5041a
core/typecheck: Support tuple arg type in len()
2024-08-13 15:02:59 +08:00
9b988647ed
core/toplevel/builtins: Extract len() into builtin function
2024-08-13 15:02:59 +08:00
6a64c9d1de
core/typecheck/typedef: Add is_vararg_ctx to TTuple
2024-08-06 11:45:54 +08:00
cbf79c5e9c
core/typecheck/typedef: Add is_vararg to FuncArg, ConcreteFuncArg
2024-08-06 11:43:13 +08:00
63d2b49b09
core: remove np_linalg_matmul
2024-08-05 11:44:55 +08:00
1c72698d02
core: add np_linalg_det and np_linalg_matrix_power functions
2024-07-31 18:02:54 +08:00
54f883f0a5
core: implement np_dot using LLVM_IR
2024-07-31 15:53:51 +08:00
00236f48bc
core: add np.transpose and np.reshape functions
2024-07-31 13:23:07 +08:00
2242c5af43
core: add linalg methods
2024-07-29 16:48:06 +08:00
8adfe781c5
core/toplevel: fix PrimDef method names
2024-07-27 21:57:47 +08:00
4948395ca2
core/toplevel/type_annotation: Add handling for mismatching class def
...
Primitive types only contain fields in its Type and not its TopLevelDef.
This causes primitive object types to lack some fields.
2024-07-19 14:42:14 +08:00
6c10e3d056
core: cargo clippy
2024-07-12 21:18:53 +08:00
2dbc1ec659
cargo fmt
2024-07-12 21:16:38 +08:00
cea7cade51
core: add np_argmax/np_argmin functions
2024-07-12 18:18:28 +08:00
2cfb7a7e10
core: Refactor range function into constructor
2024-07-09 04:44:40 +08:00
2194dbddd5
core/type_annotation: Refactor List type to TObj
...
In preparation for operators on lists.
2024-07-04 15:32:18 +08:00
5b11a1dbdd
core: support tuple and int32 input for np_empty, np_ones, and more
2024-06-27 14:30:17 +08:00
7fe2c3496c
core: add attribute field to class definition
2024-06-25 16:06:33 +08:00
e85f4f9bd2
core: refactor top_level::builtins::get_builtins()
2024-06-18 11:06:25 +08:00
2abe75d1f4
core: remove code dup with make_exception_fields
2024-06-17 12:01:48 +08:00
676412fe6d
apply cargo fmt
2024-06-14 09:46:42 +08:00
fed1361c6a
core: rename to_var_map to into_var_map
2024-06-13 16:59:10 +08:00
f026b48e2a
core: refactor to use TypeVarId
and TypeVar
2024-06-13 16:59:10 +08:00
c4420e6ab9
core: refactor get_builtins()
2024-06-12 15:09:20 +08:00
fd36f78005
core: refactor PrimitiveDefinitionId
into enum PrimDef
2024-06-12 15:01:01 +08:00
8168692cc3
apply cargo fmt
2024-06-12 14:45:03 +08:00
6153f94b05
core/numpy: Implement codegen for np_array
2024-06-11 16:42:11 +08:00
4730b595f3
core/builtins: Add np_array function
2024-06-11 16:42:08 +08:00
210d9e2334
core: Add more creator functions for ProxyType
2024-06-11 15:26:37 +08:00
520e1adc56
core/builtins: Add np_minimum/np_maximum
2024-05-09 15:01:20 +08:00
73e81259f3
core/builtins: Add np_min/np_max
2024-05-09 15:01:20 +08:00
30c6cffbad
core/builtins: Refactored numpy builtins to accept scalar and ndarrays
2024-05-06 15:38:29 +08:00
51671800b6
core/builtins: Extract codegen portion into functions
...
We will need to reuse them when implementing elementwise function
application for ndarrays.
2024-05-06 13:21:54 +08:00
7195476edb
core/builtins: Add llvm_intrinsics prefix
2024-05-06 13:21:54 +08:00
eecba0b71d
core: Add GenCall::create_dummy
...
A simple abstraction for GenCalls that are already handled elsewhere.
2024-05-06 13:21:54 +08:00
f58c3a11f8
core/builtins: Rework handling of PrimitiveStore-Unifier tuples
2024-05-06 13:21:54 +08:00