gl/vk: Correctly halve the invocation count when shrinking F32 to F16

This commit is contained in:
kd-11
2026-10-09 12:38:31 +03:00
committed by kd-11
parent 4d4c07c18a
commit 7c572eb4dd
2 changed files with 18 additions and 8 deletions
+9 -4
View File
@@ -144,12 +144,13 @@ namespace gl
" uint out_offset = out_ptr >> 2;\n"
" uvec4 tmp;\n";
work_kernel =
" if (index >= block_length)\n"
" return;\n";
if constexpr (sizeof(From) == 4)
{
// NOTE: We're halving the block size for output
work_kernel =
" if ((index * 2) >= block_length)\n"
" return;\n";
static_assert(sizeof(To) == 2);
declare_f16_contraction();
@@ -177,6 +178,10 @@ namespace gl
}
else
{
work_kernel =
" if (index >= block_length)\n"
" return;\n";
static_assert(sizeof(To) == 4);
declare_f16_expansion();
+9 -4
View File
@@ -283,12 +283,13 @@ namespace vk
" uint out_offset = params[0].z >> 2;\n"
" uvec4 tmp;\n";
work_kernel =
" if (index >= block_length)\n"
" return;\n";
if constexpr (sizeof(From) == 4)
{
// NOTE: We're halving the data on output, so our index is 2x as large
work_kernel =
" if ((index * 2) >= block_length)\n"
" return;\n";
static_assert(sizeof(To) == 2);
declare_f16_contraction();
@@ -316,6 +317,10 @@ namespace vk
}
else
{
work_kernel =
" if (index >= block_length)\n"
" return;\n";
static_assert(sizeof(To) == 4);
declare_f16_expansion();