Metal - threads and threaded groups

I am studying Metalright now and trying to understand the lines below:

let threadGroupCount = MTLSizeMake(8, 8, 1) ///line 1
let threadGroups = MTLSizeMake(drawable.texture.width / threadGroupCount.width, drawable.texture.height / threadGroupCount.height, 1) ///line 2

command_encoder.dispatchThreadgroups(threadGroups, threadsPerThreadgroup: threadGroupCount) ///line 3
  • for line 1, what are integers? My guess is to assign the number of threads that will be used in this process, but which one is there?

  • What is the difference between line 1and 'line 2'? My assumption is again different between threads and groups of threads. But I'm not sure what the fundamental difference is and when to use what.

+4
source share
2 answers

​​ , , , ( * * ), , maxTotalThreadsPerThreadgroup .

threadsPerThreadgroup "" (.. ). threadgroupsPerGrid , . , , .

: threadExecutionWidth, , . , threadExecutionWidth. , .

+5

Source: https://habr.com/ru/post/1655626/


All Articles