Skip to content

Commit 8e8681e

Browse files
authored
sycl(build): parallelize ocloc invocations (ggml-org#25903)
1 parent dee2a84 commit 8e8681e

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

ggml/src/ggml-sycl/CMakeLists.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,20 @@ if (GGML_SYCL_DEVICE_ARCH)
199199
-fsycl-targets=spir64_gen
200200
"SHELL:-Xsycl-target-backend=spir64_gen \"-device ${GGML_SYCL_DEVICE_ARCH}\""
201201
)
202+
203+
# Pass through parallel job (process) count for parallelising the
204+
# `llvm-foreach -- ocloc` invocation for compiling AOT device images.
205+
include(ProcessorCount)
206+
ProcessorCount(_ggml_sycl_nproc)
207+
if (_ggml_sycl_nproc LESS 1)
208+
set(_ggml_sycl_nproc 1)
209+
endif()
210+
set(GGML_SYCL_MAX_PARALLEL_LINK_JOBS ${_ggml_sycl_nproc} CACHE STRING
211+
"Parallel ocloc jobs for spir64_gen AOT device-image lowering")
202212
target_link_options(
203213
ggml-sycl PRIVATE
204214
-fsycl-targets=spir64_gen
205215
"SHELL:-Xsycl-target-backend=spir64_gen \"-device ${GGML_SYCL_DEVICE_ARCH}\""
216+
-fsycl-max-parallel-link-jobs=${GGML_SYCL_MAX_PARALLEL_LINK_JOBS}
206217
)
207218
endif()

0 commit comments

Comments
 (0)