Skip to content

Commit 9df0680

Browse files
authored
vulkan: Workaround compiler bug in conv2d coopmat2 path (ggml-org#24924)
* vulkan: Workaround compiler bug in conv2d coopmat2 path * apply same workaround to CONV_3D * Apply suggestion from @jeffbolznv
1 parent 2f18fe1 commit 9df0680

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

ggml/src/ggml-vulkan/vulkan-shaders/conv2d_mm.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const uint32_t Csh_stride = BS_NPQ;
158158
#ifdef COOPMAT
159159
const uint32_t Csh_len = BS_K * Csh_stride;
160160
#else
161-
const uint32_t Csh_len = csh_store != 0 ? BS_K * Csh_stride : 1;
161+
const uint32_t Csh_len = csh_store != 0 ? BS_K * Csh_stride : 8; // 8 to workaround compiler bug
162162
#endif
163163
shared SHMEM_TYPE Csh[Csh_len]; // K x NPQ
164164
#endif

ggml/src/ggml-vulkan/vulkan-shaders/conv3d_mm.comp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const uint32_t Csh_stride = BS_NPQ;
144144
#ifdef COOPMAT
145145
const uint32_t Csh_len = BS_K * Csh_stride;
146146
#else
147-
const uint32_t Csh_len = csh_store != 0 ? BS_K * Csh_stride : 1;
147+
const uint32_t Csh_len = csh_store != 0 ? BS_K * Csh_stride : 8; // 8 to workaround compiler bug
148148
#endif
149149
shared SHMEM_TYPE Csh[Csh_len]; // K x NPQ
150150
#endif

tests/test-backend-ops.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7973,6 +7973,9 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
79737973
}
79747974
}
79757975
}
7976+
for (auto kernel_type : {GGML_TYPE_F32, GGML_TYPE_F16}) {
7977+
test_cases.emplace_back(new test_conv_2d({ 256, 256, 192, 1 }, { 3, 3, 192, 96 }, kernel_type, 1, 1, 1, 1, 1, 1, false));
7978+
}
79767979

79777980
// sycl backend will limit task global_range < MAX_INT
79787981
// test cases for 2D im2col with large input W and H (occurs in stable-diffusion)

0 commit comments

Comments
 (0)