-
Notifications
You must be signed in to change notification settings - Fork 156
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
[Discussion/Suggestion] Enable the writing of kernel/shader code in directly in Python. #394
Comments
We actually had this in a previous version of Kompute using the pyshader - here's an example on the tests: kompute/python/test/test_array_multiplication.py Lines 19 to 35 in df5477a
The library is not maintained unfortunately, and there hasn't been anything out there to provide a similar interface unfortunately, if there is an initiative that develops this further, it would be great to adopt once again. |
Thanks for the link. Shame pyshader is no longer actively maintained. In a perfect world I would be able to write entire pipelines once in Python and AOT compile it with something like PyPy to an executable with both CPU and GPU pipelines. |
Hi, first off I would like to state I don't know enough about Python to know if this is actually possible. But I would like to suggest a potential feature improvement. The ability to write kernels/shaders directly in Python and have it compile down to the compute string that you would normally write would make for a decent improvement I think.
Maybe having a
Kernel
class that the user can inherit and provides a more structured approach to declaring things like inputs by making them the arguments of aprocess
function or maybe member values of the class itself.Example based on the Getting Started kernel:
Would become:
This is by no means meant to be a "correct" solution. Just something to express the idea that I am trying to describe. It's obviously not a trivial feature to implement and there are certain things that would need to be addressed first. But I think that having something that is more than just a string can be more productive when writing.
Ideally it would also take away all the hassle of having to manually check and ensure things like your bindings indices and set indices etc.
Would love to hear some feedback on the idea/if it's even possible in Python.
The text was updated successfully, but these errors were encountered: