Skip to content

[SYCL][E2E][LIT] Normalize devices not to include "ext_oneapi_" #12185

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
Dec 19, 2023

Conversation

aelovikov-intel
Copy link
Contributor

Copy link
Contributor

@steffenlarsen steffenlarsen left a comment

Choose a reason for hiding this comment

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

LGTM! 👍

Copy link
Contributor

github-actions bot commented Dec 18, 2023

⚠️ Python code formatter, darker found issues in your code. ⚠️

You can test this locally with the following command:
darker --check --diff -r 66a741bc9d0056e7b350ceed2a01b8531b156af6...e7f9d67d16e9efd0103bacffa25cb1844338eb1c sycl/test-e2e/format.py sycl/test-e2e/lit.cfg.py
View the diff from darker here.
--- format.py	2023-12-18 20:01:36.000000 +0000
+++ format.py	2023-12-18 22:23:20.193457 +0000
@@ -10,15 +10,15 @@
 
 import os
 import re
 
 def get_triple(test, backend):
-    if backend == 'cuda':
-        return 'nvptx64-nvidia-cuda'
-    if backend == 'hip':
-        if test.config.hip_platform == 'NVIDIA':
-            return 'nvptx64-nvidia-cuda'
+    if backend == "cuda":
+        return "nvptx64-nvidia-cuda"
+    if backend == "hip":
+        if test.config.hip_platform == "NVIDIA":
+            return "nvptx64-nvidia-cuda"
         else:
             return 'amdgcn-amd-amdhsa'
     if backend == 'native_cpu':
         return 'native_cpu'
     return 'spir64'
@@ -162,18 +162,22 @@
             # current llvm-lit invocation isn't configured to include it. We
             # don't use ONEAPI_DEVICE_SELECTOR for `%{run-unfiltered-devices}`
             # so that device might still be accessible to some of the tests yet
             # we won't set the environment variable below for such scenario.
             extra_env = []
-            if 'level_zero:gpu' in sycl_devices and litConfig.params.get('ur_l0_debug'):
-                extra_env.append('UR_L0_DEBUG={}'.format(test.config.ur_l0_debug))
-
-            if 'level_zero:gpu' in sycl_devices and litConfig.params.get('ur_l0_leaks_debug'):
-                extra_env.append('UR_L0_LEAKS_DEBUG={}'.format(test.config.ur_l0_leaks_debug))
-
-            if 'cuda:gpu' in sycl_devices:
-                extra_env.append('SYCL_PI_CUDA_ENABLE_IMAGE_SUPPORT=1')
+            if "level_zero:gpu" in sycl_devices and litConfig.params.get("ur_l0_debug"):
+                extra_env.append("UR_L0_DEBUG={}".format(test.config.ur_l0_debug))
+
+            if "level_zero:gpu" in sycl_devices and litConfig.params.get(
+                "ur_l0_leaks_debug"
+            ):
+                extra_env.append(
+                    "UR_L0_LEAKS_DEBUG={}".format(test.config.ur_l0_leaks_debug)
+                )
+
+            if "cuda:gpu" in sycl_devices:
+                extra_env.append("SYCL_PI_CUDA_ENABLE_IMAGE_SUPPORT=1")
 
             return extra_env
 
         extra_env = get_extra_env(devices_for_test)
 
--- lit.cfg.py	2023-12-15 00:20:07.000000 +0000
+++ lit.cfg.py	2023-12-18 22:23:20.412351 +0000
@@ -303,17 +303,19 @@
     config.sycl_devices = list(devices)
 
 if len(config.sycl_devices) > 1:
     lit_config.note('Running on multiple devices, XFAIL-marked tests will be skipped on corresponding devices')
 
-config.sycl_devices = [x.replace('ext_oneapi_', '') for x in config.sycl_devices]
-
-available_devices = {'opencl': ('cpu', 'gpu', 'acc'),
-                     'cuda':('gpu'),
-                     'level_zero':('gpu'),
-                     'hip':('gpu'),
-                     'native_cpu':('cpu')}
+config.sycl_devices = [x.replace("ext_oneapi_", "") for x in config.sycl_devices]
+
+available_devices = {
+    "opencl": ("cpu", "gpu", "acc"),
+    "cuda": ("gpu"),
+    "level_zero": ("gpu"),
+    "hip": ("gpu"),
+    "native_cpu": ("cpu"),
+}
 for d in config.sycl_devices:
      be, dev = d.split(':')
      if be not in available_devices or dev not in available_devices[be]:
           lit_config.error('Unsupported device {}'.format(d))
 
@@ -426,23 +428,23 @@
 
 for sycl_device in config.sycl_devices:
     be, dev = sycl_device.split(':')
     config.available_features.add('any-device-is-' + dev)
     # Use short names for LIT rules.
-    config.available_features.add('any-device-is-' + be)
+    config.available_features.add("any-device-is-" + be)
 
 # That has to be executed last so that all device-independent features have been
 # discovered already.
 config.sycl_dev_features = {}
 
 # Version of the driver for a given device. Empty for non-Intel devices.
 config.intel_driver_ver = {}
 for sycl_device in config.sycl_devices:
     env = copy.copy(llvm_config.config.environment)
-    env['ONEAPI_DEVICE_SELECTOR'] = sycl_device
-    if sycl_device.startswith('cuda:'):
-        env['SYCL_PI_CUDA_ENABLE_IMAGE_SUPPORT'] = '1'
+    env["ONEAPI_DEVICE_SELECTOR"] = sycl_device
+    if sycl_device.startswith("cuda:"):
+        env["SYCL_PI_CUDA_ENABLE_IMAGE_SUPPORT"] = "1"
     # When using the ONEAPI_DEVICE_SELECTOR environment variable, sycl-ls
     # prints warnings that might derail a user thinking something is wrong
     # with their test run. It's just us filtering here, so silence them unless
     # we get an exit status.
     try:

Copy link
Contributor

@sommerlukas sommerlukas left a comment

Choose a reason for hiding this comment

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

Changes to the kernel fusion test LGTM.

@@ -1,7 +1,7 @@
// RUN: %{build} -o %t.out
// RUN: %{run} %t.out
// Extra run to check for leaks in Level Zero using UR_L0_LEAKS_DEBUG
// RUN: %if ext_oneapi_level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %}
// RUN: %if level_zero %{env UR_L0_LEAKS_DEBUG=1 %{run} %t.out 2>&1 | FileCheck %s %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

2Graph team: I'd suggest to modify your RUN lines to use FileCheck %s --implicit-check-not=LEAK and drop line 6 here and in other tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the tip, we can do this as a follow-up PR

@aelovikov-intel
Copy link
Contributor Author

@intel/dpcpp-tools-reviewers , ping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants