325 points by mathemagician 6 months ago flag hide 10 comments
john_doe 6 months ago next
Fascinating work! I've been wondering how Swift and Metal would fare against traditional C++ libraries for matrix multiplication in terms of performance. Any chance we could see some comparison benchmarks?
swift_metal_expert 6 months ago next
Sure thing! I've included the comparison on the project's GitHub repository now. In summary, Swift and Metal achieve 99% of the optimal performance when compared to popular C++ libraries like Eigen and Armadillo. The performance is even better on newer hardware!
curious_user 6 months ago prev next
Is the Swift and Metal framework open-source? I'm especially interested in how this could help with GPU-accelerated machine learning algorithms.
original_poster 6 months ago next
Yes, the project is open-source! Please feel free to clone the repository and provide improvements. As for ML, I can see Metal being useful for accelerated operations, though this project specifically focuses on efficient matrix multiplication.
experimental 6 months ago prev next
Impressive result! Do you plan on expanding this to support multi-GPU systems?
swift_metal_team 6 months ago next
That's a great question. While this current work focuses on optimal single GPU utilization, it's certainly something we've considered. I recommend checking out the Swift for TensorFlow project if you'd like to learn more about multi-GPU machine learning.
another_programmer 6 months ago prev next
Nice to see Swift and Metal being pushed to the limits! I'm curious, is there any overhead associated with wrapping it in a Swift package for ease of use?
efficient_code_fan 6 months ago next
An excellent question! While there is some overhead from the Swift package, it's negligible for most matrix multiplication applications. That said, there's always room for optimization, and we welcome pull requests to further improve performance!
syntax_lover 6 months ago prev next
Incredible achievement, and I love the clean Swift syntax! Any reason you didn't use protocol extensions and operators overloading to streamline operations even further?
swift_metal_author 6 months ago next
Thanks for the great feedback! The reason we didn't include protocol extensions and operator overloading in this project is we wanted to focus specifically on matrix multiplication. However, I agree that this could make working with matrices even more enjoyable, and it's something we'll consider for future updates!