-
-
Notifications
You must be signed in to change notification settings - Fork 52
dev call 20210107
Antonio, Carl, Florian, Matti, Ronan, Simon, Tim
Ronan has been doing a trial port of numpy to HPy. The code is available at https://github.com/hpyproject/numpy-hpy/ and there is a pull request containing the initial work, https://github.com/hpyproject/numpy-hpy/pull/2.
So far the PyArray type spec has been converted to an HPy type spec. This paves the way for incrementally migrating the individual array type methods.
A few hacks are required because PyType_FromSpec does not yet support all the type slots numpy uses:
- tp_as_buffer (buffer protocol methods) could not be set using PyType_Slot before Python 3.9. In 3.9 it may now be set using the unlimited API.
- tp_weaklistoffset can not be set using PyType_Slot.
We should investigate extending HPyType_FromSpec to include the cases that PyType_FromSpec does not currently support. We should also ask Victor if he knows what C Python's plans are regarding PyType_Slot and whether the intention is for all slots to be supported eventually.
See https://docs.python.org/3/c-api/type.html#c.PyType_Slot.PyType_Slot.slot for the details on the limitations of PyType_Slot.
The pull request currently only works on C Python because it uses _HPy_GetContext but this should be fairly easy to fix by making the array module an HPy module.
An important next step is to get benchmarks running. We don't expect any performance degredation, but performance is important for numpy, so we should check that there have been no accidental regressions. Numpy has a benchmark suite and to start with we can just run its array benchmarks.
The numpy port has reminded us that we need documentation on how to port an extension, and in particular to make clear that one should start by porting the module definition itself (so that the module becomes an HPy module filled with legacy C API pieces).
There was a discussion of whether we should change "hpy.h" to "HPy.h" in order to match "Python.h". There were no strong opinions, but the concensus seemed to be mildly for keeping "hpy.h".
Antonio has been working on the long awaited debug mode. After trying a few different approaches, it is now written as a C wrapper for the HPyContext.
This wrapper is statically compiled as part of each HPy universal implementation, but the intention is that the C code can be shared as is across all implementations (CPython, PyPy, GraalPython, etc).
See https://github.com/hpyproject/hpy/pull/142 for the progress so far.
After a long discussion in https://github.com/hpyproject/hpy/issues/122, it was decided to implement HPy_CallTupleDict(HPy callable, HPy args, HPy kw) where args is a tuple (or null handle) and kw is a dict (or null handle).
The implementation is up for review at https://github.com/hpyproject/hpy/pull/147.
Florian mentioned that calling with a tuple and dict might be faster for GraalPython than calling with C objects because tuple and dict are managed objects (i.e. managed by the JVM) while C objects come with some overhead. From the discussion it was unclear how this trade-off would play out in different scenarios (e.g. if the C objects already exist and have to be packed into a tuple or dictionary) and we'll probably have to wait and see how things turn out in practice.
GraalPython's HPy universal implementation has fallen a bit behind CPython and PyPy's over the holidays, but the intention is that Simon and Florian will update it in the coming week.
- 5 September 2024
- 4 April 2024
- 7 March 2024
- 1 February 2024
- 11 January 2024
- 7 December 2023
- 9 November 2023
- 5 October 2023
- 14 September 2023
- 3 August 2023
- 6 July 2023
- 1 June 2023
- 4 May 2023
- 13 April 2023
- 2 March 2023
- 2 February 2023
- 12 January 2023
- 1 December 2022
- 3 November 2022
- 6 October 2022
- 8 September 2022
- 4 August 2022
- 7 July 2022
- 2 June 2022
- 5 May 2022
- 7 April 2022
- 3 March 2022
- 3 February 2022
- 13 January 2022
- 2 December 2021
- 4 November 2021
- 7 October 2021
- 2 September 2021
- 12 August 2021
- 8 July 2021
- 6 May 2021
- 4 March 2021
- 7 January 2021
- 3 December 2020
- 5 November 2020