Add GPU support for Apple Silicon (M1/M2/M3/M4)
- Dominant language
- Go
- Stars
- 3
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
## Summary
The current GPU miner uses OpenCL, which is deprecated on macOS and has limited/no support on Apple Silicon Macs. To properly support M1/M2/M3/M4 chips, we need to implement a Metal-based GPU miner.
## Current State
- `gpu_darwin.go` uses OpenCL 1.2 via `-framework OpenCL`
- Works well on Intel Macs with discrete AMD GPUs (e.g., Radeon Pro 555X, 560X, 5500M)
- On Apple Silicon, OpenCL either:
- Doesn't detect the GPU at all
- Runs through an emulation layer with poor performance
## Proposed Solution
Implement a Metal-based GPU miner for Apple Silicon:
1. Create `gpu_darwin_metal.go` with Metal compute shaders
2. Port the Keccak256 kernel (`kernel/keccak256.cl`) to Metal Shading Language (MSL)
3. Use build tags to select between OpenCL (Intel Macs) and Metal (Apple Silicon)
4. Alternatively, use Metal for all macOS builds since it works on both Intel and Apple Silicon
## Technical Considerations
- Metal uses MSL (Metal Shading Language) instead of OpenCL C
- Need to use `cgo` with `-framework Metal -framework Foundation`
- Consider using [go-metal](https://github.com/nicholasblaskey/go-metal) or direct cgo bindings
- Metal provides better performance on Apple hardware than OpenCL
## Benefits
- Native GPU acceleration on M1/M2/M3/M4 Macs
- Better performance than OpenCL even on Intel Macs
- Future-proof as Apple continues to deprecate OpenCL
## References
- [Apple Metal Documentation](https://developer.apple.com/metal/)
- [Metal Best Practices Guide](https://developer.apple.com/library/archive/documentation/3DDrawing/Conceptual/MTLBestPracticesGuide/)
- [OpenCL Deprecation Notice](https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/OpenCL_ProgrammingGuide/)
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.