我正在实时收到的视频提要上运行计算机视觉算法。我正在使用DispatchQueue
异步运行这些操作/算法。但是,我遇到以下错误,我无法解释:
[MTLDebugComputeCommandEncoder dispatchThreadgroups:threadsPerThreadgroup:]:949: failed assertion (threadgroupsPerGrid.width(0) * threadgroupsPerGrid.y(12) * threadgroupsPerGrid.depth(1))(0) must not be 0.'
这个错误是什么?
此消息指出,[MTLDebugComputeCommandEncoder dispatchThreadgroups:threadsPerThreadgroup:]
中的断言引起了断言失败。
有人断言这种表达:
threadgroupsPerGrid.width * threadgroupsPerGrid.y * threadgroupsPerGrid.depth
不应是0
,而是0
,导致这种断言失败。此外,他们已经注释了这些变量的值:
-
threadgroupsPerGrid.width
是0
-
threadgroupsPerGrid.y
是12
-
threadgroupsPerGrid.depth
是1
-
threadgroupsPerGrid.width * threadgroupsPerGrid.y * threadgroupsPerGrid.depth
评估为0
这个无效状态可能是您将无效的参数传递给[MTLDebugComputeCommandEncoder dispatchThreadgroups:threadsPerThreadgroup:]
的结果。如果我不得不猜测,问题可能是threadgroupsPerGrid.width
是0
。