-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use cppyy for JIT #2306
feat: use cppyy for JIT #2306
Conversation
Codecov Report
Additional details and impacted files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpivarski - I guess, this convert
function can be our dunder/magic method that @wlav can call when cppyy sees an awkward.Array
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpivarski - please, have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good so far!
Don't worry about any copy-by-value of data structures smaller than, say, 64 bytes. The 2-value tuple (struct { ssize_t length; ssize_t* ptr }
, 16 bytes) is fine to copy, and the small ArrayViews are even bigger (32 bytes, I think). Also, the hand-off between Python and C++ has a lot more overhead than copying an object.
Some questions:
- Does this still work if a function takes two array arguments? (That's something that can't be done in RDataFrame, a motivation for this more direct kind of interface.) The user-written template should have two template parameters.
- If a function is called on the same array twice, does it get recompiled? Hopefully not.
- If a function is called on the same Form of array twice, does it get recompiled? Hopefully not.
- Will array return values be another PR? As in Numba, you'd only be able to return a direct view of part of the original array that was passed in, not an entirely new array.1 (There's LayoutBuilder for that.) The returned view needs to pass ownership, just as it does in Numba. This is the reason that all ArrayViews in Numba carry a
PyObject*
, and that has to be passed in, a third argument ofcpppars
, along withlength
andptr
.
Footnotes
-
One use-case for being able to return a part of the original array is to be able to write a function that iterates through an array and stops and returns a record of interest. ↩
For consistency, I ended up calling the implicit method This is in repo master. I cut 3.0.0 yesterday, b/c Windows and now also Mac no longer support Clang9, but it's been a bit of a rush job and I've already found some issues, so I hope to cut 3.0.1 soon. |
* fix: expose array interface for CUDA * test: cover other cases
* docs: fix missing Python kernel! * docs: fix pyodide-build
Thanks, @wlav ! Everything works with @jpivarski - I've restricted the @agoose77 - please, have a look if the comments are understandable. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jpivarski - everything works as expected!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After committing the suggested changes, I think it's ready to go.
Yes, documentation next would be great, thanks!
Co-authored-by: Jim Pivarski <jpivarski@users.noreply.github.com>
Co-authored-by: Jim Pivarski <jpivarski@users.noreply.github.com>
@ianna cool! This will be so useful going forward 😎 Sorry only get these comments in after merging, I was eating! Just to check — this is a pretty niche method; most Array's won't be using cppyy. I wonder whether we should exclusively move this to an Secondly, could we rename this to I can make a PR if people agree on any of these suggestions. |
@agoose77 Actually, I recommended the public property in In general, we try to keep the Although the fraction of physicists using cppyy directly may be small because of the interference of ROOT1, there's no such issue for general-science use-cases. Depending on how we manage to promote it, this interface may not be so niche. Most of the general-science users of Awkward so far have found the Numba bridge to be an essential feature, and there are things you can't do with Numba, such as connect to libraries that use C++ types in the interfaces. (Also, dealing with specialized types in Numba, such as convincing it to use 32-bit floats, is cumbersome.) If you want to add the underscore, so that we have Footnotes
|
Fine! For posterity, my motivations to remove this from the namespace are:
And probably some other ones ... can't remember! I consider, however, that we're probably already on the same page; in your view, the pros outweigh the cons? As such, I'll make a PR just to rename the attribute! :) Thanks team. |
@agoose77 - I think, I prefer a method because we have to keep a |
Hmm, yes, good point. In this case the solution would be to only hide the public We have a similar L3-L4 problem with contents, but in that case we have a protocol system ( Given how niche a name |
I forgot that it also has to change the state of the If you remember, I kind-of also wanted to get rid of the This is the same argument for having a |
Agreed. In the phase space of "how convenient would this be — how often would users do this — how valuable a name is this", I think we will need to make decisions that appear inconsistent if you look at only one of these axes, but it's the holistic picture that we should be considering. On balance, the convenience of |
No description provided.