Skip to content

Commit e23842a

Browse files
committed
Merge remote-tracking branch 'intel/sycl' into steffen/func_ptr_case
2 parents b3ec1ea + c7ff661 commit e23842a

File tree

275 files changed

+4772
-2376
lines changed

Some content is hidden

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

275 files changed

+4772
-2376
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,3 +223,6 @@ llvm/test/Instrumentation/ThreadSanitizer/ @intel/dpcpp-sanitizers-review
223223
sycl/test-e2e/AddressSanitizer/ @intel/dpcpp-sanitizers-review
224224
sycl/test-e2e/MemorySanitizer/ @intel/dpcpp-sanitizers-review
225225
sycl/test-e2e/ThreadSanitizer/ @intel/dpcpp-sanitizers-review
226+
227+
# ABI compatibility
228+
devops/compat_ci_exclude.sycl-rel-** @gmlueck @xtian-github

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,9 @@ jobs:
296296
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-cov
297297
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-profdata
298298
cmake --build $GITHUB_WORKSPACE/build --target install-compiler-rt
299+
# This is required to perform the DeviceConfigFile consistency test, see
300+
# sycl/test-e2e/Basic/device_config_file_consistency.cpp.
301+
cmake --install $GITHUB_WORKSPACE/build --component DeviceConfigFile
299302
- name: Additional Install for "--shared-libs" build
300303
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '--shared-libs') }}
301304
run: |

.github/workflows/sycl-ur-perf-benchmarking.yml

Lines changed: 73 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,18 @@ on:
2828
deployment branch will be used.
2929
required: false
3030
default: ''
31+
save_name:
32+
type: string
33+
description: |
34+
Specify a custom name to use for the benchmark result: If uploading
35+
results, this will be the name used to refer results from the current
36+
run.
37+
required: false
38+
default: ''
3139
upload_results:
3240
type: string # true/false: workflow_dispatch does not support booleans
41+
description: |
42+
Upload results to https://intel.github.io/llvm/benchmarks/.
3343
required: true
3444
runner:
3545
type: string
@@ -67,8 +77,14 @@ on:
6777
Leave both pr_no and commit_hash empty to use latest commit.
6878
required: false
6979
default: ''
80+
save_name:
81+
type: string
82+
description: |
83+
Name to use for the benchmark result:
84+
required: false
85+
default: ''
7086
upload_results:
71-
description: 'Save and upload results'
87+
description: 'Save and upload results (to https://intel.github.io/llvm/benchmarks)'
7288
type: choice
7389
options:
7490
- false
@@ -90,16 +106,61 @@ on:
90106
permissions: read-all
91107

92108
jobs:
109+
sanitize_inputs:
110+
name: Sanitize inputs
111+
runs-on: ubuntu-latest
112+
env:
113+
COMMIT_HASH: ${{ inputs.commit_hash }}
114+
PR_NO: ${{ inputs.pr_no }}
115+
SAVE_NAME: ${{ inputs.save_name }}
116+
outputs:
117+
benchmark_save_name: ${{ steps.sanitize.outputs.benchmark_save_name }}
118+
build_ref: ${{ steps.sanitize.outputs.build_ref }}
119+
steps:
120+
- id: sanitize
121+
run: |
122+
# Validate user inputs:
123+
# usage: check_if_nonempty <var> <regex to check var against> <err message>
124+
check_nonempty() {
125+
[ -z "$1" ] && return
126+
if [ -z "$(echo "$1" | grep -P "$2")" ]; then
127+
echo "$3"
128+
exit 1
129+
fi
130+
}
131+
check_nonempty "$COMMIT_HASH" '^[0-9a-f]{7,}$' "Bad commit hash (or hash short)."
132+
check_nonempty "$PR_NO" '^[0-9]+$' "Bad PR number."
133+
check_nonempty "$SAVE_NAME" '^[A-Za-z][A-Za-z0-9_-]+$' "Bad save name."
134+
135+
BENCHMARK_SAVE_NAME=""
136+
BUILD_REF="${{ github.ref }}"
137+
if [ -n "$SAVE_NAME" ]; then
138+
BENCHMARK_SAVE_NAME="$(echo "$SAVE_NAME" | tr -cd 'A-Za-z0-9_-')"
139+
fi;
140+
if [ -n "$COMMIT_HASH" ]; then
141+
echo "Using commit hash $COMMIT_HASH for build..."
142+
BUILD_REF="$COMMIT_HASH"
143+
shortened_commit="$(echo "$COMMIT_HASH" | cut -c 1-7)"
144+
[ -z "$BENCHMARK_SAVE_NAME" ] && BENCHMARK_SAVE_NAME="Commit_${shortened_commit}"
145+
elif [ -n "$PR_NO" ]; then
146+
echo "Using PR no. $PR_NO for build..."
147+
BUILD_REF="refs/pull/$PR_NO/head"
148+
[ -z "$BENCHMARK_SAVE_NAME" ] && BENCHMARK_SAVE_NAME="PR_${PR_NO}"
149+
fi
150+
[ -z "$BENCHMARK_SAVE_NAME" ] && BENCHMARK_SAVE_NAME="Baseline"
151+
152+
echo "benchmark_save_name=$BENCHMARK_SAVE_NAME" >> $GITHUB_OUTPUT
153+
echo "build_ref=$BUILD_REF" >> $GITHUB_OUTPUT
154+
155+
echo "Final sanitized values:"
156+
cat $GITHUB_OUTPUT
157+
93158
build_sycl:
94159
name: Build SYCL
160+
needs: [ sanitize_inputs ]
95161
uses: ./.github/workflows/sycl-linux-build.yml
96162
with:
97-
build_ref: |
98-
${{
99-
inputs.commit_hash != '' && inputs.commit_hash ||
100-
inputs.pr_no != '' && format('refs/pull/{0}/head', inputs.pr_no) ||
101-
github.ref
102-
}}
163+
build_ref: ${{ needs.sanitize_inputs.outputs.build_ref }}
103164
build_cache_root: "/__w/"
104165
build_cache_suffix: "prod_noassert"
105166
build_configure_extra_args: "--no-assertions"
@@ -112,14 +173,12 @@ jobs:
112173

113174
run_benchmarks_build:
114175
name: Run Benchmarks on Build
115-
needs: [ build_sycl ]
176+
needs: [ build_sycl, sanitize_inputs ]
116177
strategy:
117178
matrix:
118179
include:
119-
- ref: ${{ inputs.commit_hash != '' && inputs.commit_hash || inputs.pr_no != '' && format('refs/pull/{0}/head', inputs.pr_no) || github.ref }}
120-
save_name: ${{ inputs.commit_hash != '' && format('Commit{0}', inputs.commit_hash) || inputs.pr_no != '' && format('PR{0}', inputs.pr_no) || 'Baseline' }}
121-
# Set default values if not specified:
122-
runner: ${{ inputs.runner || '["PVC_PERF"]' }}
180+
# Set default values if not specified:
181+
- runner: ${{ inputs.runner || '["PVC_PERF"]' }}
123182
backend: ${{ inputs.backend || 'level_zero:gpu' }}
124183
uses: ./.github/workflows/sycl-linux-run-tests.yml
125184
secrets: inherit
@@ -131,9 +190,9 @@ jobs:
131190
target_devices: ${{ matrix.backend }}
132191
tests_selector: benchmarks
133192
benchmark_upload_results: ${{ inputs.upload_results }}
134-
benchmark_save_name: ${{ matrix.save_name }}
193+
benchmark_save_name: ${{ needs.sanitize_inputs.outputs.benchmark_save_name }}
135194
benchmark_preset: ${{ inputs.preset }}
136-
repo_ref: ${{ matrix.ref }}
195+
repo_ref: ${{ needs.sanitize_inputs.outputs.build_ref }}
137196
toolchain_artifact: ${{ needs.build_sycl.outputs.toolchain_artifact }}
138197
toolchain_artifact_filename: ${{ needs.build_sycl.outputs.toolchain_artifact_filename }}
139198
toolchain_decompress_command: ${{ needs.build_sycl.outputs.toolchain_decompress_command }}

buildbot/configure.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ def do_configure(args, passthrough_args):
6666
xpti_enable_werror = "OFF"
6767
llvm_enable_zstd = "OFF"
6868
spirv_enable_dis = "OFF"
69-
sycl_install_device_config_file = "OFF"
7069

7170
if sys.platform != "darwin":
7271
# For more info on the enablement of level_zero_v2 refer to this document:
@@ -162,7 +161,6 @@ def do_configure(args, passthrough_args):
162161
libclc_targets_to_build += libclc_nvidia_target_names
163162
libclc_gen_remangled_variants = "ON"
164163
spirv_enable_dis = "ON"
165-
sycl_install_device_config_file = "ON"
166164

167165
if args.enable_backends:
168166
sycl_enabled_backends += args.enable_backends
@@ -211,7 +209,6 @@ def do_configure(args, passthrough_args):
211209
"-DSYCL_ENABLE_EXTENSION_JIT={}".format(sycl_enable_jit),
212210
"-DSYCL_ENABLE_MAJOR_RELEASE_PREVIEW_LIB={}".format(sycl_preview_lib),
213211
"-DBUG_REPORT_URL=https://github.com/intel/llvm/issues",
214-
"-DSYCL_INSTALL_DEVICE_CONFIG_FILE={}".format(sycl_install_device_config_file),
215212
]
216213

217214
if libclc_enabled:

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13038,6 +13038,8 @@ def err_free_function_first_occurrence_missing_attr: Error<
1303813038
"the first occurrence of SYCL kernel free function should be declared with 'sycl-nd-range-kernel' or 'sycl-single-task-kernel' compile time properties">;
1303913039
def err_free_function_class_method : Error<
1304013040
"%select{static |}0class method cannot be used to define a SYCL kernel free function kernel">;
13041+
def err_sycl_kernel_virtual_arg : Error<
13042+
"argument type '%0' virtually inherited from base class `%1` is not supported as a SYCL kernel argument">;
1304113043

1304213044

1304313045
// SYCL kernel entry point diagnostics
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
//===-- CudaInstallationDetector.h - Cuda Instalation Detector --*- C++ -*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#ifndef LLVM_CLANG_DRIVER_CUDAINSTALLATIONDETECTOR_H
10+
#define LLVM_CLANG_DRIVER_CUDAINSTALLATIONDETECTOR_H
11+
12+
#include "clang/Basic/Cuda.h"
13+
#include "clang/Driver/Driver.h"
14+
#include <bitset>
15+
16+
namespace clang {
17+
namespace driver {
18+
19+
/// A class to find a viable CUDA installation
20+
class CudaInstallationDetector {
21+
private:
22+
const Driver &D;
23+
bool IsValid = false;
24+
CudaVersion Version = CudaVersion::UNKNOWN;
25+
std::string InstallPath;
26+
std::string BinPath;
27+
std::string LibDevicePath;
28+
std::string IncludePath;
29+
llvm::StringMap<std::string> LibDeviceMap;
30+
31+
// CUDA architectures for which we have raised an error in
32+
// CheckCudaVersionSupportsArch.
33+
mutable std::bitset<(int)OffloadArch::LAST> ArchsWithBadVersion;
34+
35+
public:
36+
CudaInstallationDetector(const Driver &D, const llvm::Triple &HostTriple,
37+
const llvm::opt::ArgList &Args);
38+
39+
void AddCudaIncludeArgs(const llvm::opt::ArgList &DriverArgs,
40+
llvm::opt::ArgStringList &CC1Args) const;
41+
42+
/// Emit an error if Version does not support the given Arch.
43+
///
44+
/// If either Version or Arch is unknown, does not emit an error. Emits at
45+
/// most one error per Arch.
46+
void CheckCudaVersionSupportsArch(OffloadArch Arch) const;
47+
48+
/// Check whether we detected a valid Cuda install.
49+
bool isValid() const { return IsValid; }
50+
/// Print information about the detected CUDA installation.
51+
void print(raw_ostream &OS) const;
52+
53+
/// Get the detected Cuda install's version.
54+
CudaVersion version() const {
55+
return Version == CudaVersion::NEW ? CudaVersion::PARTIALLY_SUPPORTED
56+
: Version;
57+
}
58+
/// Get the detected Cuda installation path.
59+
StringRef getInstallPath() const { return InstallPath; }
60+
/// Get the detected path to Cuda's bin directory.
61+
StringRef getBinPath() const { return BinPath; }
62+
/// Get the detected Cuda Include path.
63+
StringRef getIncludePath() const { return IncludePath; }
64+
/// Get the detected Cuda device library path.
65+
StringRef getLibDevicePath() const { return LibDevicePath; }
66+
/// Get libdevice file for given architecture
67+
std::string getLibDeviceFile(StringRef Gpu) const {
68+
return LibDeviceMap.lookup(Gpu);
69+
}
70+
void WarnIfUnsupportedVersion() const;
71+
};
72+
73+
} // namespace driver
74+
} // namespace clang
75+
76+
#endif // LLVM_CLANG_DRIVER_CUDAINSTALLATIONDETECTOR_H

clang/lib/Driver/ToolChains/LazyDetector.h renamed to clang/include/clang/Driver/LazyDetector.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_LAZYDETECTOR_H
10-
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_LAZYDETECTOR_H
9+
#ifndef LLVM_CLANG_DRIVER_LAZYDETECTOR_H
10+
#define LLVM_CLANG_DRIVER_LAZYDETECTOR_H
1111

1212
#include "clang/Driver/Tool.h"
1313
#include "clang/Driver/ToolChain.h"
@@ -42,4 +42,4 @@ template <class T> class LazyDetector {
4242

4343
} // end namespace clang
4444

45-
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_LAZYDETECTOR_H
45+
#endif // LLVM_CLANG_DRIVER_LAZYDETECTOR_H

clang/include/clang/Driver/Options.td

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9265,14 +9265,11 @@ class CLRemainingArgsJoined<string name,
92659265
// (We don't put any of these in cl_compile_Group as the options they alias are
92669266
// already in the right group.)
92679267

9268-
// INTEL_CUSTOMIZATION
92699268
def _SLASH_Qfp_accuracy_EQ : CLJoined<"Qfp-accuracy=">,
92709269
Alias<ffp_accuracy_EQ>;
92719270
def _SLASH_Qfp_accuracy_COL : CLJoined<"Qfp-accuracy:">,
92729271
Alias<ffp_accuracy_EQ>,HelpText<"Specifies the required accuracy for "
92739272
"floating-point operations and library calls.">;
9274-
// END INTEL_CUSTOMIZATION
9275-
92769273
def _SLASH_Brepro : CLFlag<"Brepro">,
92779274
HelpText<"Do not write current time into COFF output (breaks link.exe /incremental)">,
92789275
Alias<mno_incremental_linker_compatible>;

clang/lib/Driver/ToolChains/ROCm.h renamed to clang/include/clang/Driver/RocmInstallationDetector.h

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
1-
//===--- ROCm.h - ROCm installation detector --------------------*- C++ -*-===//
1+
//===-- RocmInstallationDetector.h - ROCm Instalation Detector --*- C++ -*-===//
22
//
33
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
44
// See https://llvm.org/LICENSE.txt for license information.
55
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ROCM_H
10-
#define LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ROCM_H
9+
#ifndef LLVM_CLANG_DRIVER_ROCMINSTALLATIONDETECTOR_H
10+
#define LLVM_CLANG_DRIVER_ROCMINSTALLATIONDETECTOR_H
1111

12-
#include "clang/Basic/Cuda.h"
13-
#include "clang/Basic/LLVM.h"
1412
#include "clang/Driver/Driver.h"
15-
#include "clang/Driver/Options.h"
16-
#include "clang/Driver/SanitizerArgs.h"
17-
#include "llvm/ADT/SmallString.h"
18-
#include "llvm/ADT/StringMap.h"
19-
#include "llvm/Option/ArgList.h"
20-
#include "llvm/Support/VersionTuple.h"
21-
#include "llvm/TargetParser/Triple.h"
2213

2314
namespace clang {
2415
namespace driver {
@@ -77,6 +68,24 @@ class RocmInstallationDetector {
7768
SPACKReleaseStr(SPACKReleaseStr.str()) {}
7869
};
7970

71+
struct CommonBitcodeLibsPreferences {
72+
CommonBitcodeLibsPreferences(const Driver &D,
73+
const llvm::opt::ArgList &DriverArgs,
74+
StringRef GPUArch,
75+
const Action::OffloadKind DeviceOffloadingKind,
76+
const bool NeedsASanRT);
77+
78+
DeviceLibABIVersion ABIVer;
79+
bool IsOpenMP;
80+
bool Wave64;
81+
bool DAZ;
82+
bool FiniteOnly;
83+
bool UnsafeMathOpt;
84+
bool FastRelaxedMath;
85+
bool CorrectSqrt;
86+
bool GPUSan;
87+
};
88+
8089
const Driver &D;
8190
bool HasHIPRuntime = false;
8291
bool HasDeviceLibrary = false;
@@ -175,11 +184,11 @@ class RocmInstallationDetector {
175184

176185
/// Get file paths of default bitcode libraries common to AMDGPU based
177186
/// toolchains.
178-
llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12> getCommonBitcodeLibs(
179-
const llvm::opt::ArgList &DriverArgs, StringRef LibDeviceFile,
180-
bool Wave64, bool DAZ, bool FiniteOnly, bool UnsafeMathOpt,
181-
bool FastRelaxedMath, bool CorrectSqrt, DeviceLibABIVersion ABIVer,
182-
bool GPUSan, bool isOpenMP) const;
187+
llvm::SmallVector<ToolChain::BitCodeLibraryInfo, 12>
188+
getCommonBitcodeLibs(const llvm::opt::ArgList &DriverArgs,
189+
StringRef LibDeviceFile, StringRef GPUArch,
190+
const Action::OffloadKind DeviceOffloadingKind,
191+
const bool NeedsASanRT) const;
183192
/// Check file paths of default bitcode libraries common to AMDGPU based
184193
/// toolchains. \returns false if there are invalid or missing files.
185194
bool checkCommonBitcodeLibs(StringRef GPUArch, StringRef LibDeviceFile,
@@ -288,7 +297,7 @@ class RocmInstallationDetector {
288297
StringRef getHIPVersion() const { return DetectedVersion; }
289298
};
290299

291-
} // end namespace driver
292-
} // end namespace clang
300+
} // namespace driver
301+
} // namespace clang
293302

294-
#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ROCM_H
303+
#endif // LLVM_CLANG_DRIVER_ROCMINSTALLATIONDETECTOR_H

0 commit comments

Comments
 (0)