Skip to content

Is Timestamp Query not supported on Apple M1? #1956

Closed

Description

@haoxli

Timestamp query run with the error on Apple M1 with macOS 11.4:

-[AGXM1FamilyBlitContext sampleCountersInBuffer:atSampleIndex:withBarrier:]:325: failed assertion `MTLBlitCommandEncoder:sampleCountersInBuffer:atSampleIndex:withBarrier not supported on this device'

By Checking for GPU Counter Support, we can get that MTLCommonCounterSetTimestamp is supported.

But checking supportsCounterSampling on MTLDevice, we get that:
MTLCounterSamplingPointAtBlitBoundary is unsupported,
MTLCounterSamplingPointAtDispatchBoundary is unsupported,
MTLCounterSamplingPointAtDrawBoundary is unsupported,
MTLCounterSamplingPointAtStageBoundary is supported,
MTLCounterSamplingPointAtTileDispatchBoundary is unsupported.

Does it mean we just can sample the supported counter at stage boundary (the start and end of a render pass’s vertex and fragment stages, and the start and end of compute and blit passes) on Apple M1?

Activity

  1. haoxli commented on Jul 16, 2021

    @haoxli
    ContributorAuthor

    @litherum Would you like to check if the timestamp query is really not supported on M1?

  2. Kangz commented on Jul 16, 2021

    @Kangz
    Contributor

    MTLCounterSamplingPointAtStageBoundary means:

    Counter sampling is allowed at the start and end of a render pass’s vertex and fragment stages, and at the start and end of compute and blit passes.

    So technically a WebGPU implementation could choose to split encoders at these points (and push timestamps in render passes at the start or end of the pass). But it could also choose to not bother and not expose the extension on such hardware.

  3. kvark commented on Jul 16, 2021

    @kvark
    Contributor

    Please no splitting encoders PLEASE

  4. Kangz commented on Jul 16, 2021

    @Kangz
    Contributor
  5. kvark commented on Jul 16, 2021

    @kvark
    Contributor

    Ah we aren't talking about render encoders, phew!

  6. haoxli commented on Jul 19, 2021

    @haoxli
    ContributorAuthor

    Spliting encoders at these points may works, but how do we define whether the extension is supported? On other GPUs, the counter sampling may be allowed at blit boundary, draw boundary and dispatch boundary, but disallowed at stage boundary. We need to tell users which points it supports.

  7. Kangz commented on Jul 19, 2021

    @Kangz
    Contributor

    The timestamp-query has no guarantee that the values returned are exact (sampling timestamps inside render passes doesn't mean much for tiler GPUs anyway) so I think it's ok for implementations to make choices.

  8. reopened this on Jul 20, 2021
  9. haoxli commented on Jul 20, 2021

    @haoxli
    ContributorAuthor

    OK, let's disable timestamp query on Apple M1.

  10. Kangz commented on Sep 2, 2021

    @Kangz
    Contributor

    Closing in favor of #2046

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions