Skip to content

[SYCL][BENCHMARK] Add HIP to benchmarks scripts #17449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def benchmarks(self) -> list[Benchmark]:
if options.sycl is None:
return []

if options.ur_adapter == "cuda":
if options.ur_adapter == "cuda" or options.ur_adapter == "hip":
return []

benches = []
Expand Down
2 changes: 1 addition & 1 deletion devops/scripts/benchmarks/benches/llamacpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def benchmarks(self) -> list[Benchmark]:
if options.sycl is None:
return []

if options.ur_adapter == "cuda":
if options.ur_adapter == "cuda" or options.ur_adapter == "hip":
return []

return [LlamaBench(self)]
Expand Down
5 changes: 5 additions & 0 deletions devops/scripts/benchmarks/benches/syclbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ def setup(self):
f"-DCMAKE_CXX_FLAGS=-fsycl -fsycl-targets=nvptx64-nvidia-cuda"
]

if options.ur_adapter == "hip":
configure_command += [
f"-DCMAKE_CXX_FLAGS=-fsycl -fsycl-targets=amdgcn-amd-amdhsa -Xsycl-target-backend --offload-arch={options.hip_arch}"
]

run(configure_command, add_sycl=True)
run(f"cmake --build {build_path} -j {options.build_jobs}", add_sycl=True)

Expand Down
7 changes: 6 additions & 1 deletion devops/scripts/benchmarks/benches/velocity.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def benchmarks(self) -> list[Benchmark]:
if options.sycl is None:
return []

if options.ur_adapter == "cuda":
if options.ur_adapter == "cuda" or options.ur_adapter == "hip":
return [
Hashtable(self),
Bitcracker(self),
Expand Down Expand Up @@ -83,6 +83,11 @@ def download_deps(self):
def extra_cmake_args(self) -> list[str]:
if options.ur_adapter == "cuda":
return [f"-DUSE_NVIDIA_BACKEND=YES", f"-DUSE_SM=80"]
if options.ur_adapter == "hip":
return [
f"-DUSE_AMD_BACKEND=YES",
f"-DUSE_AMDHIP_BACKEND={options.hip_arch}",
]
return []

def ld_libraries(self) -> list[str]:
Expand Down
11 changes: 9 additions & 2 deletions devops/scripts/benchmarks/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,13 @@ def validate_and_parse_env_args(env_args):
default=options.current_run_name,
)
parser.add_argument(
"--cudnn_directory",
"--cudnn-directory",
type=str,
help="Directory for cudnn library",
default=None,
)
parser.add_argument(
"--cublas_directory",
"--cublas-directory",
type=str,
help="Directory for cublas library",
default=None,
Expand All @@ -469,6 +469,12 @@ def validate_and_parse_env_args(env_args):
help="Number of build jobs to run simultaneously",
default=options.build_jobs,
)
parser.add_argument(
"--hip-arch",
type=str,
help="HIP device architecture",
default=None,
)

args = parser.parse_args()
additional_env_vars = validate_and_parse_env_args(args.env)
Expand Down Expand Up @@ -497,6 +503,7 @@ def validate_and_parse_env_args(env_args):
options.cublas_directory = args.cublas_directory
options.custom_results_dir = args.results_dir
options.build_jobs = args.build_jobs
options.hip_arch = args.hip_arch

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