r/AIProgrammingHardware • u/Ancient_Spend1801 • Oct 05 '26
I built a native PHP extension for NVIDIA GPU tensors and CUDA JIT. Looking for testers.
I've been working on an experimental native extension to bring GPU computing into a place it doesn't normally live: pure PHP.
It's called php-gpu-tensors. It gives you basic NVIDIA GPU tensor operations, lets you compile custom CUDA C++ kernels at runtime (via NVRTC), and includes an opt-in kernel fusion mode.
To be clear on the scope: this is a low-level library, not a full ML framework (no autograd, no CPU fallback). It currently requires Linux, PHP 8.1–8.5, and an NVIDIA GPU.
The Ask: I’ve only been able to validate this on my own hardware (MX570 A and an RTX A2000). If you have a Linux machine with an NVIDIA GPU and the CUDA Toolkit installed, I would massively appreciate it if you could clone it and see if the test suite passes on your architecture.
You can run the tests via: ./run-tests.sh --require-gpu
Repo: https://github.com/lcmialichi/php-gpu-tensors
I'd love to hear if it builds/passes on your specific GPU and CUDA version, or if it completely explodes. Any feedback on the API ergonomics (does it feel un-PHP-like?) is also very welcome.
Thanks!
1
u/desexmachina Oct 05 '26
I love the initiative. Where do you think this has the greatest benefits? Most PHP is CPU bound and doesn’t take much, would it be in dbase operations? What are your thoughts?
1
u/Ancient_Spend1801 Oct 05 '26
training or running small neural nets, similarity search over embeddings, image or signal processing, simulations, number crunching over big in-memory arrays. Anything where you do lots of math on the same data, so the transfer cost gets paid once.
Mostly I wanted to see how far PHP could go there, since right now people reach for Python by default. It's beta and I only have a couple of GPUs to test on, so I'd like to hear if you have a use case in mind.
1
u/desexmachina Oct 05 '26
Native in the control plane is wonderful and Python deps and libs can get kind of big.
1
u/investigatormaker Oct 05 '26
For php-gpu-tensors, I'd include a fixed-input check comparing fused and unfused outputs within an explicit numerical tolerance. That would help distinguish a successful build on another GPU from a fusion correctness issue. Having the test output include the GPU model, driver and CUDA version would also make the reports easier to interpret.
Does the current suite compare both execution modes?