fix(cmake): only apply /MP to the MSVC compiler, not icx - #1846
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/MPis currently gated only on the top-levelMSVCvariable, which stays true for a mixedcl/icxSYCL toolchain (-DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=icx). That leaks/MPonto theicxCXX compile line.icxrejects/MPonce offloading is enabled, so every Windows SYCL build (-DSD_SYCL=ON) currently fails to configure/build./MPunconditionally insideif (MSVC)without checking the per-language compiler ID./MPon$<C_COMPILER_ID:MSVC>/$<CXX_COMPILER_ID:MSVC>in addition to the existingCOMPILE_LANGUAGEgenerator expressions, so it only applies when the actual per-language compiler is MSVC'scl.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):icxrejecting/MP.compile_commands.jsonshows 0 of theggml-syclentries carrying/MP, while MSVC-compiled (cl) translation units still get it./MPis still applied there sinceC_COMPILER_ID/CXX_COMPILER_IDisMSVCin that configuration.Checklist