Commit Graph

129 Commits (e1ddbf8fdd984611a52a513dd5bf7f83ef905b06)

Author SHA1 Message Date
A. R. Shajii e1ddbf8fdd Add _PyArg_Parser definition 2023-03-11 11:04:56 -05:00
Ibrahim Numanagić 417be680b6 Add no-suspend yield support 2023-03-05 10:30:52 -08:00
A. R. Shajii 7f82194c06 clang-format; add copyright 2023-03-04 16:32:13 -05:00
A. R. Shajii 3adb42b3b9 Fix PyErrors 2023-03-04 16:26:36 -05:00
A. R. Shajii 921cf74ce2 Update Python object conversions 2023-03-04 16:22:03 -05:00
Ibrahim Numanagić 3ab03b9c3b Python compat fixes 2023-03-03 20:36:44 -08:00
Ibrahim Numanagić 12d21ff5eb Add static reflection methods (setattr; internal.static.*); refactor PyExt to python.codon; handle errors and kwargs in PyExt 2023-03-02 21:59:42 -08:00
A. R. Shajii d0461d572f Fix annotation 2023-02-27 10:28:50 -05:00
A. R. Shajii 732dfcbab3 Add __try_from_py__ API 2023-02-23 13:15:08 -05:00
Ibrahim Numanagić f3f3e7ee91 Fix POD type unification with tuples 2023-02-22 12:24:06 -08:00
Ibrahim Numanagić 407a2f089e Add iter support 2023-02-20 10:20:33 -08:00
Ibrahim Numanagić 93dfcb5862 Add Py support for cmp/setitem 2023-02-18 14:39:04 -08:00
A. R. Shajii cbac1b8840 Update codegen/passes 2023-02-15 09:48:29 -05:00
Ibrahim Numanagić d746ea70cc Fix assert 2023-02-14 18:24:06 -08:00
A. R. Shajii a29ea1cde3 Update python module 2023-02-14 21:19:08 -05:00
A. R. Shajii f98018cf80 Add guards 2023-02-14 12:28:43 -05:00
A. R. Shajii 7fd8ff3af7 Fix C imports 2023-02-14 11:35:11 -05:00
A. R. Shajii 6e9d9d1046 Add static Python link option 2023-02-14 11:26:35 -05:00
Ibrahim Numanagić 3b0d277e30 Add support for typePtrHook and new to/from_py hooks 2023-02-12 12:20:33 -08:00
A. R. Shajii 573f3f68c5 PyType codegen (WIP) 2023-02-11 17:55:05 -05:00
Ibrahim Numanagić 92f9a274e7 Add support for @pycapture 2023-02-10 18:21:48 -08:00
Ibrahim Numanagić db089a79f7 Add special calls for no-suspend yield-expr 2023-02-09 10:41:44 -08:00
Ibrahim Numanagić 33933f44e1 Remove need for import python 2023-02-05 12:53:05 -08:00
Ibrahim Numanagić ba2b672dd0 Merge branch 'pyext' of github.com:exaloop/codon into pyext 2023-02-05 12:48:12 -08:00
Ibrahim Numanagić 8a7a5299a3 Merge branch 'bug-fixes' into pyext 2023-02-05 12:44:49 -08:00
Ibrahim Numanagić 49d9097e94 Fix #156 2023-02-05 11:51:57 -08:00
Ibrahim Numanagić b74601244d Fix #190 2023-02-05 11:13:58 -08:00
Ibrahim Numanagić c97a8245b6 Fix vtable init; Fix failing tests on Linux 2023-02-05 10:45:32 -08:00
A. R. Shajii c7080d2d2f Convert Codon exceptions to Python exceptions 2023-02-05 10:55:06 -05:00
Ibrahim Numanagić 8ea7993302 Fix #155 2023-01-30 17:26:47 -08:00
Ibrahim Numanagić 88316988f0 Fix #162; Fix #135 2023-01-30 16:35:36 -08:00
A. R. Shajii 999e42664e Auto-convert Codon exceptions to Python exceptions 2023-01-30 15:32:27 -05:00
A. R. Shajii 95f28e11a6 Fix argument check 2023-01-29 22:10:22 -05:00
A. R. Shajii 84d15020ac Handle different argument counts efficiently 2023-01-29 13:55:19 -05:00
A. R. Shajii bac6ae58dd
Generator argument optimization (and more) (#175)
* Fix ABI incompatibilities

* Fix codon-jit on macOS

* Fix scoping bugs

* Fix .codon detection

* Handle static arguments in magic methods; Update simd; Fix misc. bugs

* Avoid partial calls with generators

* clang-format

* Add generator-argument optimization

* Fix typo

* Fix omp test

* Make sure sum() does not call __iadd__

* Clarify difference in docs

* Fix any/all generator pass

* Fix  InstantiateExpr simplification; Support .py as module extension

* clang-format

* Bump version

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2023-01-17 10:21:59 -05:00
A. R. Shajii 0bec6e2627
Refactor IR; updates for 2023 (#157)
* Refactor IR

* Update image size in docs
2023-01-08 14:24:10 -05:00
A. R. Shajii 0a08303870 Update format error checking
Simplifies LLVM IR output when not using format strings
2023-01-05 11:40:49 -05:00
A. R. Shajii fd43d67f28
Optimize list additions (#143)
* Optimize list additions

* Fix helper bug

* Add tests

* Add more magic name constants

* Minor API cleanup

* Format

* Slightly improve appends
2022-12-30 23:04:29 -05:00
Haris Smajlović 39eef25940
UInt[N] constructor bugfix (#126)
* UInt[N](-1) bugfix

* Popcnt tests extended
2022-12-23 12:46:29 -05:00
A. R. Shajii f4323a80a2
Fix miscellaneous issues (#85)
* Fix #75

* Build on macOS 11 for #72

* Fix #76

* Fix test

* Fix generator example in docs

* Fix Python/Cython packaging; Fix #80

* Fix tests

* Fix tests

* Fix tests

* Fix tests

* Fix syntax

* Fix CI

* Fix CI

* Fix CI; Dominate imported bindings

* Fix CI; Dominate imported bindings

* Fix .gitignore

* Fix tests

* Fix rm command

* Format

* clang-format

* Organize and optimize string formatting

* Fix format error message

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2022-12-12 20:54:01 -05:00
Ibrahim Numanagić 5de233a64e
Dynamic Polymorphism (#58)
* Use Static[] for static inheritance

* Support .seq extension

* Fix #36

* Polymorphic typechecking; vtables [wip]

* v-table dispatch [wip]

* vtable routing [wip; bug]

* vtable routing [MVP]

* Fix texts

* Add union type support

* Update FAQs

* Clarify

* Add BSL license

* Add makeUnion

* Add IR UnionType

* Update union representation in LLVM

* Update README

* Update README.md

* Update README

* Update README.md

* Add benchmarks

* Add more benchmarks and README

* Add primes benchmark

* Update benchmarks

* Fix cpp

* Clean up list

* Update faq.md

* Add binary trees benchmark

* Add fannkuch benchmark

* Fix paths

* Add PyPy

* Abort on fail

* More benchmarks

* Add cpp word_count

* Update set_partition cpp

* Add nbody cpp

* Add TAQ cpp; fix word_count timing

* Update CODEOWNERS

* Update README

* Update README.md

* Update CODEOWNERS

* Fix bench script

* Update binary_trees.cpp

* Update taq.cpp

* Fix primes benchmark

* Add mandelbrot benchmark

* Fix OpenMP init

* Add Module::unsafeGetUnionType

* UnionType [wip] [skip ci]

* Integrate IR unions and Union

* UnionType refactor [skip ci]

* Update README.md

* Update docs

* UnionType [wip] [skip ci]

* UnionType and automatic unions

* Add Slack

* Update faq.md

* Refactor types

* New error reporting [wip]

* New error reporting [wip]

* peglib updates [wip] [skip_ci]

* Fix parsing issues

* Fix parsing issues

* Fix error reporting issues

* Make sure random module matches Python

* Update releases.md

* Fix tests

* Fix #59

* Fix #57

* Fix #50

* Fix #49

* Fix #26; Fix #51; Fix #47; Fix #49

* Fix collection extension methods

* Fix #62

* Handle *args/**kwargs with Callable[]; Fix #43

* Fix #43

* Fix Ptr.__sub__; Fix polymorphism issues

* Add typeinfo

* clang-format

* Upgrade fmtlib to v9; Use CPM for fmtlib; format spec support; __format__ support

* Use CPM for semver and toml++

* Remove extension check

* Revamp str methods

* Update str.zfill

* Fix thunk crashes [wip] [skip_ci]

* Fix str.__reversed__

* Fix count_with_max

* Fix vtable memory allocation issues

* Add poly AST tests

* Use PDQsort when stability does not matter

* Fix dotted imports; Fix  issues

* Fix kwargs passing to Python

* Fix #61

* Fix #37

* Add isinstance support for unions; Union methods return Union type if different

* clang-format

* Nicely format error tracebacks

* Fix build issues; clang-format

* Fix OpenMP init

* Fix OpenMP init

* Update README.md

* Fix tests

* Update license [skip ci]

* Update license [ci skip]

* Add copyright header to all source files

* Fix super(); Fix error recovery in ClassStmt

* Clean up whitespace [ci skip]

* Use Python 3.9 on CI

* Print info in random test

* Fix single unions

* Update random_test.codon

* Fix polymorhic thunk instantiation

* Fix random test

* Add operator.attrgetter and operator.methodcaller

* Add code documentation

* Update documentation

* Update README.md

* Fix tests

* Fix random init

Co-authored-by: A. R. Shajii <ars@ars.me>
2022-12-04 19:45:21 -05:00
A. R. Shajii 2f268843ac Make "object" a non-tuple class 2022-10-22 20:53:25 -04:00
A. R. Shajii e1016f9e9a
Upgrade to LLVM 15 (#56)
* Upgrade to LLVM 15 (WIP)

* Call `setPresplitCoroutine()` on coro LLVM funcs

* Use new pass manager

* Update deps

* Update docs

* Fix exceptions on M1

* Add libunwind

* Use Orc and JITLink for "codon run"

* JITLink integration

* Fix callback

* Fix strbuf, fix GC root registration

* Fix test init

* Fix llvm function

* Fix pickle, float atomics

* Add TargetLibraryAnalysis

* Use new LLVM pass manager in GPU codegen

* Fix libunwind linking

* Fix libunwind

* Fix GPU passes

* Don't link libunwind explicitly

* Bump version

* Update plugins for new pass manager

* Fix bash error

* Fix GPU GV extraction

* Move simd module to experimental folder

* Update file read

* Add benchmark programs

* Add dynamic tuple

* Fix parser tuple slicing bug

* Make DynamicTuple interoperable with Tuple

* Fix DynamicTuple GPU interop

* Dockerize builds

* Simplify CMake

* Revert "Simplify CMake"

This reverts commit 08d2920349.

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2022-10-14 09:31:10 -04:00
A. R. Shajii ea48d68dc5 Fix empty set repr 2022-09-19 09:58:57 -04:00
A. R. Shajii 74bc584393 Improve collection-to-str conversions 2022-09-19 09:55:56 -04:00
A. R. Shajii 8a63e73c82 Use memcpy to concatenate lists 2022-09-18 16:43:42 -04:00
A. R. Shajii ebd344f894
GPU and other updates (#52)
* Add nvptx pass

* Fix spaces

* Don't change name

* Add runtime support

* Add init call

* Add more runtime functions

* Add launch function

* Add intrinsics

* Fix codegen

* Run GPU pass between general opt passes

* Set data layout

* Create context

* Link libdevice

* Add function remapping

* Fix linkage

* Fix libdevice link

* Fix linking

* Fix personality

* Fix linking

* Fix linking

* Fix linking

* Add internalize pass

* Add more math conversions

* Add more re-mappings

* Fix conversions

* Fix __str__

* Add decorator attribute for any decorator

* Update kernel decorator

* Fix kernel decorator

* Fix kernel decorator

* Fix kernel decorator

* Fix kernel decorator

* Remove old decorator

* Fix pointer calc

* Fix fill-in codegen

* Fix linkage

* Add comment

* Update list conversion

* Add more conversions

* Add dict and set conversions

* Add float32 type to IR/LLVM

* Add float32

* Add float32 stdlib

* Keep required global values in PTX module

* Fix PTX module pruning

* Fix malloc

* Set will-return

* Fix name cleanup

* Fix access

* Fix name cleanup

* Fix function renaming

* Update dimension API

* Fix args

* Clean up API

* Move GPU transformations to end of opt pipeline

* Fix alloc replacements

* Fix naming

* Target PTX 4.2

* Fix global renaming

* Fix early return in static blocks; Add __realized__ function

* Format

* Add __llvm_name__ for functions

* Add vector type to IR

* SIMD support [wip]

* Update kernel naming

* Fix early returns; Fix SIMD calls

* Fix kernel naming

* Fix IR matcher

* Remove module print

* Update realloc

* Add overloads for 32-bit float math ops

* Add gpu.Pointer type for working with raw pointers

* Add float32 conversion

* Add to_gpu and from_gpu

* clang-format

* Add f32 reduction support to OpenMP

* Fix automatic GPU class conversions

* Fix conversion functions

* Fix conversions

* Rename self

* Fix tuple conversion

* Fix conversions

* Fix conversions

* Update PTX filename

* Fix filename

* Add raw function

* Add GPU docs

* Allow nested object conversions

* Add tests (WIP)

* Update SIMD

* Add staticrange and statictuple loop support

* SIMD updates

* Add new Vec constructors

* Fix UInt conversion

* Fix size-0 allocs

* Add more tests

* Add matmul test

* Rename gpu test file

* Add more tests

* Add alloc cache

* Fix object_to_gpu

* Fix frees

* Fix str conversion

* Fix set conversion

* Fix conversions

* Fix class conversion

* Fix str conversion

* Fix byte conversion

* Fix list conversion

* Fix pointer conversions

* Fix conversions

* Fix conversions

* Update tests

* Fix conversions

* Fix tuple conversion

* Fix tuple conversion

* Fix auto conversions

* Fix conversion

* Fix magics

* Update tests

* Support GPU in JIT mode

* Fix GPU+JIT

* Fix kernel filename in JIT mode

* Add __static_print__; Add earlyDefines; Various domination bugfixes; SimplifyContext RAII base handling

* Fix global static handling

* Fix float32 tests

* FIx gpu module

* Support OpenMP "collapse" option

* Add more collapse tests

* Capture generics and statics

* TraitVar handling

* Python exceptions / isinstance [wip; no_ci]

* clang-format

* Add list comparison operators

* Support empty raise in IR

* Add dict 'or' operator

* Fix repr

* Add copy module

* Fix spacing

* Use sm_30

* Python exceptions

* TypeTrait support; Fix defaultDict

* Fix earlyDefines

* Add defaultdict

* clang-format

* Fix invalid canonicalizations

* Fix empty raise

* Fix copyright

* Add Python numerics option

* Support py-numerics in math module

* Update docs

* Add static Python division / modulus

* Add static py numerics tests

* Fix staticrange/tuple; Add KwTuple.__getitem__

* clang-format

* Add gpu parameter to par

* Fix globals

* Don't init loop vars on loop collapse

* Add par-gpu tests

* Update gpu docs

* Fix isinstance check

* Remove invalid test

* Add -libdevice to set custom path [skip ci]

* Add release notes; bump version [skip ci]

* Add libdevice docs [skip ci]

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
2022-09-15 15:40:00 -04:00
A. R. Shajii b277586fda Fix tests 2022-08-04 11:59:07 -04:00
Ibrahim Numanagić 48a2bfa57a
Add Cython fixes (decorator arguments, pyvars support) (#42)
* Add Cython fixes (decorator arguments, pyvars support)

* Update CI and README

* Fix problematic test

* Don't track Cython-generated cpp file [ci skip]

* Fix test

* Various codon.jit improvements

* clang-format [ci skip]

* Add docs [ci skip]

* Add docs link

Co-authored-by: A. R. Shajii <ars@ars.me>
2022-08-03 16:36:03 -04:00
A. R. Shajii c128e59132
Annotation updates (#41)
* Fix gitignore, versions

* Add caching (WIP)

* Fix decorator

* Refactor

* Support tuple conversions

* Fix void; allow pyobj default conversion

* Improve setup

* Rename

* Fix JIT output capturing

* Support conversion of "complex"

* Allow class conversions

* Use Python number API

* Use Python API for (get/set/del)item

* Add decorator docs

* Cleanup

* Support slice and optional conversions

* Add comparison magics

* Remove Optional.__invert__() method

* Fix tests

* Fix test

* Add release notes

* New pybridge tests

* Update decorator tests

* Fix optional tuple handling

* Fix optional str() and repr()

* Add more decorator tests

* Fix optional.__bool__

* Update releases.md

* Add op tests

* Organize release notes [skip ci]

* clang-format [skip ci]

* Add r-magics to pyobj; more tests [skip ci]

* More pybridge tests

* Add plugin library paths to build command

* Remove walrus operator [skip ci]

* Fix optional operator handling; Fix right-magic handling

Co-authored-by: Ibrahim Numanagić <ibrahimpasa@gmail.com>
Co-authored-by: Ibrahim Numanagić <inumanag@users.noreply.github.com>
2022-08-02 14:53:17 -04:00