Skip to content

[SYCL] Add HIP arch argument for lit tests #4676

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 1 commit into from
Oct 4, 2021
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
7 changes: 6 additions & 1 deletion buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def do_configure(args):
sycl_build_pi_esimd_cpu = 'OFF'
sycl_build_pi_hip = 'OFF'
sycl_build_pi_hip_platform = 'AMD'
sycl_clang_extra_flags = ''
sycl_werror = 'ON'
llvm_enable_assertions = 'ON'
llvm_enable_doxygen = 'OFF'
Expand Down Expand Up @@ -67,6 +68,8 @@ def do_configure(args):
if args.hip_platform == 'AMD':
llvm_targets_to_build += ';AMDGPU'
libclc_targets_to_build += ';amdgcn--;amdgcn--amdhsa'
if args.hip_amd_arch:
sycl_clang_extra_flags += "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch="+args.hip_amd_arch

# The HIP plugin for AMD uses lld for linking
llvm_enable_projects += ';lld'
Expand Down Expand Up @@ -126,7 +129,8 @@ def do_configure(args):
"-DSYCL_ENABLE_XPTI_TRACING={}".format(sycl_enable_xpti_tracing),
"-DLLVM_ENABLE_LLD={}".format(llvm_enable_lld),
"-DSYCL_BUILD_PI_ESIMD_CPU={}".format(sycl_build_pi_esimd_cpu),
"-DXPTI_ENABLE_WERROR={}".format(xpti_enable_werror)
"-DXPTI_ENABLE_WERROR={}".format(xpti_enable_werror),
"-DSYCL_CLANG_EXTRA_FLAGS={}".format(sycl_clang_extra_flags)
]

if args.l0_headers and args.l0_loader:
Expand Down Expand Up @@ -188,6 +192,7 @@ def main():
parser.add_argument("--cuda", action='store_true', help="switch from OpenCL to CUDA")
parser.add_argument("--hip", action='store_true', help="switch from OpenCL to HIP")
parser.add_argument("--hip-platform", type=str, choices=['AMD', 'NVIDIA'], default='AMD', help="choose hardware platform for HIP backend")
parser.add_argument("--hip-amd-arch", type=str, help="Sets AMD gpu architecture for llvm lit tests, this is only needed for the HIP backend and AMD platform")
parser.add_argument("--arm", action='store_true', help="build ARM support rather than x86")
parser.add_argument("--enable-esimd-cpu-emulation", action='store_true', help="build with ESIMD_CPU emulation support")
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")
Expand Down
6 changes: 3 additions & 3 deletions sycl/doc/GetStartedGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -488,9 +488,9 @@ If CUDA support has been built, it is tested only if there are CUDA devices
available.

If testing with HIP for AMD make sure to specify the GPU being used
by adding `-Xsycl-target-backend=amdgcn-amd-amdhsa
--offload-arch=<target>` to the CMake variable
`SYCL_CLANG_EXTRA_FLAGS`.
by adding `-hip-amd-arch=<target>`to buildbot/configure.py or add
`-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=<target>`
to the CMake variable `SYCL_CLANG_EXTRA_FLAGS`.

#### Run DPC++ E2E test suite

Expand Down
1 change: 1 addition & 0 deletions sycl/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@
if not re.match('.*--offload-arch.*', config.sycl_clang_extra_flags):
raise Exception("Error: missing --offload-arch flag when trying to " \
"run lit tests for AMD GPU, please add " \
"--hip-amd-arch=<target> to buildbot/configure.py or add" \
"`-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=<target>` to " \
"the CMake variable SYCL_CLANG_EXTRA_FLAGS")

Expand Down