From e143338f651a5b96ea5faa2fa6978c8c552b9315 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Tue, 28 Feb 2023 17:10:04 +0000 Subject: [PATCH] Add limit tier for larger workgroup sizes Up to 1024 threads in the X and Y dimensions. This is supported on all Mac, all Windows, and most Vulkan devices. Bug: dawn:685 Change-Id: I067a492bdfc32d6a186d6875e545238babca8784 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/122003 Reviewed-by: Corentin Wallez Reviewed-by: Shrek Shao Commit-Queue: Austin Eng Kokoro: Kokoro --- src/dawn/native/Limits.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/dawn/native/Limits.cpp b/src/dawn/native/Limits.cpp index fb14fd2165..98fb4c6d35 100644 --- a/src/dawn/native/Limits.cpp +++ b/src/dawn/native/Limits.cpp @@ -25,6 +25,16 @@ #define LIMITS_WORKGROUP_STORAGE_SIZE(X) \ X(Maximum, maxComputeWorkgroupStorageSize, 16384, 32768, 49152, 65536) +// Tiers for limits related to workgroup size. +// TODO(crbug.com/dawn/685): Define these better. For now, use two tiers where one +// is available on nearly all desktop platforms. +#define LIMITS_WORKGROUP_SIZE(X) \ + X(Maximum, maxComputeInvocationsPerWorkgroup, 256, 1024) \ + X(Maximum, maxComputeWorkgroupSizeX, 256, 1024) \ + X(Maximum, maxComputeWorkgroupSizeY, 256, 1024) \ + X(Maximum, maxComputeWorkgroupSizeZ, 64, 64) \ + X(Maximum, maxComputeWorkgroupsPerDimension, 65535, 65535) + #define LIMITS_STORAGE_BUFFER_BINDING_SIZE(X) \ X(Maximum, maxStorageBufferBindingSize, 134217728, 1073741824, 2147483647, 4294967295) @@ -64,16 +74,12 @@ X(Maximum, maxInterStageShaderComponents, 60, 60) \ X(Maximum, maxInterStageShaderVariables, 16, 16) \ X(Maximum, maxColorAttachments, 8, 8) \ - X(Maximum, maxColorAttachmentBytesPerSample, 32, 32) \ - X(Maximum, maxComputeInvocationsPerWorkgroup, 256, 256) \ - X(Maximum, maxComputeWorkgroupSizeX, 256, 256) \ - X(Maximum, maxComputeWorkgroupSizeY, 256, 256) \ - X(Maximum, maxComputeWorkgroupSizeZ, 64, 64) \ - X(Maximum, maxComputeWorkgroupsPerDimension, 65535, 65535) + X(Maximum, maxColorAttachmentBytesPerSample, 32, 32) // clang-format on #define LIMITS_EACH_GROUP(X) \ X(LIMITS_WORKGROUP_STORAGE_SIZE) \ + X(LIMITS_WORKGROUP_SIZE) \ X(LIMITS_STORAGE_BUFFER_BINDING_SIZE) \ X(LIMITS_MAX_BUFFER_SIZE) \ X(LIMITS_RESOURCE_BINDINGS) \ @@ -81,6 +87,7 @@ #define LIMITS(X) \ LIMITS_WORKGROUP_STORAGE_SIZE(X) \ + LIMITS_WORKGROUP_SIZE(X) \ LIMITS_STORAGE_BUFFER_BINDING_SIZE(X) \ LIMITS_MAX_BUFFER_SIZE(X) \ LIMITS_RESOURCE_BINDINGS(X) \