[FR] Allow SoA for UDFs
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 160
- Forks
- 59
- Avg merge
- 21h 45m
- Merged PRs (30d)
- 26
Description
Is your feature request related to a problem? Please describe.
It would be nice to extend the Struct of Arrays (SoA) framework to support UDFs so that they can be used in reduce_sum and other higher order functions.
Right now if a user calls a higher order function we have to demote every matrix / vector passed to that function to Array of Structs (AoS). This is unfortunate since reduce_sum is very powerful for large independent blocks of data and parameters.
Describe the solution you'd like
I think we can do this by the following
- During the
SoAoptimization pass, when the optimization hits a UDF or a higher order function it starts a sub-call of theSoAoptimization for the UDF. It will just return the list of inputs that cannot beSoAand then continue the rest of the larger optimization pass. - At the end of the
SoAoptimization pass the program runs another pass over the program collecting which matrices areSoA. Then when it comes to a UDF in the program it looks at that call of the UDFs argument memory type (EitherSoAorAoS) and appends that set of argument memory types to a list in the UDFsmetarecord. So now each UDF defined in the functions block knows what combinations ofAoSandSoAarguments it needs to generate. - When the program starts printing out the C++, it will go through each UDF's list of memory patterns and generate a signature and body for each
I think the above will work? It sounds like it's only 3 steps but there's a lot of little things to do in all of those.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the SoA optimization pass, UDF and higher-order-function handling, and the C++ printing stage described in the issue. Determine how argument memory patterns are represented in UDF metadata and how generated signatures and bodies are currently selected. Done means UDFs used by reduce_sum and other higher-order functions can retain SoA arguments without demotion to AoS.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, ocaml
- Domain
- compilers, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100