* [FFmpeg-devel] [PATCH] vulkan: enable VK_KHR_cooperative_matrix
@ 2023-08-12 14:45 Lynne
2023-08-12 22:15 ` Kacper Michajlow
0 siblings, 1 reply; 4+ messages in thread
From: Lynne @ 2023-08-12 14:45 UTC (permalink / raw)
To: Ffmpeg Devel
[-- Attachment #1: Type: text/plain, Size: 231 bytes --]
It's of interest to API users, and of interest to us,
as a DCT/DST can be implemented via matrix multiplies.
Bumps up the required header version to 1.3.255, released
2 months ago, so it's had time to propagate.
Patch attached.
[-- Attachment #2: 0001-vulkan-enable-VK_KHR_cooperative_matrix.patch --]
[-- Type: text/x-diff, Size: 9781 bytes --]
From b3c9c3545d6ec97e3cad2b889ebfe932c13bcf67 Mon Sep 17 00:00:00 2001
From: Lynne <dev@lynne.ee>
Date: Sat, 12 Aug 2023 10:46:45 +0000
Subject: [PATCH] vulkan: enable VK_KHR_cooperative_matrix
It's of interest to API users, and of interest to us,
as a DCT/DST can be implemented via matrix multiplies.
---
configure | 4 ++--
libavutil/hwcontext_vulkan.c | 14 ++++++++++++--
libavutil/vulkan.c | 25 ++++++++++++++++++++++++-
libavutil/vulkan.h | 4 ++++
libavutil/vulkan_functions.h | 2 ++
libavutil/vulkan_loader.h | 1 +
6 files changed, 45 insertions(+), 5 deletions(-)
diff --git a/configure b/configure
index 932998b8d6..4015811cbd 100755
--- a/configure
+++ b/configure
@@ -7144,8 +7144,8 @@ enabled crystalhd && check_lib crystalhd "stdint.h libcrystalhd/libcrystalhd_if.
"in maintaining it."
if enabled vulkan; then
- check_pkg_config_header_only vulkan "vulkan >= 1.3.238" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
- check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 238)"
+ check_pkg_config_header_only vulkan "vulkan >= 1.3.255" "vulkan/vulkan.h" "defined VK_VERSION_1_3" ||
+ check_cpp_condition vulkan "vulkan/vulkan.h" "defined(VK_VERSION_1_4) || (defined(VK_VERSION_1_3) && VK_HEADER_VERSION >= 255)"
fi
if enabled x86; then
diff --git a/libavutil/hwcontext_vulkan.c b/libavutil/hwcontext_vulkan.c
index 75314f1407..26f63e8f86 100644
--- a/libavutil/hwcontext_vulkan.c
+++ b/libavutil/hwcontext_vulkan.c
@@ -99,6 +99,7 @@ typedef struct VulkanDevicePriv {
VkPhysicalDeviceVulkan13Features device_features_1_3;
VkPhysicalDeviceDescriptorBufferFeaturesEXT desc_buf_features;
VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float_features;
+ VkPhysicalDeviceCooperativeMatrixFeaturesKHR coop_matrix_features;
/* Queues */
pthread_mutex_t **qf_mutex;
@@ -405,6 +406,7 @@ static const VulkanOptExtension optional_device_exts[] = {
{ VK_EXT_DESCRIPTOR_BUFFER_EXTENSION_NAME, FF_VK_EXT_DESCRIPTOR_BUFFER, },
{ VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME, FF_VK_EXT_DEVICE_DRM },
{ VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME, FF_VK_EXT_ATOMIC_FLOAT },
+ { VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME, FF_VK_EXT_COOP_MATRIX },
/* Imports/exports */
{ VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_FD_MEMORY },
@@ -1202,9 +1204,13 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
VkPhysicalDeviceTimelineSemaphoreFeatures timeline_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES,
};
+ VkPhysicalDeviceCooperativeMatrixFeaturesKHR coop_matrix_features = {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR,
+ .pNext = &timeline_features,
+ };
VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT,
- .pNext = &timeline_features,
+ .pNext = &coop_matrix_features,
};
VkPhysicalDeviceDescriptorBufferFeaturesEXT desc_buf_features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT,
@@ -1242,7 +1248,9 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
p->desc_buf_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_FEATURES_EXT;
p->desc_buf_features.pNext = &p->atomic_float_features;
p->atomic_float_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT;
- p->atomic_float_features.pNext = NULL;
+ p->atomic_float_features.pNext = &p->coop_matrix_features;
+ p->coop_matrix_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_KHR;
+ p->coop_matrix_features.pNext = NULL;
ctx->free = vulkan_device_free;
@@ -1304,6 +1312,8 @@ static int vulkan_device_create_internal(AVHWDeviceContext *ctx,
p->atomic_float_features.shaderBufferFloat32Atomics = atomic_float_features.shaderBufferFloat32Atomics;
p->atomic_float_features.shaderBufferFloat32AtomicAdd = atomic_float_features.shaderBufferFloat32AtomicAdd;
+ p->coop_matrix_features.cooperativeMatrix = coop_matrix_features.cooperativeMatrix;
+
dev_info.pNext = &hwctx->device_features;
/* Setup queue family */
diff --git a/libavutil/vulkan.c b/libavutil/vulkan.c
index 48f5f4b5dc..684b92de57 100644
--- a/libavutil/vulkan.c
+++ b/libavutil/vulkan.c
@@ -90,9 +90,13 @@ int ff_vk_load_props(FFVulkanContext *s)
s->hprops = (VkPhysicalDeviceExternalMemoryHostPropertiesEXT) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT,
};
+ s->coop_matrix_props = (VkPhysicalDeviceCooperativeMatrixPropertiesKHR) {
+ .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_KHR,
+ .pNext = &s->hprops,
+ };
s->subgroup_props = (VkPhysicalDeviceSubgroupSizeControlProperties) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES,
- .pNext = &s->hprops,
+ .pNext = &s->coop_matrix_props,
};
s->desc_buf_props = (VkPhysicalDeviceDescriptorBufferPropertiesEXT) {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_BUFFER_PROPERTIES_EXT,
@@ -161,6 +165,25 @@ int ff_vk_load_props(FFVulkanContext *s)
vk->GetPhysicalDeviceQueueFamilyProperties2(s->hwctx->phys_dev, &s->tot_nb_qfs, s->qf_props);
+ if (vk->GetPhysicalDeviceCooperativeMatrixPropertiesKHR) {
+ vk->GetPhysicalDeviceCooperativeMatrixPropertiesKHR(s->hwctx->phys_dev,
+ &s->coop_mat_props_nb, NULL);
+
+ if (s->coop_mat_props_nb) {
+ s->coop_mat_props = av_malloc_array(s->coop_mat_props_nb,
+ sizeof(VkCooperativeMatrixPropertiesKHR));
+ for (int i = 0; i < s->coop_mat_props_nb; i++) {
+ s->coop_mat_props[i] = (VkCooperativeMatrixPropertiesKHR) {
+ .sType = VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_KHR,
+ };
+ }
+
+ vk->GetPhysicalDeviceCooperativeMatrixPropertiesKHR(s->hwctx->phys_dev,
+ &s->coop_mat_props_nb,
+ s->coop_mat_props);
+ }
+ }
+
return 0;
}
diff --git a/libavutil/vulkan.h b/libavutil/vulkan.h
index 20b81105dd..25c5ad4b74 100644
--- a/libavutil/vulkan.h
+++ b/libavutil/vulkan.h
@@ -236,11 +236,15 @@ typedef struct FFVulkanContext {
VkPhysicalDeviceExternalMemoryHostPropertiesEXT hprops;
VkPhysicalDeviceDescriptorBufferPropertiesEXT desc_buf_props;
VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props;
+ VkPhysicalDeviceCooperativeMatrixPropertiesKHR coop_matrix_props;
VkQueueFamilyQueryResultStatusPropertiesKHR *query_props;
VkQueueFamilyVideoPropertiesKHR *video_props;
VkQueueFamilyProperties2 *qf_props;
int tot_nb_qfs;
+ VkCooperativeMatrixPropertiesKHR *coop_mat_props;
+ uint32_t coop_mat_props_nb;
+
VkPhysicalDeviceShaderAtomicFloatFeaturesEXT atomic_float_feats;
VkPhysicalDeviceVulkan12Features feats_12;
VkPhysicalDeviceFeatures2 feats;
diff --git a/libavutil/vulkan_functions.h b/libavutil/vulkan_functions.h
index 58a625dd65..65021b04b1 100644
--- a/libavutil/vulkan_functions.h
+++ b/libavutil/vulkan_functions.h
@@ -45,6 +45,7 @@ typedef enum FFVulkanExtensions {
FF_VK_EXT_VIDEO_DECODE_H265 = 1ULL << 13, /* VK_EXT_video_decode_h265 */
FF_VK_EXT_VIDEO_DECODE_AV1 = 1ULL << 14, /* VK_MESA_video_decode_av1 */
FF_VK_EXT_ATOMIC_FLOAT = 1ULL << 15, /* VK_EXT_shader_atomic_float */
+ FF_VK_EXT_COOP_MATRIX = 1ULL << 16, /* VK_KHR_cooperative_matrix */
FF_VK_EXT_NO_FLAG = 1ULL << 31,
} FFVulkanExtensions;
@@ -80,6 +81,7 @@ typedef enum FFVulkanExtensions {
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceImageFormatProperties2) \
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceQueueFamilyProperties) \
MACRO(1, 0, FF_VK_EXT_NO_FLAG, GetPhysicalDeviceQueueFamilyProperties2) \
+ MACRO(1, 0, FF_VK_EXT_COOP_MATRIX, GetPhysicalDeviceCooperativeMatrixPropertiesKHR) \
\
/* Command pool */ \
MACRO(1, 1, FF_VK_EXT_NO_FLAG, CreateCommandPool) \
diff --git a/libavutil/vulkan_loader.h b/libavutil/vulkan_loader.h
index c45c674eaf..f88722f28f 100644
--- a/libavutil/vulkan_loader.h
+++ b/libavutil/vulkan_loader.h
@@ -46,6 +46,7 @@ static inline uint64_t ff_vk_extensions_to_mask(const char * const *extensions,
{ VK_EXT_DEBUG_UTILS_EXTENSION_NAME, FF_VK_EXT_DEBUG_UTILS },
{ VK_EXT_PHYSICAL_DEVICE_DRM_EXTENSION_NAME, FF_VK_EXT_DEVICE_DRM },
{ VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME, FF_VK_EXT_ATOMIC_FLOAT },
+ { VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME, FF_VK_EXT_COOP_MATRIX },
#ifdef _WIN32
{ VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_MEMORY },
{ VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME, FF_VK_EXT_EXTERNAL_WIN32_SEM },
--
2.40.1
[-- Attachment #3: Type: text/plain, Size: 251 bytes --]
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] vulkan: enable VK_KHR_cooperative_matrix
2023-08-12 14:45 [FFmpeg-devel] [PATCH] vulkan: enable VK_KHR_cooperative_matrix Lynne
@ 2023-08-12 22:15 ` Kacper Michajlow
2023-08-26 21:19 ` Lynne
0 siblings, 1 reply; 4+ messages in thread
From: Kacper Michajlow @ 2023-08-12 22:15 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, 12 Aug 2023 at 16:45, Lynne <dev@lynne.ee> wrote:
>
> It's of interest to API users, and of interest to us,
> as a DCT/DST can be implemented via matrix multiplies.
>
> Bumps up the required header version to 1.3.255, released
> 2 months ago, so it's had time to propagate.
I would disagree, considering latest Vulkan SDK release is 1.3.250.1.
Please wait untill new version is released.
> Patch attached.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] vulkan: enable VK_KHR_cooperative_matrix
2023-08-12 22:15 ` Kacper Michajlow
@ 2023-08-26 21:19 ` Lynne
2023-08-26 22:44 ` Kacper Michajlow
0 siblings, 1 reply; 4+ messages in thread
From: Lynne @ 2023-08-26 21:19 UTC (permalink / raw)
To: FFmpeg development discussions and patches
Aug 13, 2023, 00:15 by kasper93@gmail.com:
> On Sat, 12 Aug 2023 at 16:45, Lynne <dev@lynne.ee> wrote:
>
>>
>> It's of interest to API users, and of interest to us,
>> as a DCT/DST can be implemented via matrix multiplies.
>>
>> Bumps up the required header version to 1.3.255, released
>> 2 months ago, so it's had time to propagate.
>>
>
> I would disagree, considering latest Vulkan SDK release is 1.3.250.1.
> Please wait untill new version is released.
>
New SDK version 1.3.261.0 was released 5 days ago by LunarG,
so I think everyone's had time to update their headers.
Thanks.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [FFmpeg-devel] [PATCH] vulkan: enable VK_KHR_cooperative_matrix
2023-08-26 21:19 ` Lynne
@ 2023-08-26 22:44 ` Kacper Michajlow
0 siblings, 0 replies; 4+ messages in thread
From: Kacper Michajlow @ 2023-08-26 22:44 UTC (permalink / raw)
To: FFmpeg development discussions and patches
On Sat, 26 Aug 2023 at 23:19, Lynne <dev@lynne.ee> wrote:
>
> Aug 13, 2023, 00:15 by kasper93@gmail.com:
>
> > On Sat, 12 Aug 2023 at 16:45, Lynne <dev@lynne.ee> wrote:
> >
> >>
> >> It's of interest to API users, and of interest to us,
> >> as a DCT/DST can be implemented via matrix multiplies.
> >>
> >> Bumps up the required header version to 1.3.255, released
> >> 2 months ago, so it's had time to propagate.
> >>
> >
> > I would disagree, considering latest Vulkan SDK release is 1.3.250.1.
> > Please wait untill new version is released.
> >
>
> New SDK version 1.3.261.0 was released 5 days ago by LunarG,
> so I think everyone's had time to update their headers.
> Thanks.
Fine with me.
-Kacper
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-08-26 22:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-12 14:45 [FFmpeg-devel] [PATCH] vulkan: enable VK_KHR_cooperative_matrix Lynne
2023-08-12 22:15 ` Kacper Michajlow
2023-08-26 21:19 ` Lynne
2023-08-26 22:44 ` Kacper Michajlow
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git