Skip to content

Commit 1600218

Browse files
authored
[SYCL][HIP] Remove arch requirement for running lit tests (#5253)
This flag was introduced before all the tests that run code were moved to the `llvm-test-suite` repository. The tests left in this repository are only compiler tests so the offload architecture can simply be hardcoded as the tests don't depend on what hardware is available.
1 parent c228f12 commit 1600218

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

.github/workflows/sycl_linux_build_and_test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ on:
4040
build_configure_extra_args:
4141
type: string
4242
required: false
43-
default: "--hip --hip-amd-arch=gfx906 --cuda"
43+
default: "--hip --cuda"
4444
build_artifact_suffix:
4545
type: string
4646
required: true
@@ -86,7 +86,7 @@ jobs:
8686
\"build_cache_root\":\"/__w/\",
8787
\"build_cache_suffix\":\"default\",
8888
\"build_cache_size\":\"2G\",
89-
\"build_configure_extra_args\":\"--hip --hip-amd-arch=gfx906 --cuda\",
89+
\"build_configure_extra_args\":\"--hip --cuda\",
9090
\"build_artifact_suffix\":\"default\",
9191
\"build_upload_artifact\":\"false\",
9292
\"intel_drivers_image\":\"ghcr.io/intel/llvm/ubuntu2004_intel_drivers:latest\",

buildbot/configure.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,6 @@ def do_configure(args):
6666
if args.hip_platform == 'AMD':
6767
llvm_targets_to_build += ';AMDGPU'
6868
libclc_targets_to_build += libclc_amd_target_names
69-
if args.hip_amd_arch:
70-
sycl_clang_extra_flags += "-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch="+args.hip_amd_arch
7169

7270
# The HIP plugin for AMD uses lld for linking
7371
llvm_enable_projects += ';lld'
@@ -211,7 +209,6 @@ def main():
211209
parser.add_argument("--cuda", action='store_true', help="switch from OpenCL to CUDA")
212210
parser.add_argument("--hip", action='store_true', help="switch from OpenCL to HIP")
213211
parser.add_argument("--hip-platform", type=str, choices=['AMD', 'NVIDIA'], default='AMD', help="choose hardware platform for HIP backend")
214-
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")
215212
parser.add_argument("--arm", action='store_true', help="build ARM support rather than x86")
216213
parser.add_argument("--enable-esimd-emulator", action='store_true', help="build with ESIMD emulation support")
217214
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")

sycl/doc/GetStartedGuide.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -502,10 +502,10 @@ skipped.
502502
If CUDA support has been built, it is tested only if there are CUDA devices
503503
available.
504504
505-
If testing with HIP for AMD make sure to specify the GPU being used
506-
by adding `-hip-amd-arch=<target>`to buildbot/configure.py or add
507-
`-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=<target>`
508-
to the CMake variable `SYCL_CLANG_EXTRA_FLAGS`.
505+
If testing with HIP for AMD, the lit tests will use `gfx906` as the default
506+
architecture. It is possible to change it by adding
507+
`-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=<target>` to the CMake
508+
variable `SYCL_CLANG_EXTRA_FLAGS`.
509509
510510
#### Run DPC++ E2E test suite
511511

sycl/test/lit.cfg.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
# test_exec_root: The root path where tests should be run.
3636
config.test_exec_root = os.path.join(config.sycl_obj_root, 'test')
3737

38-
llvm_config.use_clang(additional_flags=config.sycl_clang_extra_flags.split(' '))
39-
4038
# Propagate some variables from the host environment.
4139
llvm_config.with_system_environment(['PATH', 'OCL_ICD_FILENAMES', 'SYCL_DEVICE_ALLOWLIST', 'SYCL_CONFIG_FILE_NAME'])
4240

@@ -100,6 +98,8 @@
10098
lit_config.note("Triple: {}".format(triple))
10199
config.substitutions.append( ('%sycl_triple', triple ) )
102100

101+
additional_flags = config.sycl_clang_extra_flags.split(' ')
102+
103103
if config.cuda_be == "ON":
104104
config.available_features.add('cuda_be')
105105

@@ -115,12 +115,13 @@
115115
if triple == 'amdgcn-amd-amdhsa':
116116
config.available_features.add('hip_amd')
117117
# For AMD the specific GPU has to be specified with --offload-arch
118-
if not re.match('.*--offload-arch.*', config.sycl_clang_extra_flags):
119-
raise Exception("Error: missing --offload-arch flag when trying to " \
120-
"run lit tests for AMD GPU, please add " \
121-
"--hip-amd-arch=<target> to buildbot/configure.py or add" \
122-
"`-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=<target>` to " \
123-
"the CMake variable SYCL_CLANG_EXTRA_FLAGS")
118+
if not any([f.startswith('--offload-arch') for f in additional_flags]):
119+
# If the offload arch wasn't specified in SYCL_CLANG_EXTRA_FLAGS,
120+
# hardcode it to gfx906, this is fine because only compiler tests
121+
additional_flags += ['-Xsycl-target-backend=amdgcn-amd-amdhsa',
122+
'--offload-arch=gfx906']
123+
124+
llvm_config.use_clang(additional_flags=additional_flags)
124125

125126
# Set timeout for test = 10 mins
126127
try:

0 commit comments

Comments
 (0)