Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vulkan timestamp query pools use Metal GPU counters when available. #1404

Conversation

billhollings
Copy link
Contributor

  • Add MVKPhysicalDeviceMetalFeatures::counterSamplingPoints to track platform availability of GPU counters.
  • MVKPhysicalDevice creates and manages MTLCounterSets and checks for and enables flags within MVKPhysicalDeviceMetalFeatures::counterSamplingPoints.
  • Add abstract MVKGPUCounterQueryPool class as parent of MVKTimestampQueryPool and MVKPipelineStatisticsQueryPool concrete classes and refactor access to host and command copy tracking data to allow extraction from MTLCounterSampleBuffer.
  • MVKTimestampQueryPool uses MTLCounterSampleBuffer if supported, otherwise reverts to using host data for timestamps.
  • MVKCommandEncoder encodes Vulkan timestamp commands either as Metal staged or command timestamps, depending on whether the GPU is tile-based or immediate-mode.
  • For Metal stage counters, we use a light-weight dummy BLIT encoder to mark timestamp commands executed in the previous Metal encoding pass.
  • Add MVKDevice::getDummyBlitMTLBuffer() to supply a dummy single-byte buffer that can be used by a stand-alone MTLBlitCommandEncoder as dummy work to mark timestamps.

Fixes #773.
Fixes #793.
Fixes #520.

Add MVKPhysicalDeviceMetalFeatures::counterSamplingPoints
to track platform availability of GPU counters.
MVKPhysicalDevice creates and manages MTLCounterSets and checks for and enables
flags within MVKPhysicalDeviceMetalFeatures::counterSamplingPoints.
Add abstract MVKGPUCounterQueryPool class as parent of MVKTimestampQueryPool
and MVKPipelineStatisticsQueryPool concrete classes and refactor access to host
and command copy tracking data to allow extraction from MTLCounterSampleBuffer.
MVKTimestampQueryPool uses MTLCounterSampleBuffer if supported, otherwise reverts
to using host data for timestamps.
MVKCommandEncoder encodes Vulkan timestamp commands either as Metal staged or
command timestamps, depending on whether the GPU is tile-based or immediate-mode.
For Metal stage counters, we use a light-weight dummy BLIT encoder to mark
timestamp commands executed in the previous Metal encoding pass.
Add MVKDevice::getDummyBlitMTLBuffer() to supply a dummy single-byte buffer that
can be used by a stand-alone MTLBlitCommandEncoder as dummy work to mark timestamps.
@billhollings billhollings requested review from cdavis5e and removed request for cdavis5e July 26, 2021 18:08
@billhollings
Copy link
Contributor Author

@cdavis5e Please review if you can. Always good to have a second set of eyes on it...but if you are too busy to right now...let me know and I'll pull it in without the review. We can tweak later if needed. CTS tests pass.

MoltenVK/MoltenVK/GPUObjects/MVKQueryPool.mm Outdated Show resolved Hide resolved
MoltenVK/MoltenVK/GPUObjects/MVKQueryPool.mm Outdated Show resolved Hide resolved
Remove dead code and make GPU counter creation error message generic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants