Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 9 additions & 1 deletion sycl/test-e2e/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,14 @@ def get_extra_env(sycl_devices):
expanded = "env"

extra_env = get_extra_env([parsed_dev_name])
backend, device = parsed_dev_name.split(":", 1)
Copy link
Contributor

Choose a reason for hiding this comment

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

The example of the intended lit string after the change in the PR description is

llvm-lit --param "sycl_devices=level_zero_v2:arch-intel_gpu_mtl_u" sycl/test-e2e

but I was expecting something like

llvm-lit --param "sycl_devices='level_zero_v1:gpu;level_zero_v2:gpu" sycl/test-e2e

Can you clarify on the intended use case? Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The goal is to force tests to run on specified device, eg. integrated gpu, even when other devices are present. The option was available before (see lit.cpg.py:901). Although it is rarely used, it is still perfect for testing integrated GPUs. Unfortunately, due to a bug, it did not work with the _v1 or _v2 postfixes in the backend name. The PR fixes this bug.

device_selector = parsed_dev_name
if backend == "level_zero" and device.isdigit():
# level_zero:0 maps to a selector for the first GPU, so pin
# execution to the requested device via ZE_AFFINITY_MASK.
extra_env.append(f"ZE_AFFINITY_MASK={device}")
device_selector = f"{backend}:0"

if extra_env:
expanded += " {}".format(" ".join(extra_env))

Expand All @@ -343,7 +351,7 @@ def get_extra_env(sycl_devices):
expanded += " env UR_LOADER_USE_LEVEL_ZERO_V2=0"

expanded += " ONEAPI_DEVICE_SELECTOR={} {}".format(
parsed_dev_name, test.config.run_launcher
device_selector, test.config.run_launcher
)
cmd = directive.command.replace("%{run}", expanded)
# Expand device-specific condtions (%if ... %{ ... %}).
Expand Down
7 changes: 5 additions & 2 deletions sycl/test-e2e/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -917,12 +917,14 @@ def get_sycl_ls_verbose(sycl_device, env):

env = copy.copy(llvm_config.config.environment)

backend_for_selector = backend.replace("_v2", "").replace("_v1", "")

# Find all available devices under the backend
env["ONEAPI_DEVICE_SELECTOR"] = backend + ":*"
env["ONEAPI_DEVICE_SELECTOR"] = backend_for_selector + ":*"

detected_architectures = []

platform_devices = remove_level_zero_suffix(backend + ":*")
platform_devices = backend_for_selector + ":*"

for line in get_sycl_ls_verbose(platform_devices, env).stdout.splitlines():
if re.match(r" *Architecture:", line):
Expand Down Expand Up @@ -1112,6 +1114,7 @@ def get_sycl_ls_verbose(sycl_device, env):
features.update(sg_size_features)
features.update(architecture_feature)
features.update(device_family)
features.update(aspects)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this line? Isn't 1120 enough?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

When using arch-selection, the device is not :gpu and 'gpu' is not added to the features. The questioned line solves this in simple way, but with overhead - adds more then only 'gpu'. Replaced it with clean solution


be, dev = sycl_device.split(":")
features.add(dev.replace("fpga", "accelerator"))
Expand Down