Metal2 get GPU hardware info

Hi,


I am wondering how to get info about the underlying GPU architecture with the Metal2 API. I haven't found obvious information about it in Metal documents.


I have seen 2 properties which could be related to this:


MTLComputePipelineState.threadExecutionWidth - Does it mean that how many threads can be scheduled at the same time on 1 execution unit of the GPU?


MTLComputePipelineState.maxTotalThreadsPerThreadgroup - Does it mean that how many threads can be handled by 1 GPU execution unit?


Does the threadgroup word corresponds to a GPU execution unit?


How is it possible to query the available GPU execution units? (The number of thread groups which can run at the same time?)

Replies

I don't have much time right now, so please take a look at my answer in this thread here https://forums.developer.apple.com/thread/77958

Hope that helps a bit

Michal

Nice writing.

Do you also know the Metal API call to get the number of available GPU execution units?

I am not sure that modern GPU's execution unit is only capable for Single Program Multiple Data execution.

https://software.intel.com/en-us/file/compute-architecture-of-intel-processor-graphics-gen8pdf

In chapter 5.3.1 it says, that each thread can execute completely different compute kernel. This should give a lot more possibility than the SPMD model.

I thought I do - but alas it was false memory from OpenCL programming days. It looks like there is no way to do it directly. What _could_ be done, I guess is to manually fill in this information in program as a constant for iOS devices (there are not that many A* Apple chips supporting metal), and on macOS you could use OpenCL to query number of GPU execution units and then match this to Metal device names (and/or "low power" flags). I know, not a very helpful answer.

Hi,


I think it is a good workaround to ask this info from OpenCL. (I didn't try it yet.)