History

vulkan_decode: adjust number of async contexts created

This caps the number of contexts we create based on thread count. This saves VRAM and filters out cases where more async is of lesser benefit.

Lynne committed 1 year ago

Commit e15e85b1 parent 44958021 file · +8 −2Browse files

Unified · Split

libavcodec/vulkan_decode.c+8−2
@@ -1122,6 +1122,7 @@ int ff_vk_decode_init(AVCodecContext *avctx) · 1121 unmodified lines
1122 FFVulkanDecodeShared *ctx;1122 FFVulkanDecodeShared *ctx;
1123 FFVulkanContext *s;1123 FFVulkanContext *s;
1124 FFVulkanFunctions *vk;1124 FFVulkanFunctions *vk;
1125 int async_depth;
1125 const VkVideoProfileInfoKHR *profile;1126 const VkVideoProfileInfoKHR *profile;
1126 const FFVulkanDecodeDescriptor *vk_desc;1127 const FFVulkanDecodeDescriptor *vk_desc;
1127 const VkPhysicalDeviceDriverProperties *driver_props;1128 const VkPhysicalDeviceDriverProperties *driver_props;
@@ -1191,9 +1192,14 @@ int ff_vk_decode_init(AVCodecContext *avctx) · 63 unmodified lines
1191 /* Create decode exec context for this specific main thread.1192 /* Create decode exec context for this specific main thread.
1192 * 2 async contexts per thread was experimentally determined to be optimal1193 * 2 async contexts per thread was experimentally determined to be optimal
1193 * for a majority of streams. */1194 * for a majority of streams. */
1195 async_depth = 2*ctx->qf->num;
1196 /* We don't need more than 2 per thread context */
1197 async_depth = FFMIN(async_depth, 2*avctx->thread_count);
1198 /* Make sure there are enough async contexts for each thread */
1199 async_depth = FFMAX(async_depth, avctx->thread_count);
1200
1194 err = ff_vk_exec_pool_init(s, ctx->qf, &ctx->exec_pool,1201 err = ff_vk_exec_pool_init(s, ctx->qf, &ctx->exec_pool,
1195 FFMAX(2*ctx->qf->num, avctx->thread_count),1202 async_depth, 0, 0, 0, profile);
1196 0, 0, 0, profile);
1197 if (err < 0)1203 if (err < 0)
1198 goto fail;1204 goto fail;
1199 1205

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t