LLM inference in C/C++
C++ ggml
sycl: parallelize the non-contiguous concat kernel (#25852)
Titaniumtown6c8dcaa7ae41
diff --git a/ggml/src/ggml-sycl/concat.cpp b/ggml/src/ggml-sycl/concat.cppindex 93e00d65fc..1ad242fcaf 100644--- a/ggml/src/ggml-sycl/concat.cpp+++ b/ggml/src/ggml-sycl/concat.cpp@@ -127,7 +127,15 @@ static void concat_T_sycl_non_cont(int64_t ne2, int64_t ne3, uint64_t nb0, uint64_t nb1, uint64_t nb2,uint64_t nb3, int32_t dim) {sycl::range<3> gridDim(ne3, ne2, ne1);- stream->parallel_for(sycl::nd_range<3>(gridDim, sycl::range<3>(1, 1, 1)), [=](sycl::nd_item<3> item_ct1) {++ // Avoid oversubscribing device when there is not enough elements along the innermost dim to+ // fill a full SYCL_CONCAT_BLOCK_SIZE. For larger # of elements, the full SYCL_CONCAT_BLOCK_SIZE+ // is used.+ const int64_t ne0_pad = GGML_PAD(ne0, WARP_SIZE);+ const int64_t block_ne0 = ne0_pad < SYCL_CONCAT_BLOCK_SIZE ? ne0_pad : (int64_t) SYCL_CONCAT_BLOCK_SIZE;+ sycl::range<3> blockDim(1, 1, block_ne0);++ stream->parallel_for(sycl::nd_range<3>(gridDim * blockDim, blockDim), [=](sycl::nd_item<3> item_ct1) {int64_t i3 = item_ct1.get_group(0);int64_t i2 = item_ct1.get_group(1);int64_t i1 = item_ct1.get_group(2);