Skip to content

Commit 9e0cdab

Browse files
committed
Merge branch 'sycl' into move_esimd_split
2 parents fd4562a + ce54584 commit 9e0cdab

File tree

630 files changed

+101986
-308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

630 files changed

+101986
-308
lines changed

.github/workflows/sycl-linux-build.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,7 @@ jobs:
202202
--ci-defaults ${{ inputs.build_configure_extra_args }} \
203203
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
204204
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
205-
-DLLVM_INSTALL_UTILS=ON \
206-
-DNATIVECPU_USE_OCK=Off
205+
-DLLVM_INSTALL_UTILS=ON
207206
- name: Compile
208207
id: build
209208
# Emulate default value for manual dispatch as we've run out of available arguments.

clang/lib/Driver/ToolChains/SYCL.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "llvm/SYCLLowerIR/DeviceConfigFile.hpp"
1414
#include "llvm/Support/CommandLine.h"
1515
#include "llvm/Support/Path.h"
16+
#include "llvm/Support/VirtualFileSystem.h"
1617
#include <sstream>
1718

1819
using namespace clang::driver;
@@ -55,7 +56,7 @@ const char *SYCLInstallationDetector::findLibspirvPath(
5556

5657
// If -fsycl-libspirv-path= is specified, try to use that path directly.
5758
if (Arg *A = Args.getLastArg(options::OPT_fsycl_libspirv_path_EQ)) {
58-
if (llvm::sys::fs::exists(A->getValue()))
59+
if (D.getVFS().exists(A->getValue()))
5960
return A->getValue();
6061

6162
return nullptr;
@@ -68,7 +69,7 @@ const char *SYCLInstallationDetector::findLibspirvPath(
6869
SmallString<128> LibraryPath(Path);
6970
llvm::sys::path::append(LibraryPath, a, b, c, Basename);
7071

71-
if (llvm::sys::fs::exists(LibraryPath))
72+
if (D.getVFS().exists(LibraryPath))
7273
return Args.MakeArgString(LibraryPath);
7374

7475
return nullptr;

clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,9 @@ Expected<StringRef> writeOffloadFile(const OffloadFile &File,
305305
sys::path::stem(Binary.getMemoryBufferRef().getBufferIdentifier());
306306
StringRef Suffix = getImageKindName(Binary.getImageKind());
307307

308+
StringRef BinArch = (Binary.getArch() == "*") ? "any" : Binary.getArch();
308309
auto TempFileOrErr = createOutputFile(
309-
Prefix + "-" + Binary.getTriple() + "-" + Binary.getArch(),
310+
Prefix + "-" + Binary.getTriple() + "-" + BinArch,
310311
HasSYCLOffloadKind ? getImageKindName(Binary.getImageKind()) : "o");
311312
if (!TempFileOrErr)
312313
return TempFileOrErr.takeError();

devops/dependencies-igc-dev.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"linux": {
33
"igc_dev": {
4-
"github_tag": "igc-dev-46629d9",
5-
"version": "46629d9",
6-
"updated_at": "2025-08-30T10:44:04Z",
7-
"url": "https://api.github.com/repos/intel/intel-graphics-compiler/actions/artifacts/3889106305/zip",
4+
"github_tag": "igc-dev-788001e",
5+
"version": "788001e",
6+
"updated_at": "2025-09-03T22:42:39Z",
7+
"url": "https://api.github.com/repos/intel/intel-graphics-compiler/actions/artifacts/3921755581/zip",
88
"root": "{DEPS_ROOT}/opencl/runtime/linux/oclgpu"
99
}
1010
}
Lines changed: 17 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
set(OCK_LIBS)
2+
option(NATIVECPU_USE_OCK "Use the oneAPI Construction Kit for Native CPU" ON)
3+
4+
# Don't use OCK compiler_passes if Native CPU is not enabled.
5+
if(NOT "native_cpu" IN_LIST SYCL_ENABLE_BACKENDS)
6+
set(NATIVECPU_USE_OCK Off CACHE BOOL "Use the oneAPI Construction Kit for Native CPU" FORCE)
7+
endif()
8+
9+
if(NATIVECPU_USE_OCK)
10+
add_subdirectory(compiler_passes EXCLUDE_FROM_ALL)
11+
set(OCK_LIBS NativeCPUPipeline NativeCPUVecz)
12+
endif()
13+
114
add_llvm_component_library(LLVMSYCLNativeCPUUtils
215
PipelineSYCLNativeCPU.cpp
316
PrepareSYCLNativeCPU.cpp
@@ -17,80 +30,13 @@ add_llvm_component_library(LLVMSYCLNativeCPUUtils
1730
TargetParser
1831
TransformUtils
1932
ipo
20-
)
33+
${OCK_LIBS}
34+
)
2135

22-
option(NATIVECPU_USE_OCK "Use the oneAPI Construction Kit for Native CPU" ON)
23-
24-
# Don't fetch OCK if Native CPU is not enabled.
25-
if(NOT "native_cpu" IN_LIST SYCL_ENABLE_BACKENDS)
26-
set(NATIVECPU_USE_OCK Off CACHE BOOL "Use the oneAPI Construction Kit for Native CPU" FORCE)
27-
endif()
2836

2937
if(NATIVECPU_USE_OCK)
30-
set(OCK_SEARCH_LOC "oneapi-construction-kit/compiler_passes")
31-
if(NOT FETCHCONTENT_SOURCE_DIR_ONEAPI-CK)
32-
find_path(OCK_SOURCE_DIR ${OCK_SEARCH_LOC} PATHS ${CMAKE_PREFIX_PATH})
33-
endif()
34-
if(OCK_SOURCE_DIR)
35-
message(STATUS "Found system source location of oneAPI Construction Kit in ${OCK_SOURCE_DIR}")
36-
set(OCK_SOURCE_DIR "${OCK_SOURCE_DIR}/${OCK_SEARCH_LOC}")
37-
set(OCK_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/oneapi-construction-kit")
38-
else()
39-
set(OCK_GIT_REPO "https://github.com/uxlfoundation/oneapi-construction-kit.git")
40-
# commit d0a32d701e34b3285de7ce776ea36abfec673df7
41-
# Merge: a9f848e0e8 56473a8c25
42-
# Author: Harald van Dijk <[email protected]>
43-
# Date: Mon Jun 30 12:24:46 2025 +0100
44-
#
45-
# Merge pull request #878 from hvdijk/specify-fuse-ld-lld
46-
#
47-
# [RefSi] Explicitly specify -fuse-ld=lld.
48-
set(OCK_GIT_TAG d0a32d701e34b3285de7ce776ea36abfec673df7)
49-
50-
include(FetchContent)
51-
FetchContent_Declare(oneapi-ck
52-
GIT_REPOSITORY "${OCK_GIT_REPO}"
53-
GIT_TAG "${OCK_GIT_TAG}"
54-
)
55-
FetchContent_GetProperties(oneapi-ck)
56-
if(NOT oneapi-ck_POPULATED)
57-
if(FETCHCONTENT_SOURCE_DIR_ONEAPI-CK)
58-
message(STATUS "Using specified oneAPI Construction Kit repo location at ${FETCHCONTENT_SOURCE_DIR_ONEAPI-CK}")
59-
else()
60-
message(STATUS "Cloning oneAPI Construction Kit from ${OCK_GIT_REPO}, tag ${OCK_GIT_TAG}")
61-
endif()
62-
FetchContent_Populate(oneapi-ck)
63-
message(STATUS "oneAPI Construction Kit cloned in ${oneapi-ck_SOURCE_DIR}")
64-
set(OCK_SOURCE_DIR ${oneapi-ck_SOURCE_DIR}/compiler_passes)
65-
set(OCK_BINARY_DIR ${oneapi-ck_BINARY_DIR})
66-
endif()
67-
endif()
68-
69-
set(CA_ENABLE_API "cl" CACHE STRING "" FORCE)
70-
add_subdirectory(
71-
${OCK_SOURCE_DIR}
72-
${OCK_BINARY_DIR} EXCLUDE_FROM_ALL)
73-
74-
install(TARGETS compiler-pipeline
75-
EXPORT;LLVMExports
76-
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline
77-
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline
78-
RUNTIME DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT compiler-pipeline)
79-
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS compiler-pipeline)
80-
install(TARGETS vecz
81-
EXPORT;LLVMExports
82-
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz
83-
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz
84-
RUNTIME DESTINATION lib${LLVM_LIBDIR_SUFFIX} COMPONENT vecz)
85-
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS vecz)
86-
install(TARGETS multi_llvm EXPORT;LLVMExports)
87-
set_property(GLOBAL APPEND PROPERTY LLVM_EXPORTS multi_llvm)
8838
target_compile_definitions(LLVMSYCLNativeCPUUtils PRIVATE NATIVECPU_USE_OCK)
8939
target_include_directories(LLVMSYCLNativeCPUUtils PRIVATE
90-
${oneapi-ck_SOURCE_DIR}/modules/compiler/multi_llvm/include
91-
${oneapi-ck_SOURCE_DIR}/modules/cargo/include
92-
${oneapi-ck_SOURCE_DIR}/modules/compiler/vecz/include
93-
${oneapi-ck_SOURCE_DIR}/modules/compiler/utils/include)
94-
target_link_libraries(LLVMSYCLNativeCPUUtils PRIVATE compiler-pipeline vecz)
95-
40+
${CMAKE_CURRENT_SOURCE_DIR}/compiler_passes/compiler_pipeline/include
41+
${CMAKE_CURRENT_SOURCE_DIR}/compiler_passes/vecz/include)
9642
endif()
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/compiler_pipeline)
2+
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vecz)
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
Compiler passes
2+
===============
3+
4+
Introduction
5+
------------
6+
7+
Files under this directory are integrated from the `oneAPI Construction Kit`_
8+
using `git-filter-repo`. They are used by Native CPU to help create a pipeline for
9+
turning a base kernel into something which can be executed across multiple work
10+
items, including auto-vectorization.
11+
12+
These files are largely from the sub-directories
13+
**modules/compiler/compiler_pipeline**, **modules/compiler/vecz** and
14+
**modules/compiler/multi_llvm**. Only files that are used have been integrated
15+
and the **CMake** files have been updated to fit in with LLVM components.
16+
17+
These sub-directories are used as follows:
18+
19+
* **compiler_pipeline** provides the passes to build a pipeline from the initial
20+
kernel, including generating working item loops, handling local memory,
21+
handling metadata and calling the vectorizer **vecz**.
22+
23+
* **vecz** provides a full function vectorizer, which generates a copy of the
24+
original function but vectorized across the work group, taking into account
25+
subgroups.
26+
27+
* **multi_llvm**. This provides some support for these functions to work across
28+
multiple LLVM versions. Although this is not strictly needed in LLVM, it has
29+
been integrated to allow the integration to go smoothly, without changing files
30+
directly. Note this is header only and exists under
31+
**compiler_pipeline/include/multi_llvm**.
32+
33+
**compiler_pipeline** and **vecz** will be documented under `sycl/docs`. Note
34+
that there are several limitations in the code that are a result of the initial
35+
integration. These should be addressed over time for maintainability reasons,
36+
they are not necessary for correctness or performance reasons.
37+
38+
General limitations
39+
-------------------
40+
41+
To simplify the integration and reduce risk, most of the files were integrated
42+
with no changes at all. This means there are currently the following limitations:
43+
44+
* The namespace in **compiler_pipeline** is **compiler/utils**, the namespace in
45+
multi_llvm is **multi_llvm** and the namespace in **vecz** is **vecz**. These should
46+
be updated to reflect being under **LLVM**.
47+
* include files should ideally be moved to under **llvm/include** but remain under
48+
these directories after the integration.
49+
* **vecz** has a test tool **veczc** and associated **lit** tests. This tool if
50+
required should be moved under **llvm/tools** or **llvm/test**. This is also
51+
requires `NATIVE_CPU_BUILD_VECZ_TEST_TOOLS` **CMake** option to build. This can be
52+
run using the target `check-sycl-vecz`.
53+
* **compiler_pipeline** has lit tests for the passes which have not been integrated.
54+
This is because they use a tool **muxc**, but these passes should be
55+
able to be tested using **opt**. These lit tests can be found in the
56+
`pipeline pass tests`_.
57+
* There are many integrated files that are unlikely to have any code coverage but because
58+
there are referred to in other files which we do need, they exist here. These
59+
should be pruned over time as a better understanding is made of what is
60+
essential.
61+
62+
.. _oneAPI Construction Kit: https://github.com/uxlfoundation/oneapi-construction-kit
63+
.. _pipeline pass tests: https://github.com/uxlfoundation/oneapi-construction-kit/tree/main/modules/compiler/test/lit/passes
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
add_llvm_component_library(LLVMNativeCPUPipeline
2+
${CMAKE_CURRENT_SOURCE_DIR}/source/attributes.cpp
3+
${CMAKE_CURRENT_SOURCE_DIR}/source/barrier_regions.cpp
4+
${CMAKE_CURRENT_SOURCE_DIR}/source/builtin_info.cpp
5+
${CMAKE_CURRENT_SOURCE_DIR}/source/cl_builtin_info.cpp
6+
${CMAKE_CURRENT_SOURCE_DIR}/source/define_mux_builtins_pass.cpp
7+
${CMAKE_CURRENT_SOURCE_DIR}/source/dma.cpp
8+
${CMAKE_CURRENT_SOURCE_DIR}/source/encode_kernel_metadata_pass.cpp
9+
${CMAKE_CURRENT_SOURCE_DIR}/source/group_collective_helpers.cpp
10+
${CMAKE_CURRENT_SOURCE_DIR}/source/mangling.cpp
11+
${CMAKE_CURRENT_SOURCE_DIR}/source/metadata.cpp
12+
${CMAKE_CURRENT_SOURCE_DIR}/source/mux_builtin_info.cpp
13+
${CMAKE_CURRENT_SOURCE_DIR}/source/pass_functions.cpp
14+
${CMAKE_CURRENT_SOURCE_DIR}/source/optimal_builtin_replacement_pass.cpp
15+
${CMAKE_CURRENT_SOURCE_DIR}/source/pass_machinery.cpp
16+
${CMAKE_CURRENT_SOURCE_DIR}/source/prepare_barriers_pass.cpp
17+
${CMAKE_CURRENT_SOURCE_DIR}/source/replace_local_module_scope_variables_pass.cpp
18+
${CMAKE_CURRENT_SOURCE_DIR}/source/scheduling.cpp
19+
${CMAKE_CURRENT_SOURCE_DIR}/source/sub_group_analysis.cpp
20+
${CMAKE_CURRENT_SOURCE_DIR}/source/target_extension_types.cpp
21+
${CMAKE_CURRENT_SOURCE_DIR}/source/work_item_loops_pass.cpp
22+
23+
LINK_COMPONENTS
24+
Passes
25+
Core
26+
)
27+
28+
# TODO: Move to under LLVM include and work out why ADDITIONAL_HEADER_DIRS
29+
# does not capture it.
30+
target_include_directories(LLVMNativeCPUPipeline PUBLIC
31+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
32+
)
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// Copyright (C) Codeplay Software Limited
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License") with LLVM
4+
// Exceptions; you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://github.com/uxlfoundation/oneapi-construction-kit/blob/main/LICENSE.txt
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11+
// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12+
// License for the specific language governing permissions and limitations
13+
// under the License.
14+
//
15+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
16+
17+
/// @file
18+
///
19+
/// LLVM address space identifiers.
20+
21+
#ifndef COMPILER_UTILS_ADDRESS_SPACES_H_INCLUDED
22+
#define COMPILER_UTILS_ADDRESS_SPACES_H_INCLUDED
23+
24+
namespace compiler {
25+
namespace utils {
26+
namespace AddressSpace {
27+
enum {
28+
Private = 0,
29+
Global = 1,
30+
Constant = 2,
31+
Local = 3,
32+
Generic = 4,
33+
};
34+
}
35+
} // namespace utils
36+
} // namespace compiler
37+
38+
#endif // COMPILER_UTILS_ADDRESS_SPACES_H_INCLUDED

0 commit comments

Comments
 (0)