Skip to content

[SYCL][HIP] Remove arch requirement for running lit tests #5253

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 5 commits into from
Feb 15, 2022
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
4 changes: 2 additions & 2 deletions .github/workflows/sycl_linux_build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ on:
build_configure_extra_args:
type: string
required: false
default: "--hip --hip-amd-arch=gfx906 --cuda"
default: "--hip --cuda"
build_artifact_suffix:
type: string
required: true
Expand Down Expand Up @@ -86,7 +86,7 @@ jobs:
\"build_cache_root\":\"/__w/\",
\"build_cache_suffix\":\"default\",
\"build_cache_size\":\"2G\",
\"build_configure_extra_args\":\"--hip --hip-amd-arch=gfx906 --cuda\",
\"build_configure_extra_args\":\"--hip --cuda\",
\"build_artifact_suffix\":\"default\",
\"build_upload_artifact\":\"false\",
\"intel_drivers_image\":\"ghcr.io/intel/llvm/ubuntu2004_intel_drivers:latest\",
Expand Down
3 changes: 0 additions & 3 deletions buildbot/configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@ def do_configure(args):
if args.hip_platform == 'AMD':
llvm_targets_to_build += ';AMDGPU'
libclc_targets_to_build += libclc_amd_target_names
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 @@ -211,7 +209,6 @@ 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-emulator", action='store_true', help="build with ESIMD emulation support")
parser.add_argument("--no-assertions", action='store_true', help="build without assertions")
Expand Down
8 changes: 4 additions & 4 deletions sycl/doc/GetStartedGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -502,10 +502,10 @@ skipped.
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 `-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`.
If testing with HIP for AMD, the lit tests will use `gfx906` as the default
architecture. It is possible to change it by adding
`-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=<target>` to the CMake
variable `SYCL_CLANG_EXTRA_FLAGS`.

#### Run DPC++ E2E test suite

Expand Down
17 changes: 9 additions & 8 deletions sycl/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
# test_exec_root: The root path where tests should be run.
config.test_exec_root = os.path.join(config.sycl_obj_root, 'test')

llvm_config.use_clang(additional_flags=config.sycl_clang_extra_flags.split(' '))

# Propagate some variables from the host environment.
llvm_config.with_system_environment(['PATH', 'OCL_ICD_FILENAMES', 'SYCL_DEVICE_ALLOWLIST', 'SYCL_CONFIG_FILE_NAME'])

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

additional_flags = config.sycl_clang_extra_flags.split(' ')

if config.cuda_be == "ON":
config.available_features.add('cuda_be')

Expand All @@ -115,12 +115,13 @@
if triple == 'amdgcn-amd-amdhsa':
config.available_features.add('hip_amd')
# For AMD the specific GPU has to be specified with --offload-arch
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")
if not any([f.startswith('--offload-arch') for f in additional_flags]):
# If the offload arch wasn't specified in SYCL_CLANG_EXTRA_FLAGS,
# hardcode it to gfx906, this is fine because only compiler tests
additional_flags += ['-Xsycl-target-backend=amdgcn-amd-amdhsa',
'--offload-arch=gfx906']

llvm_config.use_clang(additional_flags=additional_flags)

# Set timeout for test = 10 mins
try:
Expand Down