gpujs / gpu.js

GPU Accelerated JavaScript
https://gpu.rocks
MIT License
15.03k stars 643 forks source link

Support for MacOS Metal Performance Shaders (MSP) based on py-metal-compute #835

Open vitali-korezki opened 5 days ago

vitali-korezki commented 5 days ago

Dear GPU Community,

recently I've started to play around with brain.js and processing calculations on GPU with the goal to squeeze some performance out of my home server with Blackmagic Pro eGPU. Generally speaking, I was able to run a few tests successfully, but surprisingly all calculations have been processed on my internal graphics card, not on eGPU.

Image 7-2-24 at 1 18 PM

However, if running tests with py-metal-compute (metalcompute pip package), calculation is being processed on all 3 GPUs.

Image 7-2-24 at 1 42 PM

With that, I would like to try to contribute looking for a way to migrate the logic from metalcompute to gpu.js. From my first observations I would need to develop a Kernel that can be injected similar to WebGLKernel or HeadlessGLKernel. As a first step I'm trying to get familiar with the code in src/backend/headless-gl/kernel.js, but if there is some information that would give me a head start, I would highly appreciate!

Any guidance that would speedup the development, I would highly appreciate it!

Best, Vitali