Conversation
rlamy
left a comment
There was a problem hiding this comment.
Looks good overall. I would prefer the implementation to be complete before merging though. How hard would it be to support like?
| char const *message) | ||
| { | ||
| HPyContext *ctx = npy_get_context(); | ||
| return hpy_string_converter_helper(ctx, HPy_FromPyObject(ctx, object), out, str_func, name, message); |
There was a problem hiding this comment.
The HPy_FromPyObject(ctx, object) handle needs to be closed
| { | ||
| PyArrayObject *ret; | ||
| HPyContext *ctx = npy_get_context(); | ||
| HPy_AsPyObject(ctx, HPyArray_Zeros(ctx, nd, dims, type, is_f_order)); |
| ret = (PyArrayObject *)PyArray_NewFromDescr_int( | ||
| &PyArray_Type, type, | ||
| ret = HPyArray_NewFromDescr_int( | ||
| ctx, HPy_FromPyObject(ctx, (PyObject *)&PyArray_Type), type, |
| return deferred; | ||
| if (!HPy_IsNull(h_typecode)) { | ||
| // HPY TODO: needs PyArray_Descr porting | ||
| PyObject* py_typecode = HPy_AsPyObject(ctx, h_typecode); |
There was a problem hiding this comment.
h_typecode should be closed here, I think
| goto fail; | ||
| } | ||
| } | ||
| if (HPyArray_OrderConverter(ctx, h_order, &order) != NPY_SUCCEED) { |
| goto fail; | ||
| } | ||
|
|
||
| if (!HPy_IsNull(h_like)) { |
| # End 1.21 API | ||
|
|
||
| # HPy API: | ||
| 'HPyArray_Zeros': (307,), |
There was a problem hiding this comment.
I think we shouldn't add HPy functions to the API, but rather, eventually, have a separate function table for the HPy API.
There was a problem hiding this comment.
Yes, agreed. I want to play with this a bit to move forward quicker: we'd like to prototype integration with Matplotlib port too. However, new table will be the way to go longer term.
| PyObject *const *args, Py_ssize_t len_args, PyObject *kwnames) | ||
| HPyDef_METH(array_zeros, "zeros", array_zeros_impl, HPyFunc_KEYWORDS) | ||
| static HPy | ||
| array_zeros_impl(HPyContext *ctx, HPy NPY_UNUSED(ignored), HPy *args, HPy_ssize_t nargs, HPy kw) |
There was a problem hiding this comment.
Hmm, we should probably have const HPy *args in the signature, to match CPython...
| { | ||
| HPy_ssize_t nd; | ||
| npy_intp i; | ||
| HPy op, err; |
Yes, I'll take a look. I am also trying to port |
Merge in ~STEPAN.SINDELAR_ORACLE.COM/numpy-hpy from fa/hpy_global to labs-hpy-port * commit '4f2d3de9229a9c7d2ae6a978cda04ab2262209a8': Use HPyGlobal for global type vars
|
This PR seems to have been quiet for a while. Are there any updates on the numpy hpy project? |
|
Hi @WilliamGazeley, yes, there are updates. In fact, we are actively working on that. It's just that this PR was basically just the initial effort. In order to see our full work, checkout branches graal-team/hpy and graal-team/hpy-0.0.5. Branch We also updated the I encourage you and everyone else to try it out and I'm happy to help in case of problems. |
No description provided.