]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
sycl(build): parallelize ocloc invocations (#25903)
authorTitaniumtown <redacted>
Mon, 27 Jul 2026 12:33:11 +0000 (05:33 -0700)
committerGitHub <redacted>
Mon, 27 Jul 2026 12:33:11 +0000 (15:33 +0300)
ggml/src/ggml-sycl/CMakeLists.txt

index 1c17d20df12b3823c08f69fc347673166829d5ba..a8d9c0d804bffa0a391be3e42a50266a53ef4bc2 100644 (file)
@@ -199,9 +199,20 @@ if (GGML_SYCL_DEVICE_ARCH)
         -fsycl-targets=spir64_gen
         "SHELL:-Xsycl-target-backend=spir64_gen \"-device ${GGML_SYCL_DEVICE_ARCH}\""
     )
+
+    # Pass through parallel job (process) count for parallelising the
+    # `llvm-foreach -- ocloc` invocation for compiling AOT device images.
+    include(ProcessorCount)
+    ProcessorCount(_ggml_sycl_nproc)
+    if (_ggml_sycl_nproc LESS 1)
+        set(_ggml_sycl_nproc 1)
+    endif()
+    set(GGML_SYCL_MAX_PARALLEL_LINK_JOBS ${_ggml_sycl_nproc} CACHE STRING
+        "Parallel ocloc jobs for spir64_gen AOT device-image lowering")
     target_link_options(
         ggml-sycl PRIVATE
         -fsycl-targets=spir64_gen
         "SHELL:-Xsycl-target-backend=spir64_gen \"-device ${GGML_SYCL_DEVICE_ARCH}\""
+        -fsycl-max-parallel-link-jobs=${GGML_SYCL_MAX_PARALLEL_LINK_JOBS}
     )
 endif()