Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 0 additions & 1 deletion .github/workflows/sycl-linux-precommit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ jobs:
runner: '["Linux", "amdgpu"]'
image: ghcr.io/intel/llvm/ubuntu2204_build:latest
image_extra_opts: --device=/dev/dri --device=/dev/kfd
extra_cmake_args: -DHIP_PLATFORM="AMD" -DAMD_ARCH="gfx1031"
- name: CUDA system
runner: '["Linux", "cuda"]'
image: ghcr.io/intel/llvm/ubuntu2204_build:latest
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/sycl-linux-run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ on:
type: string
required: True
extra_cmake_args:
description: |
If empty, then HIP_PLATFORM and AMD_ARCH would be automatically added
if inputs.target_devices contains 'ext_oneapi_hip'
type: string
required: False
tests_selector:
Expand Down Expand Up @@ -282,16 +279,6 @@ jobs:
run: |
if [ -n "$CMAKE_EXTRA_ARGS" ]; then
echo "opts=$CMAKE_EXTRA_ARGS" >> $GITHUB_OUTPUT
else
if [ "${{ contains(inputs.target_devices, 'ext_oneapi_hip') }}" == "true" ]; then
if [ "${{ runner.name }}" == "cp-amd-runner" ]; then
echo 'opts=-DHIP_PLATFORM="AMD" -DAMD_ARCH="gfx1030"' >> $GITHUB_OUTPUT
else
echo 'opts=-DHIP_PLATFORM="AMD" -DAMD_ARCH="gfx1031"' >> $GITHUB_OUTPUT
fi
else
echo 'opts=' >> $GITHUB_OUTPUT
fi
fi
- name: Configure E2E tests
if: inputs.tests_selector == 'e2e'
Expand Down
4 changes: 2 additions & 2 deletions sycl/test-e2e/Matrix/joint_matrix_hip_gfx90a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//

// RUN: %{build} -fsycl -fsycl-targets=amd_gpu_gfx90a %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=amd_gpu_gfx90a %s -o %t.out
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is a bug fix, we shouldn't use %{build} if we're setting -fsycl-targets/choosing file and output

// RUN: %{run} %t.out

// REQUIRES: gpu-amd-gfx90a
// REQUIRES: arch-amd_gpu_gfx90a
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is just to remove a hack in the testing infra, should be exactly the same functionally

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey, just wondering if you were able to build and run these gfx90a tests. AFAIK we don't have these in our CI, so I don't think they ever ran.

Copy link
Contributor Author

@sarnex sarnex Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah i actually tested on the one AMD machine i know not in our CI and it happens to be gfx90a (MI250)


#include "joint_matrix_hip_apply.hpp"
#include "joint_matrix_hip_copy.hpp"
Expand Down
4 changes: 2 additions & 2 deletions sycl/test-e2e/Matrix/joint_matrix_hip_half_gfx90a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
//
//===----------------------------------------------------------------------===//

// RUN: %{build} -fsycl -fsycl-targets=amd_gpu_gfx90a %s -o %t.out
// RUN: %clangxx -fsycl -fsycl-targets=amd_gpu_gfx90a %s -o %t.out
// RUN: %{run} %t.out

// REQUIRES: gpu-amd-gfx90a
// REQUIRES: arch-amd_gpu_gfx90a
// REQUIRES: aspect-fp16

#include "joint_matrix_hip_apply.hpp"
Expand Down
4 changes: 2 additions & 2 deletions sycl/test-e2e/Matrix/runtime_query_hip_gfx90a.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
//
//===----------------------------------------------------------------------===//

// REQUIRES: gpu-amd-gfx90a
// RUN: %{build} -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx90a -o %t.out
// REQUIRES: arch-amd_gpu_gfx90a
// RUN: %clangxx -Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=gfx90a -o %t.out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we add -fsycl?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, fixed in latest commit

// RUN: %{run} %t.out

#include <sycl/detail/core.hpp>
Expand Down
81 changes: 43 additions & 38 deletions sycl/test-e2e/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,6 @@ def open_check_file(file_name):
)
sp = subprocess.check_output(cmd, text=True, shell=True)
for line in sp.splitlines():
if "gfx90a" in line:
config.available_features.add("gpu-amd-gfx90a")
if not line.startswith("["):
continue
(backend, device) = line[1:].split("]")[0].split(":")
Expand Down Expand Up @@ -540,42 +538,6 @@ def open_check_file(file_name):
config.cuda_libs_dir = os.path.join(os.environ["CUDA_PATH"], r"lib64")
config.cuda_include = os.path.join(os.environ["CUDA_PATH"], "include")

# FIXME: This needs to be made per-device as well, possibly with a helper.
if "hip:gpu" in config.sycl_devices and config.hip_platform == "AMD":
if not config.amd_arch:
lit_config.error(
"Cannot run tests for HIP without an offload-arch. Please "
+ "specify one via the 'amd_arch' parameter or 'AMD_ARCH' CMake "
+ "variable."
)
llvm_config.with_system_environment("ROCM_PATH")
config.available_features.add("hip_amd")
arch_flag = (
"-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=" + config.amd_arch
)
config.substitutions.append(
("%rocm_path", os.environ.get("ROCM_PATH", "/opt/rocm"))
)
elif "hip:gpu" in config.sycl_devices and config.hip_platform == "NVIDIA":
config.available_features.add("hip_nvidia")
arch_flag = ""
else:
arch_flag = ""

if lit_config.params.get("compatibility_testing", False):
config.substitutions.append(("%clangxx", " true "))
config.substitutions.append(("%clang", " true "))
else:
config.substitutions.append(
(
"%clangxx",
" " + config.dpcpp_compiler + " " + config.cxx_flags + " " + arch_flag,
)
)
config.substitutions.append(
("%clang", " " + config.dpcpp_compiler + " " + config.c_flags)
)

config.substitutions.append(("%threads_lib", config.sycl_threads_lib))

if lit_config.params.get("ze_debug"):
Expand Down Expand Up @@ -805,6 +767,49 @@ def open_check_file(file_name):
else:
config.intel_driver_ver[sycl_device] = {}

if "hip:gpu" in config.sycl_devices and config.hip_platform == "AMD":
if not config.amd_arch:
amd_arch_prefix = "arch-amd_gpu_"
amd_device_arch = [i for i in config.sycl_dev_features["hip:gpu"] if amd_arch_prefix in i]
if len(amd_device_arch) == 0:
lit_config.error(
Copy link
Contributor Author

@sarnex sarnex Nov 13, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i had to move this block down so the sycl-ls parsing we already do is available, but that meant i had to add a loop at the end to update the features

"Cannot detect architecture for AMD HIP device, specify it explicitly"
)
if len(amd_device_arch) > 1:
lit_config.warning("Multiple AMD HIP devices, using the architecture from the first one")
config.amd_arch = amd_device_arch[0].replace(amd_arch_prefix, "")
llvm_config.with_system_environment("ROCM_PATH")
config.available_features.add("hip_amd")
arch_flag = (
"-Xsycl-target-backend=amdgcn-amd-amdhsa --offload-arch=" + config.amd_arch
)
config.substitutions.append(
("%rocm_path", os.environ.get("ROCM_PATH", "/opt/rocm"))
)
elif "hip:gpu" in config.sycl_devices and config.hip_platform == "NVIDIA":
config.available_features.add("hip_nvidia")
arch_flag = ""
else:
arch_flag = ""

if lit_config.params.get("compatibility_testing", False):
config.substitutions.append(("%clangxx", " true "))
config.substitutions.append(("%clang", " true "))
else:
config.substitutions.append(
(
"%clangxx",
" " + config.dpcpp_compiler + " " + config.cxx_flags + " " + arch_flag,
)
)
config.substitutions.append(
("%clang", " " + config.dpcpp_compiler + " " + config.c_flags)
)

# Update each device's features with anything added during HIP device handling
for sycl_device in config.sycl_devices:
config.sycl_dev_features[sycl_device] = config.sycl_dev_features[sycl_device].union(config.available_features)

# Set timeout for a single test
try:
import psutil
Expand Down
Loading