Skip to content

Commit 6f69896

Browse files
[SYCL][BENCHMARK] Enable velocityBench and SyclBench for cuda adapter (#17217)
Enable benchmarking sycl for cuda adapter through VelocityBench and SyclBench in benchmarking scripts.
1 parent 799c7be commit 6f69896

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed

unified-runtime/scripts/benchmarks/benches/compute.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ def benchmarks(self) -> list[Benchmark]:
5858
if options.sycl is None:
5959
return []
6060

61+
if options.ur_adapter == "cuda":
62+
return []
63+
6164
benches = [
6265
SubmitKernelL0(self, 0),
6366
SubmitKernelL0(self, 1),

unified-runtime/scripts/benchmarks/benches/llamacpp.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ def benchmarks(self) -> list[Benchmark]:
7575
if options.sycl is None:
7676
return []
7777

78+
if options.ur_adapter == "cuda":
79+
return []
80+
7881
return [LlamaBench(self)]
7982

8083

unified-runtime/scripts/benchmarks/benches/syclbench.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ def setup(self):
4545
f"-DSYCL_IMPL=dpcpp",
4646
]
4747

48+
if options.ur_adapter == "cuda":
49+
configure_command += [
50+
f"-DCMAKE_CXX_FLAGS=-fsycl -fsycl-targets=nvptx64-nvidia-cuda"
51+
]
52+
4853
run(configure_command, add_sycl=True)
4954
run(f"cmake --build {build_path} -j", add_sycl=True)
5055

unified-runtime/scripts/benchmarks/benches/velocity.py

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ def benchmarks(self) -> list[Benchmark]:
4141
if options.sycl is None:
4242
return []
4343

44+
if options.ur_adapter == "cuda":
45+
return [
46+
Hashtable(self),
47+
Bitcracker(self),
48+
CudaSift(self),
49+
QuickSilver(self),
50+
SobelFilter(self),
51+
]
52+
4453
return [
4554
Hashtable(self),
4655
Bitcracker(self),
@@ -66,6 +75,8 @@ def download_deps(self):
6675
return
6776

6877
def extra_cmake_args(self) -> list[str]:
78+
if options.ur_adapter == "cuda":
79+
return [f"-DUSE_NVIDIA_BACKEND=YES", f"-DUSE_SM=80"]
6980
return []
7081

7182
def ld_libraries(self) -> list[str]:
@@ -358,6 +369,12 @@ def download_deps(self):
358369

359370
def extra_cmake_args(self):
360371
oneapi = get_oneapi()
372+
if options.ur_adapter == "cuda":
373+
return [
374+
f"-DUSE_NVIDIA_BACKEND=YES",
375+
f"-DUSE_SM=80",
376+
f"-DCMAKE_CXX_FLAGS=-O3 -fsycl -ffast-math -I{oneapi.dnn_include()} -I{oneapi.mkl_include()} -L{oneapi.dnn_lib()} -L{oneapi.mkl_lib()}",
377+
]
361378
return [
362379
f"-DCMAKE_CXX_FLAGS=-O3 -fsycl -ffast-math -I{oneapi.dnn_include()} -I{oneapi.mkl_include()} -L{oneapi.dnn_lib()} -L{oneapi.mkl_lib()}"
363380
]
@@ -415,6 +432,12 @@ def download_deps(self):
415432

416433
def extra_cmake_args(self):
417434
oneapi = get_oneapi()
435+
if options.ur_adapter == "cuda":
436+
return [
437+
f"-DUSE_NVIDIA_BACKEND=YES",
438+
f"-DUSE_SM=80",
439+
f"-DCMAKE_CXX_FLAGS=-O3 -fsycl -ffast-math -I{oneapi.dnn_include()} -I{oneapi.mkl_include()} -L{oneapi.dnn_lib()} -L{oneapi.mkl_lib()}",
440+
]
418441
return [
419442
f"-DCMAKE_CXX_FLAGS=-O3 -fsycl -ffast-math -I{oneapi.dnn_include()} -I{oneapi.mkl_include()} -L{oneapi.dnn_lib()} -L{oneapi.mkl_lib()}"
420443
]
@@ -452,6 +475,12 @@ def ld_libraries(self):
452475

453476
def extra_cmake_args(self):
454477
oneapi = get_oneapi()
478+
if options.ur_adapter == "cuda":
479+
return [
480+
f"-DUSE_NVIDIA_BACKEND=YES",
481+
f"-DUSE_SM=80",
482+
f"-DCMAKE_CXX_FLAGS=-O3 -fsycl -ffast-math -I{oneapi.dnn_include()} -I{oneapi.mkl_include()} -L{oneapi.dnn_lib()} -L{oneapi.mkl_lib()}",
483+
]
455484
return [
456485
f"-DCMAKE_CXX_FLAGS=-O3 -fsycl -ffast-math -I{oneapi.dnn_include()} -I{oneapi.mkl_include()} -L{oneapi.dnn_lib()} -L{oneapi.mkl_lib()}"
457486
]

unified-runtime/scripts/benchmarks/main.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,18 @@ def validate_and_parse_env_args(env_args):
411411
help="The name of the results which should be used as a baseline for metrics calculation",
412412
default=options.current_run_name,
413413
)
414+
parser.add_argument(
415+
"--cudnn_directory",
416+
type=str,
417+
help="Directory for cudnn library",
418+
default=None,
419+
)
420+
parser.add_argument(
421+
"--cublas_directory",
422+
type=str,
423+
help="Directory for cublas library",
424+
default=None,
425+
)
414426

415427
args = parser.parse_args()
416428
additional_env_vars = validate_and_parse_env_args(args.env)
@@ -434,6 +446,8 @@ def validate_and_parse_env_args(env_args):
434446
options.iterations_stddev = args.iterations_stddev
435447
options.build_igc = args.build_igc
436448
options.current_run_name = args.relative_perf
449+
options.cudnn_directory = args.cudnn_directory
450+
options.cublas_directory = args.cublas_directory
437451

438452
if args.build_igc and args.compute_runtime is None:
439453
parser.error("--build-igc requires --compute-runtime to be set")

0 commit comments

Comments
 (0)