Skip to content

Commit 59f671b

Browse files
author
Colin Davidson
committed
Updates for latest native_cpu updates.
1 parent 973f7ae commit 59f671b

5 files changed

Lines changed: 66 additions & 64 deletions

scripts/create_native_cpu.sh

Lines changed: 34 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -12,22 +12,19 @@ set -x
1212
rm -rf $1
1313
git clone git@github.com:uxlfoundation/oneapi-construction-kit.git $1
1414
cd $1
15-
git-filter-repo --paths-from-file $script_dir/native_cpu_paths.txt
16-
mkdir -p llvm/lib/SYCLNativeCPUUtils/compiler_passes
17-
18-
git mv modules/compiler/compiler_pipeline llvm/lib/SYCLNativeCPUUtils/compiler_passes/
19-
git mv modules/compiler/vecz/ llvm/lib/SYCLNativeCPUUtils/compiler_passes/
20-
git mv modules/compiler/multi_llvm/include/multi_llvm llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/include/
21-
git rm -rf modules
22-
cp $script_dir/native_cpu_compiler_passes_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/CMakeLists.txt
23-
cp $script_dir/native_cpu_compiler_pipeline_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/CMakeLists.txt
24-
cp $script_dir/native_cpu_vecz_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/CMakeLists.txt
15+
git-filter-repo --paths-from-file $script_dir/native_cpu_paths.txt \
16+
--path-rename modules/compiler/compiler_pipeline:llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline \
17+
--path-rename modules/compiler/vecz:llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz \
18+
--path-rename modules/compiler/multi_llvm/include/multi_llvm:llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/include/multi_llvm \
19+
--path-rename doc/modules/vecz/vecz.md:llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/vecz.md \
20+
--path-rename doc/modules/compiler/overview.rst:llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/docs/overview.rst \
21+
--path-rename doc/modules/compiler/utils.rst:llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/docs/utils.rst
2522

2623
if [ "$ock_branch" != "" ]; then
27-
git branch -D $ock_branch
24+
git branch -D $ock_branch || true
2825
git checkout -b $ock_branch
29-
git add llvm
30-
git commit -F $script_dir/native_cpu_commit_message.txt
26+
# git add llvm
27+
# git commit -F $script_dir/native_cpu_commit_message.txt
3128
git clean -d -f
3229
git remote add ock_fork git@github.com:${ock_user}/oneapi-construction-kit.git
3330
git push --set-upstream ock_fork $ock_branch --force
@@ -36,53 +33,34 @@ if [ "$ock_branch" != "" ]; then
3633
if [ "$llvm_branch" != "" ]; then
3734
cd $llvm_repo
3835
git checkout sycl
39-
git branch -D $llvm_branch
36+
git clean -d -f
37+
git branch -D $llvm_branch || true
38+
git remote add ock_fork git@github.com:${ock_user}/oneapi-construction-kit.git || true
4039
git checkout -b $llvm_branch
4140
git fetch ock_fork $ock_branch
4241
git merge -m "[NATIVE_CPU][SYCL] Merge from oneAPI Construction Kit into native_cpu" --allow-unrelated-histories ock_fork/$ock_branch
4342
cp $script_dir/native_cpu_CMakeLists.txt $llvm_repo/llvm/lib/SYCLNativeCPUUtils/CMakeLists.txt
44-
sed -i "s/DNATIVECPU_USE_OCK=OFF/DNATIVECPU_USE_OCK=ON/" $llvm_repo/.github/workflows/sycl-linux-build.yml
45-
git add $llvm_repo/llvm/lib/SYCLNativeCPUUtils/CMakeLists.txt $llvm_repo/.github/workflows/sycl-linux-build.yml
46-
git commit -m "[NATIVE_CPU][SYCL] Switch to using native_cpu compiler pipeline inline from OCK fetch"
43+
sed -i "s/DNATIVECPU_USE_OCK=Off/DNATIVECPU_USE_OCK=ON/" $llvm_repo/.github/workflows/sycl-linux-build.yml
44+
sed -i -e "s/config.name = 'Vecz'/config.name = \"Vecz\"/" -e "s/config.suffixes = \['.hlsl', '.ll'\]/config.suffixes = \[\".hlsl\", \".ll\"\]/" $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/lit/lit.cfg.py
45+
for f in $( find $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes -name '*.h' -o -name '*.cpp' -o -name '*.inc'); do
46+
clang-format $f > /tmp/format.txt; cp /tmp/format.txt $f
47+
done
48+
cp $script_dir/native_cpu_compiler_passes_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/CMakeLists.txt
49+
cp $script_dir/native_cpu_compiler_passes.rst llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_passes.rst
50+
cp $script_dir/native_cpu_compiler_pipeline_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/CMakeLists.txt
51+
cp $script_dir/native_cpu_vecz_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/CMakeLists.txt
52+
cp $script_dir/native_cpu_vecz_test_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/CMakeLists.txt
53+
cp $script_dir/native_cpu_vecz_lit_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/lit/CMakeLists.txt
54+
cp $native_cpu_vecz_test_lit_lit.cfg.py llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/lit/CMakeLists.txt
55+
cp $script_dir/native_cpu_vecz_tools_CMakeLists.txt llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/tools/CMakeLists.txt
56+
cp $script_dir/native_cpu_vecz_test_lit_lit.cfg.py llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/lit/lit.cfg.py
57+
cp $script_dir/native_cpu_vecz_test_lit_lit.site.cfg.py.in llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/lit/lit.site.cfg.py.in
58+
cp $script_dir/native_cpu_vecz_test_lit_llvm_RISCV_lit.local.cfg llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/lit/llvm/RISCV/lit.local.cfg
59+
git apply --index $script_dir/native_cpu_vecz_lit.patch
60+
git add llvm/lib/SYCLNativeCPUUtils .github/workflows/sycl-linux-build.yml
61+
git rm $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/lit/llvm/partial_linearization22-llvm18.ll
62+
git rm $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/test/lit/llvm/ScalableVectors/lit.local.cfg
63+
git commit -F $script_dir/native_cpu_commit_message.txt
4764
fi
4865
fi
4966
fi
50-
51-
52-
# mkdir -p $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes
53-
# cp -r $ock_repo/modules/compiler/multi_llvm/include/multi_llvm/* $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/include/multi_llvm
54-
# cp -r $ock_repo/modules/compiler/vecz/include/vecz/* $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/include
55-
56-
# for f in address_spaces.h cl_builtin_info.h encode_kernel_metadata_pass.h pass_functions.h scheduling.h verify_reqd_sub_group_size_pass.h \
57-
# attributes.h define_mux_builtins_pass.h group_collective_helpers.h pass_machinery.h sub_group_analysis.h work_item_loops_pass.h \
58-
# barrier_regions.h device_info.h mangling.h prepare_barriers_pass.h target_extension_types.h \
59-
# builtin_info.h dma.h metadata.h replace_local_module_scope_variables_pass.h unique_opaque_structs_pass.h
60-
# do
61-
# cp $ock_repo/modules/compiler/compiler_pipeline/include/compiler/utils/$f $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/include/compiler/utils
62-
# done
63-
64-
# for f in attributes.cpp define_mux_builtins_pass.cpp mangling.cpp pass_machinery.cpp sub_group_analysis.cpp work_item_loops_pass.cpp \
65-
# barrier_regions.cpp dma.cpp metadata.cpp prepare_barriers_pass.cpp target_extension_types.cpp \
66-
# builtin_info.cpp encode_kernel_metadata_pass.cpp mux_builtin_info.cpp replace_local_module_scope_variables_pass.cpp unique_opaque_structs_pass.cpp \
67-
# cl_builtin_info.cpp group_collective_helpers.cpp pass_functions.cpp scheduling.cpp verify_reqd_sub_group_size_pass.cpp
68-
# do
69-
# echo $f
70-
# done
71-
# cp $ock_repo/modules/compiler/compiler_pipeline/source/$f $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/source
72-
73-
74-
75-
# cp -r $ock_repo/modules/compiler/compiler_pipeline/include/ $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes
76-
# cp -r $ock_repo/modules/compiler/vecz $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes
77-
# mkdir -p $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/cmake
78-
# cp $ock_repo/cmake/AddCA.cmake $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/cmake
79-
# cp $ock_repo/scripts/native_cpu_CMakeLists.txt $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/CMakeLists.txt
80-
# rm $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz/README.md
81-
# cp $ock_repo/doc/modules/vecz.rst $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/vecz
82-
# mkdir -p $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/docs
83-
# cp -r $ock_repo/doc/modules/compiler* $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_pipeline/docs
84-
# cd $llvm_repo/llvm/lib/SYCLNativeCPUUtils/
85-
# git -C $llvm_repo apply $ock_repo/scripts/DPCPP-0001-Update-CMakeLists.txt-to-automatically-use-included-.patch
86-
# git -C $llvm_repo add $llvm_repo/llvm/lib/SYCLNativeCPUUtils/compiler_passes
87-
# git -C $llvm_repo add $llvm_repo/llvm/lib/SYCLNativeCPUUtils/CMakeLists.txt
88-

scripts/native_cpu_commit_message.txt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
1-
[NATIVE_CPU][SYCL] Update CMakes to be more LLVM like and update directory structure
1+
[NATIVE_CPU][SYCL] Switch to using native_cpu compiler pipeline inline
2+
3+
This brings the native cpu compiler pipeline files directly under the ownership
4+
of intel/llvm. This removes the direct dependence on the oneAPI Construction
5+
Kit, although the history of those files still exists under intel/llvm and the
6+
originals still exist at
7+
https://github.com/uxlfoundation/oneapi-construction-kit.
8+
9+
This is the post merge update to the the oneAPI Construction Kit move of the compiler
10+
pipeline files for Native CPU and replaces the original FetchContent method.
11+
12+
This updates the CMakeLists.txt to be appropriate for llvm components,
13+
rather in the style of oneAPI Construction Kit. It also applies clang-format-20 to all the
14+
.h and .cpp files brought in. Other than that the .cpp and .h files are unchanged.
15+
16+
A brief explanation and limitations of the importing of the files are under l
17+
lvm/lib/SYCLNativeCPUUtils/compiler_passes/compiler_passes.rst.
18+
19+
It also updates the NATIVECPU_USE_OCK to be on in sycl-linux-build.yml.
20+
221

3-
Move directory structure of files required for native cpu into appropriate
4-
directory structure under lvm/lib/SYCLNativeCPUUtils.
522

6-
This also updates the CMakeLists.txt to be appropriate for llvm components,
7-
rather in the style of oneAPI Construction Kit.

scripts/native_cpu_compiler_pipeline_CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ add_llvm_component_library(LLVMNativeCPUPipeline
1111
${CMAKE_CURRENT_SOURCE_DIR}/source/metadata.cpp
1212
${CMAKE_CURRENT_SOURCE_DIR}/source/mux_builtin_info.cpp
1313
${CMAKE_CURRENT_SOURCE_DIR}/source/pass_functions.cpp
14+
${CMAKE_CURRENT_SOURCE_DIR}/source/optimal_builtin_replacement_pass.cpp
1415
${CMAKE_CURRENT_SOURCE_DIR}/source/pass_machinery.cpp
1516
${CMAKE_CURRENT_SOURCE_DIR}/source/prepare_barriers_pass.cpp
1617
${CMAKE_CURRENT_SOURCE_DIR}/source/replace_local_module_scope_variables_pass.cpp

scripts/native_cpu_paths.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
modules/compiler/vecz
1+
modules/compiler/vecz/include
2+
modules/compiler/vecz/source
3+
modules/compiler/vecz/test/lit/llvm
4+
modules/compiler/vecz/tools/source
5+
doc/modules/vecz/vecz.md
6+
doc/modules/compiler/overview.rst
7+
doc/modules/compiler/utils.rst
28
modules/compiler/compiler_pipeline/include/compiler/utils/address_spaces.h
39
modules/compiler/compiler_pipeline/include/compiler/utils/cl_builtin_info.h
410
modules/compiler/compiler_pipeline/include/compiler/utils/encode_kernel_metadata_pass.h
@@ -8,6 +14,7 @@ modules/compiler/compiler_pipeline/include/compiler/utils/verify_reqd_sub_group_
814
modules/compiler/compiler_pipeline/include/compiler/utils/attributes.h
915
modules/compiler/compiler_pipeline/include/compiler/utils/define_mux_builtins_pass.h
1016
modules/compiler/compiler_pipeline/include/compiler/utils/group_collective_helpers.h
17+
modules/compiler/compiler_pipeline/include/compiler/utils/optimal_builtin_replacement_pass.h
1118
modules/compiler/compiler_pipeline/include/compiler/utils/pass_machinery.h
1219
modules/compiler/compiler_pipeline/include/compiler/utils/sub_group_analysis.h
1320
modules/compiler/compiler_pipeline/include/compiler/utils/work_item_loops_pass.h
@@ -24,6 +31,7 @@ modules/compiler/compiler_pipeline/include/compiler/utils/unique_opaque_structs_
2431
modules/compiler/compiler_pipeline/source/attributes.cpp
2532
modules/compiler/compiler_pipeline/source/define_mux_builtins_pass.cpp
2633
modules/compiler/compiler_pipeline/source/mangling.cpp
34+
modules/compiler/compiler_pipeline/source/optimal_builtin_replacement_pass.cpp
2735
modules/compiler/compiler_pipeline/source/pass_machinery.cpp
2836
modules/compiler/compiler_pipeline/source/sub_group_analysis.cpp
2937
modules/compiler/compiler_pipeline/source/work_item_loops_pass.cpp

scripts/native_cpu_vecz_CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,8 @@ target_compile_definitions(LLVMNativeCPUVecz PRIVATE
127127
${VECZ_COMPILE_DEFINITIONS})
128128

129129
# Currently disabled by default, these allow us to run lit tests using veczc
130-
set(BUILD_VECZ_TEST_TOOLS OFF CACHE BOOL "Build vecz test and tools" FORCE)
131-
if (BUILD_VECZ_TEST_TOOLS)
130+
set(NATIVE_CPU_BUILD_VECZ_TEST_TOOLS OFF CACHE BOOL "Build vecz test and tools")
131+
if (NATIVE_CPU_BUILD_VECZ_TEST_TOOLS)
132132
add_subdirectory(tools)
133133
add_subdirectory(test)
134134
endif()

0 commit comments

Comments
 (0)