Skip to content

Commit 1467a7a

Browse files
committed
add tests for N % 1024 != 0
Signed-off-by: Junhee Yoo <[email protected]>
1 parent adbec7f commit 1467a7a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

ggml/src/ggml-metal.metal

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,6 +1985,10 @@ kernel void kernel_im2col_ext(
19851985
const int32_t HW = tgpig[0] % KHW;
19861986

19871987
const int32_t tpitg_0 = (d * ntg[0]) + tpitg[0];
1988+
if (tpitg_0 >= N) {
1989+
return;
1990+
}
1991+
19881992
const int32_t tpitg_1 = HW / KW;
19891993
const int32_t tpitg_2 = HW % KW;
19901994

tests/test-backend-ops.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3323,6 +3323,8 @@ static std::vector<std::unique_ptr<test_case>> make_test_cases_eval() {
33233323
test_cases.emplace_back(new test_im2col(GGML_TYPE_F32, GGML_TYPE_F16, GGML_TYPE_F16, {12, 12, 2, 1024}, {3, 3, 2, 1024}, 1, 1, 1, 1, 1, 1, true));
33243324
test_cases.emplace_back(new test_im2col(GGML_TYPE_F32, GGML_TYPE_F16, GGML_TYPE_F16, {12, 12, 1, 2048}, {3, 3, 1, 2048}, 1, 1, 1, 1, 1, 1, true));
33253325
test_cases.emplace_back(new test_im2col(GGML_TYPE_F32, GGML_TYPE_F16, GGML_TYPE_F16, {12, 12, 2, 2048}, {3, 3, 2, 2048}, 1, 1, 1, 1, 1, 1, true));
3326+
test_cases.emplace_back(new test_im2col(GGML_TYPE_F32, GGML_TYPE_F16, GGML_TYPE_F16, {12, 12, 1, 2560}, {3, 3, 1, 2560}, 1, 1, 1, 1, 1, 1, true));
3327+
test_cases.emplace_back(new test_im2col(GGML_TYPE_F32, GGML_TYPE_F16, GGML_TYPE_F16, {12, 12, 2, 2560}, {3, 3, 2, 2560}, 1, 1, 1, 1, 1, 1, true));
33263328

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

0 commit comments

Comments
 (0)