Skip to content

Commit 7b6abb2

Browse files
ggerganovCopilot
andauthored
ggml : fix conv2d_dw SVE path (#1380)
* Fix test-conv2d-dw failure on ARM SVE by using runtime vector length The ggml_compute_forward_conv_2d_dw_cwhn function was using a hardcoded GGML_F32_EPR (8) for SIMD vectorization, but on ARM SVE the actual vector length varies by hardware. This caused incorrect computation when processing CWHN layout tensors on ARM machines. Fix by using svcntw() to get the runtime SVE vector length instead of the compile-time constant. Co-authored-by: ggerganov <[email protected]> * ci : reduce sam score threshold * ci : update bbox checks for sam test --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: ggerganov <[email protected]>
1 parent 09aa758 commit 7b6abb2

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

ci/run.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,14 +294,16 @@ function gg_run_sam {
294294
python3 ../examples/sam/convert-pth-to-ggml.py ${path_models}/sam_vit_b_01ec64.pth ${path_models}/ 1
295295

296296
# Test default parameters
297-
(time ./bin/sam -m ${model_f16} -i ${img_0} ) 2>&1 | tee -a $OUT/${ci}-main.log
297+
(time ./bin/sam -m ${model_f16} -i ${img_0} -st 0.925 ) 2>&1 | tee -a $OUT/${ci}-main.log
298298
grep -q "point prompt" $OUT/${ci}-main.log
299-
grep -q "bbox (371, 436), (144, 168)" $OUT/${ci}-main.log
299+
grep -q "bbox (371, 436), (144, 168)" $OUT/${ci}-main.log ||
300+
grep -q "bbox (370, 439), (144, 168)" $OUT/${ci}-main.log
300301

301302
# Test box prompt and single mask output
302-
(time ./bin/sam -m ${model_f16} -i ${img_0} -b 368,144,441,173 -sm) 2>&1 | tee -a $OUT/${ci}-main.log
303+
(time ./bin/sam -m ${model_f16} -i ${img_0} -st 0.925 -b 368,144,441,173 -sm) 2>&1 | tee -a $OUT/${ci}-main.log
303304
grep -q "box prompt" $OUT/${ci}-main.log
304-
grep -q "bbox (370, 439), (144, 169)" $OUT/${ci}-main.log
305+
grep -q "bbox (370, 439), (144, 169)" $OUT/${ci}-main.log ||
306+
grep -q "bbox (370, 439), (144, 168)" $OUT/${ci}-main.log
305307

306308
set +e
307309
}

src/ggml-cpu/ops.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7084,7 +7084,11 @@ static void ggml_compute_forward_conv_2d_dw_cwhn(
70847084
const int64_t row_end = MIN(row_start + rows_per_thread, rows_total);
70857085

70867086
#ifdef GGML_SIMD
7087-
const int64_t pkg_size = GGML_F32_EPR;
7087+
#if defined(__ARM_FEATURE_SVE)
7088+
const int64_t pkg_size = svcntw();
7089+
#else
7090+
const int64_t pkg_size = GGML_F32_EPR;
7091+
#endif
70887092
const int64_t pkg_count = c / pkg_size;
70897093
const int64_t c_pkg_end = pkg_count * pkg_size;
70907094
#else

0 commit comments

Comments
 (0)