David Mak
57da0f67d1
[core] codegen: Implement NDArray functions from a0a1f35b
2024-11-29 17:25:50 +08:00
David Mak
624e943cd6
[core] codegen/irrt: Add IRRT functions for strided-ndarray
2024-11-29 17:25:50 +08:00
David Mak
a99ae4828a
[core] Add itemsize and strides to NDArray struct
...
Temporarily disable linalg ndarray tests as they are not ported to work
with strided-ndarray.
2024-11-29 17:25:50 +08:00
David Mak
acfa81ff60
[core] codegen: Add helper functions for create+call functions
...
Replacement for various FnCall methods from legacy ndstrides
implementation.
2024-11-29 17:25:50 +08:00
David Mak
35ef3c3f27
[core] codegen: Add call_memcpy_generic_array
...
Replacement for Instance<Ptr>::copy_from from legacy ndstrides
implementation.
2024-11-29 17:25:50 +08:00
David Mak
cb6faeabb6
[core] Add type_aligned_alloca
2024-11-29 17:25:49 +08:00
David Mak
47fba32926
[core] codegen/types: Add docs for NDArrayType::fields
2024-11-29 17:19:46 +08:00
David Mak
4cfa848399
[core] Expose irrt::ndarray
2024-11-29 17:19:46 +08:00
David Mak
355c051886
[core] codegen/ndarray: Cleanup
...
- Remove redundant size param
- Add *_field functions
2024-11-29 17:19:46 +08:00
David Mak
363e1a1f84
[core] Move alloca and map_value of ProxyType to implementations
...
These functions may not be invokable by the same set of parameters as
some classes has associated states.
2024-11-29 17:19:46 +08:00
David Mak
a3c1d469fc
[core] codegen/types: Rename StructField::set_from_value
2024-11-29 17:19:46 +08:00
David Mak
814dda55d7
[meta] Remove all mentions of build_int_cast
...
build_int_cast performs signed extension or truncation depending on the
source and target int lengths. This is usually not what we want - We
want zero-extension instead.
Replace all instances of build_int_cast with
build_int_z_extend_or_bit_cast to fix this issue.
2024-11-29 17:19:43 +08:00
David Mak
10894085bb
[core] codegen: Move ndarray type/value as a separate module
2024-11-29 15:44:16 +08:00
abdul124
babc081dbd
core/toplevel: update tests
2024-11-27 14:31:57 +08:00
abdul124
5337dbe23b
core/toplevel: add python-like error messages for class definition
2024-11-27 14:31:57 +08:00
abdul124
f862c01412
core/toplevel: refactor composer
2024-11-27 14:31:53 +08:00
David Mak
28f574282c
[core_derive] Ignore doctest in example
...
Causes linker errors for unknown reasons.
2024-11-22 00:00:05 +08:00
David Mak
144f0922db
[core] coregen/types: Implement StructFields for NDArray
...
Also rename some fields to better align with their naming in numpy.
2024-11-21 14:27:00 +08:00
David Mak
c58ce9c3a9
[core] codegen/types: Implement NDArray in terms of i8*
...
Better aligns with the future implementation of ndstrides.
2024-11-21 14:27:00 +08:00
David Mak
f7e296da53
[core] irrt: Break IRRT into several impl files
...
Each IRRT file is now mapped to one Rust file.
2024-11-21 14:27:00 +08:00
David Mak
b58c99369e
[core] irrt: Update some IRRT implementation
...
- Change CSlice to use `void*` for better pointer compatibility
- Only include impl *.hpp files in irrt.cpp
- Refactor typedef to using declaration
- Add missing ``// namespace`
2024-11-21 14:26:58 +08:00
David Mak
1a535db558
[core] codegen: Add dtype to NDArrayType
...
We won't have this once NDArray is refactored to strided impl.
2024-11-20 15:35:57 +08:00
David Mak
1ba2e287a6
[core] codegen: Add Self::llvm_type to all type abstractions
2024-11-20 15:35:57 +08:00
lyken
f95f979ad3
core/irrt: fix exception.hpp C++ castings
2024-11-20 15:35:57 +08:00
lyken
48e2148c0f
core/toplevel/helper: add {extract,create}_ndims
2024-11-20 15:35:57 +08:00
David Mak
88e57f7120
[core_derive] Initial implementation
2024-11-20 15:35:55 +08:00
David Mak
d7633c42bc
[core] codegen/types: Implement StructField{,s}
...
Loosely based on FieldTraversal by lyken.
2024-11-19 13:46:25 +08:00
David Mak
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
David Mak
9d9ead211e
[core] Move Proxies to their own modules
2024-11-19 13:46:23 +08:00
David Mak
26a1b85206
[core] codegen/classes: Remove Underlying type
...
This is confusing and we want a better abstraction than this.
2024-11-19 13:45:55 +08:00
David Mak
2822074b2d
[meta] Cleanup from upgrading Rust version
...
- Remove rust_2024_edition warnings, since it wouldn't be released for
another 3 months
- Fix new clippy warnings
2024-11-19 13:43:57 +08:00
Sebastien Bourdeauducq
2cee760404
turn rust_2024_compatibility lints into warnings
2024-11-16 13:41:49 +08:00
occheung
2bd3f63991
boolop: terminate both branches with *_end_bb
2024-11-16 12:06:20 +08:00
occheung
979209a526
binop: expand `not` operator as loglcal not
2024-11-08 17:12:01 +08:00
David Mak
b6cd2a6993
[meta] Reorganize order of use declarations - Phase 3
2024-10-17 16:25:52 +08:00
David Mak
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
David Mak
56c845aac4
[standalone] Add support for registering globals without type decl
2024-10-07 20:44:06 +08:00
David Mak
65a12d9ab3
[core] Refactor registration of top-level variables
2024-10-07 17:05:48 +08:00
David Mak
9c6685fa8f
[core] typecheck/function_check: Fix lookup of defined ids in scope
2024-10-07 16:51:37 +08:00
David Mak
2bb788e4bb
[core] codegen/expr: Materialize implicit globals
...
Required for when globals are read without the use of a global
declaration.
2024-10-07 13:13:20 +08:00
David Mak
42a2f243b5
[core] typecheck: Disallow redeclaration of var shadowing global
2024-10-07 13:11:00 +08:00
David Mak
3ce2eddcdc
[core] typecheck/type_inferencer: Infer whether variables are global
2024-10-07 13:10:46 +08:00
David Mak
51bf126a32
[core] typecheck/type_inferencer: Differentiate global symbols
...
Required for analyzing use of global symbols before global declaration.
2024-10-07 12:25:00 +08:00
David Mak
1a197c67f6
[core] toplevel/composer: Reduce lock scope while analyzing function
2024-10-05 15:53:20 +08:00
David Mak
e60e8e837f
[core] Add support for global statements
2024-10-04 13:24:27 +08:00
David Mak
9fdbe9695d
[core] Add generator to SymbolResolver::get_symbol_value
...
Needed in a future commit.
2024-10-04 13:20:29 +08:00
David Mak
8065e73598
[core] toplevel/composer: Add type analysis for global variables
2024-10-04 13:20:29 +08:00
David Mak
192290889b
[core] Add IdentifierInfo
...
Keeps track of whether an identifier refers to a global or local
variable.
2024-10-04 13:20:24 +08:00
David Mak
1407553a2f
[core] Implement parsing of global variables
...
Globals are now parsed into symbol resolver and top level definitions.
2024-10-04 13:18:29 +08:00
David Mak
c7697606e1
[core] Add TopLevelDef::Variable
2024-10-04 13:09:25 +08:00