Skip to content

Commit dfee8b8

Browse files
committed
Merge branch 'sycl' into przemek/bindless-img-host-usm-1d-test
2 parents 63ecb09 + 8032832 commit dfee8b8

Some content is hidden

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

65 files changed

+1516
-699
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
name: Benchmarks
2+
3+
# This workflow is a WIP: this workflow file acts as a placeholder.
4+
5+
on: [ workflow_dispatch ]
6+
7+
jobs:
8+
do-nothing:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- run: echo 'This workflow is a WIP.'
12+

.github/workflows/ur-benchmarks-reusable.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Benchmarks Reusable
22

33
# This workflow is a WIP: This workflow file acts as a placeholder.
4+
#
5+
# This workflow is set to be merged into benchmark.yml
46

57
on: [ workflow_call ]
68

.github/workflows/ur-benchmarks.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
name: Benchmarks
22

33
# This workflow is a WIP: this workflow file acts as a placeholder.
4+
#
5+
# This workflow is set to be merged into benchmark.yml
46

57
on: [ workflow_dispatch ]
68

clang/test/Driver/linker-wrapper-sycl.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@
4747
// RUN: clang-linker-wrapper -sycl-device-libraries=%t.devicelib.o -sycl-post-link-options="SYCL_POST_LINK_OPTIONS" -llvm-spirv-options="LLVM_SPIRV_OPTIONS" "--host-triple=x86_64-unknown-linux-gnu" "--triple=spir64" "--linker-path=/usr/bin/ld" -shared "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.out" HOST_LIB_PATH HOST_STAT_LIB %t.o --dry-run 2>&1 | FileCheck -check-prefix=CHK-SHARED %s
4848
// CHK-SHARED: "{{.*}}clang"{{.*}} -fPIC
4949

50-
// RUN: rm %T/linker_wrapper_dump || true
51-
// RUN: clang-linker-wrapper -sycl-dump-device-code=%T/linker_wrapper_dump -sycl-device-libraries=%t.devicelib.o "--host-triple=x86_64-unknown-linux-gnu" "--triple=spir64" "--linker-path=/usr/bin/ld" -shared "--" HOST_LINKER_FLAGS "-dynamic-linker" HOST_DYN_LIB "-o" "a.out" HOST_LIB_PATH HOST_STAT_LIB %t.o --dry-run
52-
// RUN: ls %T/linker_wrapper_dump | FileCheck -check-prefix=CHK-SYCL-DUMP-DEVICE %s
53-
// CHK-SYCL-DUMP-DEVICE: {{.*}}.spv
54-
5550
/// Check for list of commands for standalone clang-linker-wrapper run for sycl (AOT for Intel GPU)
5651
// -------
5752
// Generate .o file as linker wrapper input.

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

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ static std::optional<llvm::module_split::IRSplitMode> SYCLModuleSplitMode;
151151

152152
static bool UseSYCLPostLinkTool;
153153

154-
static SmallString<128> SPIRVDumpDir;
154+
static SmallString<128> OffloadImageDumpDir;
155155

156156
using OffloadingImage = OffloadBinary::OffloadingImage;
157157

@@ -923,29 +923,6 @@ static Expected<StringRef> runLLVMToSPIRVTranslation(StringRef File,
923923
if (Error Err = executeCommands(*LLVMToSPIRVPath, CmdArgs))
924924
return std::move(Err);
925925

926-
if (!SPIRVDumpDir.empty()) {
927-
std::error_code EC =
928-
llvm::sys::fs::create_directory(SPIRVDumpDir, /*IgnoreExisting*/ true);
929-
if (EC)
930-
return createStringError(
931-
EC,
932-
formatv("failed to create dump directory. path: {0}, error_code: {1}",
933-
SPIRVDumpDir, EC.value()));
934-
935-
StringRef Sep = llvm::sys::path::get_separator();
936-
StringRef Path = *TempFileOrErr;
937-
StringRef Filename = Path.rsplit(Sep).second;
938-
SmallString<128> CopyPath = SPIRVDumpDir;
939-
CopyPath.append(Filename);
940-
EC = llvm::sys::fs::copy_file(Path, CopyPath);
941-
if (EC)
942-
return createStringError(
943-
EC,
944-
formatv(
945-
"failed to copy file. original: {0}, copy: {1}, error_code: {2}",
946-
Path, CopyPath, EC.value()));
947-
}
948-
949926
return *TempFileOrErr;
950927
}
951928

@@ -1103,6 +1080,18 @@ wrapSYCLBinariesFromFile(std::vector<module_split::SplitModule> &SplitModules,
11031080
RegularTarget = "spir64";
11041081

11051082
for (auto &SI : SplitModules) {
1083+
if (!OffloadImageDumpDir.empty()) {
1084+
StringRef CopyFrom = SI.ModuleFilePath;
1085+
SmallString<128> CopyTo = OffloadImageDumpDir;
1086+
StringRef Filename = sys::path::filename(CopyFrom);
1087+
CopyTo.append(Filename);
1088+
std::error_code EC = sys::fs::copy_file(CopyFrom, CopyTo);
1089+
if (EC)
1090+
return createStringError(EC, formatv("failed to copy file. From: "
1091+
"{0} to: {1}, error_code: {2}",
1092+
CopyFrom, CopyTo, EC.value()));
1093+
}
1094+
11061095
auto MBOrDesc = MemoryBuffer::getFile(SI.ModuleFilePath);
11071096
if (!MBOrDesc)
11081097
return createFileError(SI.ModuleFilePath, MBOrDesc.getError());
@@ -2618,13 +2607,11 @@ int main(int Argc, char **Argv) {
26182607

26192608
if (Args.hasArg(OPT_sycl_dump_device_code_EQ)) {
26202609
Arg *A = Args.getLastArg(OPT_sycl_dump_device_code_EQ);
2621-
SmallString<128> Dir(A->getValue());
2622-
if (Dir.empty())
2623-
llvm::sys::path::native(Dir = "./");
2610+
OffloadImageDumpDir = A->getValue();
2611+
if (OffloadImageDumpDir.empty())
2612+
sys::path::native(OffloadImageDumpDir = "./");
26242613
else
2625-
Dir.append(llvm::sys::path::get_separator());
2626-
2627-
SPIRVDumpDir = Dir;
2614+
OffloadImageDumpDir.append(sys::path::get_separator());
26282615
}
26292616

26302617
{

clang/tools/clang-linker-wrapper/LinkerWrapperOpts.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ Flags<[WrapperOnlyOption]>, HelpText<"Embed LLVM IR for runtime kernel fusion">
242242

243243
def sycl_dump_device_code_EQ : Joined<["--", "-"], "sycl-dump-device-code=">,
244244
Flags<[WrapperOnlyOption]>,
245-
HelpText<"Path to the folder where the tool dumps SPIR-V device code. Other formats aren't dumped.">;
245+
HelpText<"Directory to dump offloading images to.">;
246246

247247
// Options to enable/disable device dynamic linking.
248248
def sycl_allow_device_image_dependencies : Flag<["--", "-"], "sycl-allow-device-image-dependencies">,

devops/scripts/benchmarks/benches/base.py

Lines changed: 64 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,37 @@
1-
# Copyright (C) 2024 Intel Corporation
1+
# Copyright (C) 2024-2025 Intel Corporation
22
# Part of the Unified-Runtime Project, under the Apache License v2.0 with LLVM Exceptions.
33
# See LICENSE.TXT
44
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55

6+
from dataclasses import dataclass
67
import os
78
import shutil
89
from pathlib import Path
9-
from .result import Result
10+
from utils.result import BenchmarkMetadata, BenchmarkTag, Result
1011
from options import options
1112
from utils.utils import download, run
12-
import urllib.request
13-
import tarfile
13+
14+
benchmark_tags = [
15+
BenchmarkTag("SYCL", "Benchmark uses SYCL runtime"),
16+
BenchmarkTag("UR", "Benchmark uses Unified Runtime API"),
17+
BenchmarkTag("L0", "Benchmark uses Level Zero API directly"),
18+
BenchmarkTag("UMF", "Benchmark uses Unified Memory Framework directly"),
19+
BenchmarkTag("micro", "Microbenchmark focusing on a specific functionality"),
20+
BenchmarkTag("application", "Real application-based performance test"),
21+
BenchmarkTag("proxy", "Benchmark that simulates real application use-cases"),
22+
BenchmarkTag("submit", "Tests kernel submission performance"),
23+
BenchmarkTag("math", "Tests math computation performance"),
24+
BenchmarkTag("memory", "Tests memory transfer or bandwidth performance"),
25+
BenchmarkTag("allocation", "Tests memory allocation performance"),
26+
BenchmarkTag("graph", "Tests graph-based execution performance"),
27+
BenchmarkTag("latency", "Measures operation latency"),
28+
BenchmarkTag("throughput", "Measures operation throughput"),
29+
BenchmarkTag("inference", "Tests ML/AI inference performance"),
30+
BenchmarkTag("image", "Image processing benchmark"),
31+
BenchmarkTag("simulation", "Physics or scientific simulation benchmark"),
32+
]
33+
34+
benchmark_tags_dict = {tag.name: tag for tag in benchmark_tags}
1435

1536

1637
class Benchmark:
@@ -55,19 +76,25 @@ def create_data_path(self, name, skip_data_dir=False):
5576
data_path = os.path.join(self.directory, name)
5677
else:
5778
data_path = os.path.join(self.directory, "data", name)
58-
if options.rebuild and Path(data_path).exists():
79+
if options.redownload and Path(data_path).exists():
5980
shutil.rmtree(data_path)
6081

6182
Path(data_path).mkdir(parents=True, exist_ok=True)
6283

6384
return data_path
6485

65-
def download(self, name, url, file, untar=False, unzip=False, skip_data_dir=False):
86+
def download(
87+
self,
88+
name,
89+
url,
90+
file,
91+
untar=False,
92+
unzip=False,
93+
skip_data_dir=False,
94+
checksum="",
95+
):
6696
self.data_path = self.create_data_path(name, skip_data_dir)
67-
return download(self.data_path, url, file, untar, unzip)
68-
69-
def name(self):
70-
raise NotImplementedError()
97+
return download(self.data_path, url, file, untar, unzip, checksum)
7198

7299
def lower_is_better(self):
73100
return True
@@ -87,6 +114,30 @@ def stddev_threshold(self):
87114
def get_suite_name(self) -> str:
88115
return self.suite.name()
89116

117+
def name(self):
118+
raise NotImplementedError()
119+
120+
def description(self):
121+
return ""
122+
123+
def notes(self) -> str:
124+
return None
125+
126+
def unstable(self) -> str:
127+
return None
128+
129+
def get_tags(self) -> list[str]:
130+
return []
131+
132+
def get_metadata(self) -> BenchmarkMetadata:
133+
return BenchmarkMetadata(
134+
type="benchmark",
135+
description=self.description(),
136+
notes=self.notes(),
137+
unstable=self.unstable(),
138+
tags=self.get_tags(),
139+
)
140+
90141

91142
class Suite:
92143
def benchmarks(self) -> list[Benchmark]:
@@ -97,3 +148,6 @@ def name(self) -> str:
97148

98149
def setup(self):
99150
return
151+
152+
def additionalMetadata(self) -> dict[str, BenchmarkMetadata]:
153+
return {}

0 commit comments

Comments
 (0)