Skip to content

Commit 50d4e46

Browse files
committed
Use ceil_div
1 parent c722720 commit 50d4e46

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ggml/src/ggml-sycl/rope.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ static void rope_norm_sycl(const T * x, T * dst, const int ne0, const int ne1, c
222222
const float * freq_factors, queue_ptr stream) {
223223
GGML_ASSERT(ne0 % 2 == 0);
224224
const sycl::range<3> block_dims(1, SYCL_ROPE_BLOCK_SIZE, 1);
225-
const int num_blocks_x = (ne0 + 2 * SYCL_ROPE_BLOCK_SIZE - 1) / (2 * SYCL_ROPE_BLOCK_SIZE);
225+
const int num_blocks_x = ceil_div(ne0, (2 * SYCL_ROPE_BLOCK_SIZE));
226226
const sycl::range<3> block_nums(1, num_blocks_x, nr);
227227

228228
const float theta_scale = powf(freq_base, -2.0f / n_dims);
@@ -259,7 +259,7 @@ static void rope_neox_sycl(const T * x, T * dst, const int ne0, const int ne1, c
259259
const rope_corr_dims corr_dims, const float * freq_factors, queue_ptr stream) {
260260
GGML_ASSERT(ne0 % 2 == 0);
261261
const sycl::range<3> block_dims(1, SYCL_ROPE_BLOCK_SIZE, 1);
262-
const int num_blocks_x = (ne0 + 2 * SYCL_ROPE_BLOCK_SIZE - 1) / (2 * SYCL_ROPE_BLOCK_SIZE);
262+
const int num_blocks_x = ceil_div(ne0, (2 * SYCL_ROPE_BLOCK_SIZE));
263263
const sycl::range<3> block_nums(1, num_blocks_x, nr);
264264

265265
const float theta_scale = powf(freq_base, -2.0f / n_dims);
@@ -287,7 +287,7 @@ static void rope_multi_sycl(const T * x, T * dst, const int ne0, const int ne1,
287287
const mrope_sections sections, queue_ptr stream) {
288288
GGML_ASSERT(ne0 % 2 == 0);
289289
const sycl::range<3> block_dims(1, SYCL_ROPE_BLOCK_SIZE, 1);
290-
const int n_blocks_y = (ne0 + 2 * SYCL_ROPE_BLOCK_SIZE - 1) / (2 * SYCL_ROPE_BLOCK_SIZE);
290+
const int n_blocks_y = ceil_div(ne0, (2 * SYCL_ROPE_BLOCK_SIZE));
291291
const sycl::range<3> grid_dims(1, n_blocks_y, nr);
292292
const sycl::nd_range<3> nd_range(grid_dims * block_dims, block_dims);
293293

@@ -322,7 +322,7 @@ static void rope_vision_sycl(const T * x, T * dst, const int ne0, const int ne1,
322322
const mrope_sections sections, queue_ptr stream) {
323323
GGML_ASSERT(ne0 % 2 == 0);
324324
const sycl::range<3> block_dims(1, SYCL_ROPE_BLOCK_SIZE, 1);
325-
const int n_blocks_y = (ne0 + 2 * SYCL_ROPE_BLOCK_SIZE - 1) / (2 * SYCL_ROPE_BLOCK_SIZE);
325+
const int n_blocks_y = ceil_div(ne0, (2 * SYCL_ROPE_BLOCK_SIZE));
326326
const sycl::range<3> grid_dims(1, n_blocks_y, nr);
327327
const sycl::nd_range<3> nd_range(grid_dims * block_dims, block_dims);
328328

0 commit comments

Comments
 (0)