Skip to content

Commit 3b260f6

Browse files
committed
Merge branch 'sycl' of https://github.com/intel/llvm into ianayl/benchmark-ci-no-botuser
2 parents 0c4e7e2 + 066e266 commit 3b260f6

File tree

24 files changed

+133
-66
lines changed

24 files changed

+133
-66
lines changed

.github/workflows/sycl-linux-run-tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ jobs:
333333
- run: which clang++ sycl-ls
334334
- run: sycl-ls --verbose
335335
- run: SYCL_UR_TRACE=1 sycl-ls
336-
- run: |
336+
- name: Print IGC version
337+
run: |
337338
if [ -f /usr/local/lib/igc/IGCTAG.txt ]; then
338339
cat /usr/local/lib/igc/IGCTAG.txt
339340
fi

clang/lib/Sema/SemaSYCL.cpp

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7302,22 +7302,30 @@ void SYCLIntegrationHeader::emit(raw_ostream &O) {
73027302
}
73037303

73047304
if (FreeFunctionCount > 0) {
7305+
// GlobalMapUpdater has to be in an anonymous namespace.
7306+
// Otherwise, if multiple translation units include the same integration
7307+
// header, there will be multiple varying definitions of GlobalMapUpdater
7308+
// with the same name across translation units, violating the C++'s One
7309+
// Definition Rule. Putting it in an anonymous namespace gives each
7310+
// translation unit its own unique definition.
7311+
73057312
O << "\n#include <sycl/kernel_bundle.hpp>\n";
73067313
O << "#include <sycl/detail/kernel_global_info.hpp>\n";
7307-
O << "namespace sycl {\n";
7308-
O << "inline namespace _V1 {\n";
7309-
O << "namespace detail {\n";
7314+
O << "namespace {\n";
73107315
O << "struct GlobalMapUpdater {\n";
73117316
O << " GlobalMapUpdater() {\n";
73127317
O << " sycl::detail::free_function_info_map::add("
73137318
<< "sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, "
73147319
<< KernelDescs.size() << ");\n";
73157320
O << " }\n";
7321+
O << " ~GlobalMapUpdater() {\n";
7322+
O << " sycl::detail::free_function_info_map::remove("
7323+
<< "sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, "
7324+
<< KernelDescs.size() << ");\n";
7325+
O << " }\n";
73167326
O << "};\n";
73177327
O << "static GlobalMapUpdater updater;\n";
7318-
O << "} // namespace detail\n";
7319-
O << "} // namespace _V1\n";
7320-
O << "} // namespace sycl\n";
7328+
O << "} // namespace\n";
73217329
}
73227330
}
73237331

clang/test/CodeGenSYCL/free_function_default_template_arguments.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,15 +1087,14 @@ namespace Testing::Tests {
10871087

10881088
// CHECK: #include <sycl/kernel_bundle.hpp>
10891089
// CHECK-NEXT: #include <sycl/detail/kernel_global_info.hpp>
1090-
// CHECK-NEXT: namespace sycl {
1091-
// CHECK-NEXT: inline namespace _V1 {
1092-
// CHECK-NEXT: namespace detail {
1090+
// CHECK-NEXT: namespace {
10931091
// CHECK-NEXT: struct GlobalMapUpdater {
10941092
// CHECK-NEXT: GlobalMapUpdater() {
10951093
// CHECK-NEXT: sycl::detail::free_function_info_map::add(sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, 28);
10961094
// CHECK-NEXT: }
1095+
// CHECK-NEXT: ~GlobalMapUpdater() {
1096+
// CHECK-NEXT: sycl::detail::free_function_info_map::remove(sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, 28);
1097+
// CHECK-NEXT: }
10971098
// CHECK-NEXT: };
10981099
// CHECK-NEXT: static GlobalMapUpdater updater;
1099-
// CHECK-NEXT: } // namespace detail
1100-
// CHECK-NEXT: } // namespace _V1
1101-
// CHECK-NEXT: } // namespace sycl
1100+
// CHECK-NEXT: }

clang/test/CodeGenSYCL/free_function_int_header.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1567,15 +1567,14 @@ void ff_24(int arg) {
15671567

15681568
// CHECK: #include <sycl/kernel_bundle.hpp>
15691569
// CHECK-NEXT: #include <sycl/detail/kernel_global_info.hpp>
1570-
// CHECK-NEXT: namespace sycl {
1571-
// CHECK-NEXT: inline namespace _V1 {
1572-
// CHECK-NEXT: namespace detail {
1570+
// CHECK-NEXT: namespace {
15731571
// CHECK-NEXT: struct GlobalMapUpdater {
15741572
// CHECK-NEXT: GlobalMapUpdater() {
15751573
// CHECK-NEXT: sycl::detail::free_function_info_map::add(sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, 33);
15761574
// CHECK-NEXT: }
1575+
// CHECK-NEXT: ~GlobalMapUpdater() {
1576+
// CHECK-NEXT: sycl::detail::free_function_info_map::remove(sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, 33);
1577+
// CHECK-NEXT: }
15771578
// CHECK-NEXT: };
15781579
// CHECK-NEXT: static GlobalMapUpdater updater;
1579-
// CHECK-NEXT: } // namespace detail
1580-
// CHECK-NEXT: } // namespace _V1
1581-
// CHECK-NEXT: } // namespace sycl
1580+
// CHECK-NEXT: }

clang/test/CodeGenSYCL/free_function_int_header_rtc_mode.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,14 @@ int main(){
7575

7676
// CHECK-NORTC: #include <sycl/kernel_bundle.hpp>
7777
// CHECK-NORTC-NEXT: #include <sycl/detail/kernel_global_info.hpp>
78-
// CHECK-NORTC-NEXT: namespace sycl {
79-
// CHECK-NORTC-NEXT: inline namespace _V1 {
80-
// CHECK-NORTC-NEXT: namespace detail {
78+
// CHECK-NORTC-NEXT: namespace {
8179
// CHECK-NORTC-NEXT: struct GlobalMapUpdater {
8280
// CHECK-NORTC-NEXT: GlobalMapUpdater() {
8381
// CHECK-NORTC-NEXT: sycl::detail::free_function_info_map::add(sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, 3);
8482
// CHECK-NORTC-NEXT: }
83+
// CHECK-NORTC-NEXT: ~GlobalMapUpdater() {
84+
// CHECK-NORTC-NEXT: sycl::detail::free_function_info_map::remove(sycl::detail::kernel_names, sycl::detail::kernel_args_sizes, 3);
85+
// CHECK-NORTC-NEXT: }
8586
// CHECK-NORTC-NEXT: };
8687
// CHECK-NORTC-NEXT: static GlobalMapUpdater updater;
87-
// CHECK-NORTC-NEXT: } // namespace detail
88-
// CHECK-NORTC-NEXT: } // namespace _V1
89-
// CHECK-NORTC-NEXT: } // namespace sycl
88+
// CHECK-NORTC-NEXT: }

clang/test/Driver/clang-offload-extract.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ __declspec(align(sizeof(void*) * 2))
6464
const void* padding[2] = {0, 0};
6565

6666
#ifdef _WIN32
67-
char __start_omp_offloading_entries = 1;
68-
char __stop_omp_offloading_entries = 1;
67+
char __start_llvm_offload_entries = 1;
68+
char __stop_llvm_offload_entries = 1;
6969
#endif
7070

7171
void __tgt_register_lib(void *desc) {}

clang/test/Driver/clang-offload-wrapper.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
// CHECK-IR: [[ENTBEGIN:@.+]] = external hidden constant [[ENTTY]]
130130
// CHECK-IR: [[ENTEND:@.+]] = external hidden constant [[ENTTY]]
131131

132-
// CHECK-IR: [[DUMMY:@.+]] = hidden constant [0 x [[ENTTY]]] zeroinitializer, section "omp_offloading_entries"
132+
// CHECK-IR: [[DUMMY:@.+]] = hidden constant [0 x [[ENTTY]]] zeroinitializer, section "llvm_offload_entries"
133133

134134
// CHECK-IR: [[OMP_BIN:@.+]] = internal unnamed_addr constant [[OMP_BINTY:\[[0-9]+ x i8\]]] c"Content of device file3{{.+}}"
135135
// CHECK-IR: [[OMP_INFO:@.+]] = internal local_unnamed_addr constant [2 x i64] [i64 ptrtoint (ptr [[OMP_BIN]] to i64), i64 24], section ".tgtimg", align 16

clang/test/SemaSYCL/Inputs/sycl/detail/kernel_global_info.hpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,11 @@
1010

1111
#include <sycl/detail/export.hpp>
1212

13-
namespace sycl {
14-
inline namespace _V1 {
15-
namespace detail {
13+
namespace {
1614
namespace free_function_info_map {
1715

1816
__SYCL_EXPORT void add(const void *DeviceGlobalPtr, const char *UniqueId);
17+
__SYCL_EXPORT void remove(const void *DeviceGlobalPtr, const char *UniqueId);
1918

2019
} // namespace free_function_info_map
21-
} // namespace detail
22-
} // namespace _V1
23-
} // namespace sycl
20+
}

clang/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,9 +1006,9 @@ class BinaryWrapper {
10061006
/// library. It is defined as follows
10071007
///
10081008
/// __attribute__((visibility("hidden")))
1009-
/// extern __tgt_offload_entry *__start_omp_offloading_entries;
1009+
/// extern __tgt_offload_entry *__start_llvm_offload_entries;
10101010
/// __attribute__((visibility("hidden")))
1011-
/// extern __tgt_offload_entry *__stop_omp_offloading_entries;
1011+
/// extern __tgt_offload_entry *__stop_llvm_offload_entries;
10121012
///
10131013
/// static const char Image0[] = { <Bufs.front() contents> };
10141014
/// ...
@@ -1018,23 +1018,23 @@ class BinaryWrapper {
10181018
/// {
10191019
/// Image0, /*ImageStart*/
10201020
/// Image0 + sizeof(Image0), /*ImageEnd*/
1021-
/// __start_omp_offloading_entries, /*EntriesBegin*/
1022-
/// __stop_omp_offloading_entries /*EntriesEnd*/
1021+
/// __start_llvm_offload_entries, /*EntriesBegin*/
1022+
/// __stop_llvm_offload_entries /*EntriesEnd*/
10231023
/// },
10241024
/// ...
10251025
/// {
10261026
/// ImageN, /*ImageStart*/
10271027
/// ImageN + sizeof(ImageN), /*ImageEnd*/
1028-
/// __start_omp_offloading_entries, /*EntriesBegin*/
1029-
/// __stop_omp_offloading_entries /*EntriesEnd*/
1028+
/// __start_llvm_offload_entries, /*EntriesBegin*/
1029+
/// __stop_llvm_offload_entries /*EntriesEnd*/
10301030
/// }
10311031
/// };
10321032
///
10331033
/// static const __tgt_bin_desc BinDesc = {
10341034
/// sizeof(Images) / sizeof(Images[0]), /*NumDeviceImages*/
10351035
/// Images, /*DeviceImages*/
1036-
/// __start_omp_offloading_entries, /*HostEntriesBegin*/
1037-
/// __stop_omp_offloading_entries /*HostEntriesEnd*/
1036+
/// __start_llvm_offload_entries, /*HostEntriesBegin*/
1037+
/// __stop_llvm_offload_entries /*HostEntriesEnd*/
10381038
/// };
10391039
///
10401040
/// Global variable that represents BinDesc is returned.
@@ -1049,24 +1049,24 @@ class BinaryWrapper {
10491049
// Create external begin/end symbols for the offload entries table.
10501050
auto *EntriesStart = new GlobalVariable(
10511051
M, getEntryTy(), /*isConstant*/ true, GlobalValue::ExternalLinkage,
1052-
/*Initializer*/ nullptr, "__start_omp_offloading_entries");
1052+
/*Initializer*/ nullptr, "__start_llvm_offload_entries");
10531053
EntriesStart->setVisibility(GlobalValue::HiddenVisibility);
10541054
auto *EntriesStop = new GlobalVariable(
10551055
M, getEntryTy(), /*isConstant*/ true, GlobalValue::ExternalLinkage,
1056-
/*Initializer*/ nullptr, "__stop_omp_offloading_entries");
1056+
/*Initializer*/ nullptr, "__stop_llvm_offload_entries");
10571057
EntriesStop->setVisibility(GlobalValue::HiddenVisibility);
10581058

10591059
// We assume that external begin/end symbols that we have created above
10601060
// will be defined by the linker. But linker will do that only if linker
1061-
// inputs have section with "omp_offloading_entries" name which is not
1061+
// inputs have section with "llvm_offload_entries" name which is not
10621062
// guaranteed. So, we just create dummy zero sized object in the offload
10631063
// entries section to force linker to define those symbols.
10641064
auto *DummyInit =
10651065
ConstantAggregateZero::get(ArrayType::get(getEntryTy(), 0u));
10661066
auto *DummyEntry = new GlobalVariable(
10671067
M, DummyInit->getType(), true, GlobalVariable::ExternalLinkage,
10681068
DummyInit, "__dummy.omp_offloading.entry");
1069-
DummyEntry->setSection("omp_offloading_entries");
1069+
DummyEntry->setSection("llvm_offload_entries");
10701070
DummyEntry->setVisibility(GlobalValue::HiddenVisibility);
10711071

10721072
EntriesB = EntriesStart;

devops/actions/run-tests/benchmark/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ env:
4141
BENCHMARK_RESULTS_BRANCH: "sycl-benchmark-ci-results"
4242

4343
runs:
44+
# composite actions don't make use of 'name', so copy-paste names as a comment in the first line of each step
4445
using: "composite"
4546
steps:
4647
- name: Check specified runner type / target backend
@@ -49,6 +50,7 @@ runs:
4950
TARGET_DEVICE: ${{ inputs.target_devices }}
5051
PRESET: ${{ inputs.preset }}
5152
run: |
53+
# Check specified runner type / target backend
5254
case "$RUNNER_TAG" in
5355
'["PVC_PERF"]' ) ;;
5456
'["BMG_PERF"]' ) ;;
@@ -117,6 +119,7 @@ runs:
117119
- name: Build Unified Runtime
118120
shell: bash
119121
run: |
122+
# Build Unified Runtime
120123
# Sparse-checkout UR at build ref:
121124
git clone --depth 1 --no-checkout https://github.com/intel/llvm ur
122125
cd ur
@@ -145,13 +148,14 @@ runs:
145148
with:
146149
ref: ${{ env.BENCHMARK_RESULTS_BRANCH }}
147150
path: llvm-ci-perf-results
148-
- name: Run compute-benchmarks
151+
- name: Build and run benchmarks
149152
env:
150153
# Need to append "_<device>_<backend>" to save name in order to follow
151154
# conventions:
152155
SAVE_PREFIX: ${{ inputs.save_name }}
153156
shell: bash
154157
run: |
158+
# Build and run benchmarks
155159
# TODO generate summary + display helpful message here
156160
export CMPLR_ROOT=./toolchain
157161
echo "-----"
@@ -235,7 +239,8 @@ runs:
235239
- name: Cache changes and upload github summary
236240
if: always()
237241
shell: bash
238-
run: |
242+
run: |
243+
# Cache changes and upload github summary
239244
[ -f "github_summary.md" ] && cat github_summary.md >> $GITHUB_STEP_SUMMARY
240245
241246
cd "./llvm-ci-perf-results"
@@ -248,6 +253,7 @@ runs:
248253
if: inputs.upload_results == 'true' && always()
249254
shell: bash
250255
run: |
256+
# Push benchmarks results
251257
cd "./llvm-ci-perf-results"
252258
git config user.name "github-actions[bot]"
253259
git config user.email "github-actions[bot]@users.noreply.github.com"

0 commit comments

Comments
 (0)