Skip to content

fix(cmake): only apply /MP to the MSVC compiler, not icx - #1846

Merged
leejet merged 1 commit into
leejet:masterfrom
Stanley5249:fix/msvc-mp-icx-sycl
Aug 4, 2026
Merged

fix(cmake): only apply /MP to the MSVC compiler, not icx#1846
leejet merged 1 commit into
leejet:masterfrom
Stanley5249:fix/msvc-mp-icx-sycl

Conversation

@Stanley5249

Copy link
Copy Markdown
Contributor

Summary

  • /MP is currently gated only on the top-level MSVC variable, which stays true for a mixed cl/icx SYCL toolchain (-DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx). That leaks /MP onto the icx CXX compile line.
  • icx rejects /MP once offloading is enabled, so every Windows SYCL build (-DSD_SYCL=ON) currently fails to configure/build.
  • This was introduced by chore: enable MSVC parallel compilation with /MP #1438, which added /MP unconditionally inside if (MSVC) without checking the per-language compiler ID.
  • Fix: gate /MP on $<C_COMPILER_ID:MSVC> / $<CXX_COMPILER_ID:MSVC> in addition to the existing COMPILE_LANGUAGE generator expressions, so it only applies when the actual per-language compiler is MSVC's cl.

Related Issue / Discussion

No existing issue found for this; searched for /MP, icx, and SYCL build-error reports before opening this PR.

Additional Information

Verified with a clean Windows SYCL build (-DSD_SYCL=ON -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx, oneAPI 2025.x, MSVC 2022):

  • Before the fix: build fails during the SYCL backend compile once offloading is enabled, with icx rejecting /MP.
  • After the fix: full build succeeds; compile_commands.json shows 0 of the ggml-sycl entries carrying /MP, while MSVC-compiled (cl) translation units still get it.
  • Non-SYCL MSVC builds are unaffected — /MP is still applied there since C_COMPILER_ID/CXX_COMPILER_ID is MSVC in that configuration.

Checklist

The MSVC top-level generator/toolset check stays true for mixed
`cl`/`icx` SYCL builds (-DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx),
so the unconditional /MP added in leejet#1438 leaks into the icx CXX
compile line. icx rejects /MP once offloading is enabled, breaking
every Windows SYCL build. Gate /MP on the per-language compiler ID
instead of the generator-level MSVC variable.
@leejet
leejet merged commit b4e67d1 into leejet:master Aug 4, 2026
9 checks passed
@Stanley5249
Stanley5249 deleted the fix/msvc-mp-icx-sycl branch August 4, 2026 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants