Listen to this Post
You can now run CUDA on a Mac ARM GPU directly in your browser using HipScript, a fascinating tool that chains together multiple technologies:
– CUDA โ OpenCL โ Vulkan โ Tint (Googleโs shader translator) โ WASM WebGPU
This enables GPU-accelerated computing (like plasma simulations) without requiring an NVIDIA GPU. While itโs not the most performant solution, itโs excellent for teaching and quick demos.
๐ Try it here: https://hipscript.lights0123.com/
๐ Architecture blog post: https://lights0123.com/blog/2025/01/07/hip-script/
Current Limitations:
- Only a subset of CUDA is supported.
- No 64-bit floats (WebGPU limitation).
- No 16-bit floats (Tint limitation).
You Should Know: How to Experiment with HipScript
- Running a Basic CUDA Kernel in the Browser
HipScript allows executing CUDA-like code via WebGPU. Hereโs a simple example:
// Example: Vector Addition in HipScript (CUDA-like syntax) <strong>global</strong> void vectorAdd(float A, float B, float C, int numElements) { int i = blockDim.x blockIdx.x + threadIdx.x; if (i < numElements) { C[bash] = A[bash] + B[bash]; } }
2. Compiling & Running in Browser
- Open HipScript Playground.
2. Paste the CUDA kernel.
3. Click Run (uses WebGPU backend).
3. Debugging & Performance Checks
Since this runs in WASM, performance is limited. Use browser dev tools (F12
) to:
– Check WebGPU logs.
– Monitor shader compilation time.
4. Cross-Platform Testing
Works on:
โ Mac ARM (M1/M2)
โ Intel/AMD (via Vulkan)
โ Chrome/Firefox (WebGPU support required)
5. Linux/Win Commands for GPU Debugging
If you’re comparing native CUDA vs. HipScript, use these commands:
Linux (NVIDIA GPU)
nvidia-smi Check GPU usage nvcc --version Verify CUDA toolkit
Windows (WSL2 + CUDA)
wsl --install -d Ubuntu Enable WSL nvidia-smi Verify GPU detection
Mac (Metal API Debugging)
metal-capture Debug Metal shaders system_profiler SPDisplaysDataType List GPU details
What Undercode Say
HipScript is a brilliant hack that democratizes GPU computing by bypassing hardware dependencies. While not production-ready, itโs perfect for:
– Teaching CUDA concepts without setup headaches.
– Quick prototyping across different GPUs.
– Web-based GPU experiments (no driver issues).
Future improvements could include broader CUDA support and optimizations for WebGPU.
Prediction
Browser-based GPU computing will grow, especially for education and lightweight AI inference. Expect more tools like HipScript bridging native and web GPU APIs.
Expected Output:
- A functional CUDA-like demo running in a browser.
- Cross-platform GPU accessibility without NVIDIA hardware.
- Increased adoption for academic and prototyping use cases.
IT/Security Reporter URL:
Reported By: Laurie Kirk – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass โ