pymc-devs / pymc-devs/pytensor
Reduce status of C backend to "just another backend"
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
Description
This is a proposal, discussion strongly requested.
The C backend is the original backend from the Theano days, and pre-dates the notion of a backend. As a result, there are lots of C concepts interwoven in the code. A simple example is a COp, an Op that has a C implementation. These are sprinkled through the code base in tensor.
My proposal is to put C on the same level as numba/jax/etc. This would entail:
- Depreciating the
COpentirely - Removing any loose references to C code or C implementation in other places (elementwise vectorization for example, though Ricardo is already fixing this)
- Replace COps with C_funcify dispatches that live in the
linker/cfolder - Move C-specific blas code to relevant
linker/cfiles
This would do a few things. First, clean up our core library code, and keep it as slim and "easy to read" as possible. All of the codegen and C code strings can be hidden away in there. It will also make it more obvious what is and is not covered by the C backend, in case someone ever comes along and wants to try to work on it.
Contributor guide
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 mapping the COp references in the tensor code and the C-specific code in linker/c; no single test or entry point is identified. This proposal needs maintainer agreement on scope before work starts, with completion covering COp deprecation, removal of loose C references, C_funcify dispatches in linker/c, and relocation of C-specific BLAS code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, python
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100