Skip to content
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

Update Cython usage in scan_perform.pyx #129

Closed
brandonwillard opened this issue Oct 24, 2020 · 1 comment
Closed

Update Cython usage in scan_perform.pyx #129

brandonwillard opened this issue Oct 24, 2020 · 1 comment
Labels
C-backend enhancement New feature or request help wanted Extra attention is needed important question Further information is requested refactor This issue involves refactoring Scan Involves the `Scan` `Op`

Comments

@brandonwillard
Copy link
Member

We're currently versioning the C code produced by Cython for the Scan Op, and I'm not sure if that's necessary (or the correct approach). It also requires a manual compilation and patch step when the relevant code is changed, which seems a little less than desirable.

Since it looks like we're compiling the Cython-generated C code with Theano's GCC compilation framework, I'm guessing that Cython's compilation framework somehow isn't/wasn't compatible. Even so, this situation raises some important questions:

  1. If we can—apparently—use Cython to generate C code that's compatible with Theano's C framework, why aren't we doing that more often? Better yet, why don't we have a Linker that does this automatically, and why don't we use something like that to replace all these string-based c_code implementations?

Cython already has a well developed means of both separating and combining Python code from its more implementation specific C details, so using that framework could dramatically improve the unnecessary tangle of high and low-level details brought about by the current Theano C transpilation framework.

  1. Why can't we use Cython's compilation framework?

There's really no reason to think that Cython's compilation framework isn't already far ahead of Theano's in many ways (e.g. default parameters and host system detection/configuration for one). My initial guess is that we would need to use it programatically, at least in a way that's similar to what Theano is currently doing with gcc and the like, but I don't see any reason why it wouldn't be just as amenable—if not considerably more (e.g. if it has a Python interface that helps us avoid writing our own onerous system calls).

@brandonwillard brandonwillard added enhancement New feature or request help wanted Extra attention is needed question Further information is requested important refactor This issue involves refactoring C-backend labels Oct 24, 2020
@brandonwillard brandonwillard added the Scan Involves the `Scan` `Op` label Sep 12, 2021
@brandonwillard
Copy link
Member Author

Closed by #963

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-backend enhancement New feature or request help wanted Extra attention is needed important question Further information is requested refactor This issue involves refactoring Scan Involves the `Scan` `Op`
Projects
None yet
Development

No branches or pull requests

1 participant