Skip to content

Conversation

coldav
Copy link

@coldav coldav commented Aug 26, 2025

Bring Native CPU pipeline files into dpc++ directly.

This brings the Native CPU compiler pipeline files directly under the ownership of intel/llvm. This removes the direct dependence on the oneAPI Construction Kit, although the history of those files still exists under intel/llvm and the originals still exist at https://github.com/uxlfoundation/oneapi-construction-kit.

This was done as follows:

In the oneAPI Construction Kit repo:

    git-filter-repo --paths-from-file $script_dir/native_cpu_paths.txt \
    --path-rename modules/compiler/compiler_pipeline:llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline \
    --path-rename modules/compiler/vecz:llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz \
    --path-rename modules/compiler/multi_llvm/include/multi_llvm:llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/include/multi_llvm

See uxlfoundation/oneapi-construction-kit#969 for more info.

Under intel/llvm:

    git checkout sycl
    git checkout -b $llvm_branch
    git fetch $ock_fork $ock_branch
    # Update CMake to be more llvm like
    # clang-format-20 on added files
    # Add some new documentation to reflect the state of play.
    git merge -m "[NATIVE_CPU][SYCL] Merge from oneAPI Construction Kit into native_cpu" --allow-unrelated-histories ock_fork/$ock_branch

llvm/lib/SYCLNativeCPUUtils/CMakeLists.txt was updated to remove the fetch content and the ugly install workaround. Missing is the lit tests for the pipeline tests as these refer to the use of a non-ported tool, muxc. CMakeLists.txt across was updated to use LLVM macros across compiler_pipeline and vecz ported code, as well as changing NATIVECPU_USE_OCK to be the default. It also applies clang-format-20 to all the .h and .cpp files brought in. Other than that the .cpp and .h files are unchanged. The lit tests cfg files were updated to fit with LLVM, and a small change was made to avoid use of undef.

A brief explanation and limitations of the importing of the files are under llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_passes.rst.

This was based on the oneAPI Construction Kit as hash d3b68da068110b6f3858769ae7ce8c5f6750705b

@coldav coldav requested a review from a team as a code owner August 26, 2025 14:40
@coldav coldav changed the title DRAFT: [NATIVE_CPU][SYCL] Switch to using native_cpu compiler pipeline inline instead of OCK fetchContent DRAFT: NOT FOR REVIEW [NATIVE_CPU][SYCL] Switch to using native_cpu compiler pipeline inline instead of OCK fetchContent Aug 26, 2025
@coldav coldav force-pushed the colin/add_ock_into_dpcpp branch from e6122d8 to 5f8574c Compare August 26, 2025 15:01
@coldav coldav force-pushed the colin/add_ock_into_dpcpp branch from 5f8574c to 729e7b5 Compare August 27, 2025 08:35
@coldav coldav requested a review from a team as a code owner August 27, 2025 08:35
@coldav coldav force-pushed the colin/add_ock_into_dpcpp branch from 729e7b5 to 63d7eb8 Compare August 29, 2025 13:54
@coldav coldav force-pushed the colin/add_ock_into_dpcpp branch from 63d7eb8 to 0b99891 Compare August 29, 2025 15:02
@coldav coldav force-pushed the colin/add_ock_into_dpcpp branch from 0b99891 to 087ecb6 Compare September 2, 2025 10:07
@coldav coldav force-pushed the colin/add_ock_into_dpcpp branch from 087ecb6 to dd1785f Compare September 2, 2025 10:15
hvdijk and others added 12 commits September 5, 2025 13:48
* Obtain lifetime_(start|end) pointer argument by getting last argument.
* Do not update size argument when there is no size argument.
* Update tests.
We were generating undef in many places because in older versions of
LLVM, poison did not yet exist. As we no longer support those older
versions of LLVM, and current LLVM is deprecating undef, switch over to
poison.
We were using 'and' to filter branch conditions, trusting that if an
entry mask had it set to false, it would assuredly be kept false. This
does not work when a branch condition is computed as 'poison', as 'false
and poison' evaluates to 'poison', not 'false'.

We can generate 'select' instructions instead, which avoid this problem.
Further updates to account for the deprecation of undef: this updates
documentation and variable names in line with the previous update to use
poison more. It updates tests to no longer use undef where we would no
longer generate undef. It restores one use of UndefValue::get where the
replacement with PoisonValue::get was wrong: SPIR-V's OpUndef does not
allow treating it as poison.
A number of tests were still using %pp-llvm-ver despite not having any
LLVM-version-conditional checks.
LLVM 21.1.0 has been released, so by our policy of supporting the two
most recent LLVM releases, we can now move from LLVM 19/20 to
LLVM 20/21.
undef_debug_info.ll was originally added to test that we did not
generate debug info with undef, because we were unable to handle that
properly. Later on, when we were able to handle that properly, I removed
the logic for keeping undef out of debug info in intel#375, at which point
this test no longer tested anything useful. This PR finally removes it.
We require LLVM 20 or newer, so a whole lot of version checks are no
longer necessary, and a number of tests that were only running on older
LLVM versions no longer serve a purpose. Remove the checks and tests as
appropriate.
These tests were inadvertently disabled and hence had not been kept up
to date with current LLVM versions. This commit enables and updates
them.
There were clang-format-20 and python formatting fixes required post
integration of oneAPI Construction Kit pipeline which are addressed here.
This brings the Native CPU compiler pipeline files directly under the ownership
of intel/llvm. This removes the direct dependence on the oneAPI Construction
Kit, although the history of those files still exists under intel/llvm and the
originals still exist at
https://github.com/uxlfoundation/oneapi-construction-kit.

This is the post merge update to the the oneAPI Construction Kit move of the compiler
pipeline files for Native CPU and replaces the original FetchContent method.

`llvm/lib/SYCLNativeCPUUtils/CMakeLists.txt` was updated to remove the fetch
content and the ugly install workaround. Missing is the lit tests for the
pipeline tests as these refer to the use of a non-ported tool, `muxc`.
CMakeLists.txt across was updated to use LLVM macros across `compiler_pipeline`
and `vecz` ported code, as well as changing `NATIVECPU_USE_OCK` to be the
default.The lit tests cfg files were updated to fit with LLVM, and a small
change was made to avoid use of `undef`.

A brief explanation and limitations of the importing of the files are under
`llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_passes.rst`.
@coldav coldav force-pushed the colin/add_ock_into_dpcpp branch from 86b21b5 to 477f0cd Compare September 5, 2025 13:06
@coldav
Copy link
Author

coldav commented Sep 5, 2025

Note: I've removed most of the docs in favour of a separate PR under sycl/docs.

aelovikov-intel
aelovikov-intel previously approved these changes Sep 5, 2025
@aelovikov-intel aelovikov-intel requested review from steffenlarsen and removed request for steffenlarsen September 5, 2025 14:35
@aelovikov-intel
Copy link
Contributor

@intel/dpcpp-nativecpu-reviewers , this seems to be blocked by your review.

@aelovikov-intel aelovikov-intel dismissed their stale review September 5, 2025 14:36

This needs to be merged and not squashed. Removing my approval to prevent accidental squash.

@aelovikov-intel
Copy link
Contributor

/merge

1 similar comment
@sarnex
Copy link
Contributor

sarnex commented Sep 5, 2025

/merge

@aelovikov-intel aelovikov-intel merged commit bbae036 into intel:sycl Sep 5, 2025
46 checks passed
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.