This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit eed9ec57c2f4fb043b2a9da13566c2b58aa10f33
Author:     Lynne <[email protected]>
AuthorDate: Tue Sep 22 01:19:31 2026 +0900
Commit:     Lynne <[email protected]>
CommitDate: Wed Sep 23 00:30:52 2026 +0900

    vulkan/apv_encode_tiles: size the per-subgroup arrays for the smallest 
subgroups
    
    The shared scan and tail hand-off arrays assumed subgroups of at least
    32 lanes, but ANV and lavapipe run the tile workgroups with 8 or 16,
    and the extra subgroups overran the arrays into each other. The output
    on Intel varied from run to run as a result; it now matches RADV.
---
 libavcodec/apv_encode_vulkan.c               |  7 ++++++-
 libavcodec/vulkan/apv_encode_tiles.comp.glsl | 11 +++--------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/libavcodec/apv_encode_vulkan.c b/libavcodec/apv_encode_vulkan.c
index 85e43a1339..c0b3999e43 100644
--- a/libavcodec/apv_encode_vulkan.c
+++ b/libavcodec/apv_encode_vulkan.c
@@ -280,8 +280,13 @@ static int init_entropy_shader(AVCodecContext *avctx, int 
blocks_per_mb,
      * Luma and chroma tile-components hold different block counts under
      * chroma sub-sampling, so each gets a pipeline with its own size. */
     uint32_t wg = ev->tile_mb_w * ev->tile_mb_h * blocks_per_mb;
+    uint32_t min_sg = ev->s.subgroup_props.minSubgroupSize;
 
-    ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, NULL,
+    /* The driver picks the subgroup size; size for the most it may use */
+    SPEC_LIST_CREATE(sl, 1, sizeof(uint32_t))
+    SPEC_LIST_ADD(sl, 0, 32, FFALIGN(wg, min_sg) / min_sg);
+
+    ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
                       (uint32_t []) { wg, 1, 1 }, 0);
 
     ff_vk_shader_add_push_const(shd, 0, sizeof(EntropyPushData),
diff --git a/libavcodec/vulkan/apv_encode_tiles.comp.glsl 
b/libavcodec/vulkan/apv_encode_tiles.comp.glsl
index 15ddc8fcbd..d0b2c5733d 100644
--- a/libavcodec/vulkan/apv_encode_tiles.comp.glsl
+++ b/libavcodec/vulkan/apv_encode_tiles.comp.glsl
@@ -35,13 +35,8 @@
  * One workgroup encodes one tile-component. The workgroup size (set by the
  * host via spec constants 253/254/255) equals the number of transform blocks
  * in the tile-component, so there is exactly one invocation per block.
- *
- * The minimum APV tile is 16x8 MBs -> 16*8*4 = 512 blocks. The buffers below
- * are sized for 1024 (a 2x tile). With a guaranteed subgroup size of >= 32,
- * a 1024-invocation workgroup has at most 1024/32 = 32 subgroups.
  */
-#define MAX_BLOCKS    1024
-#define MAX_SUBGROUPS 32
+layout (constant_id = 0) const uint max_subgroups = 32; /* at the smallest 
subgroup size */
 
 /* ff_zigzag_direct, packed: each byte is the raster index (y*8 + x). */
 const uint8_t zigzag[64] = {
@@ -140,8 +135,8 @@ layout (push_constant, scalar) uniform pushConstants {
     uint  blocks_per_mb;    /* blocks per MB of this dispatch's components */
 };
 
-shared uint32_t sg_lasttail[MAX_SUBGROUPS]; /* last block's tail, per subgroup 
*/
-shared uint32_t sg_scan    [MAX_SUBGROUPS]; /* per-subgroup scan totals        
*/
+shared uint32_t sg_lasttail[max_subgroups]; /* last block's tail, per subgroup 
*/
+shared uint32_t sg_scan    [max_subgroups]; /* per-subgroup scan totals        
*/
 
 /*
  * Flush only the complete bytes held by the writer. The trailing partial

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to