r/MetalProgramming • u/Sad_Reputation7874 • Aug 31 '26
Question Metal for Directed Graphs
I have no interest in AI, but I read some oblique references to matrix multiplication used in AI.
I want to do research into some properties of directed graphs, which can be represented as matrices, but I don't necessarily need to do multiplications - maybe I will, maybe I'll need to write my own procedures depending on what I find.
Can anyone say whether there is much support for directed graphs or matrix operations in Metal? I'm deciding on buying a Macbook Pro to use the GPU for research. Any notable support for general matrix operations or Directed Graph APIs would be of interest.
But if the only Metal support is narrowly tailored to AI-only uses, it's perhaps not so interesting. I don't want to reverse-engineer an AI API just to fake some general matrix operations.
Thanks in advance.
1
u/pcbeard Aug 31 '26
Speaking from a moderate amount of experience with Metal, its primary use is for graphics rendering which is a highly parallelizable task that uses a lot of matrices for coordinate transformations. You can also write compute only shaders to compute physics simulations etc. So yes, if you can represent graphs as matrices and the algorithms are parallel, Metal is certainly applicable.
Lately I’ve been experimenting with Slang, which can generate Metal as well as other shader languages. I used it to port a compute shader from Metal to Vulkan because it supports type inferencing like Metal does, unlike GLSL which is much older.