-
Notifications
You must be signed in to change notification settings - Fork 797
[SYCL][E2E] Fix lit for arch selection and l0v2 adapter #20728
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
base: sycl
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,4 +31,7 @@ unsupported_san_flags = [ | |
| if any(flag in config.cxx_flags for flag in unsupported_san_flags): | ||
| config.unsupported=True | ||
|
|
||
| config.environment["ZE_AFFINITY_MASK"] = "0" | ||
| if hasattr(config, 'ze_affinity_mask') and config.ze_affinity_mask is not None: | ||
| config.environment["ZE_AFFINITY_MASK"] = config.ze_affinity_mask | ||
| else: | ||
| config.environment["ZE_AFFINITY_MASK"] = "0" | ||
|
Comment on lines
+36
to
+37
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -283,6 +283,15 @@ def get_extra_env(sycl_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 = [] | ||
|
|
||
| # Include ZE_AFFINITY_MASK if set by lit.local.cfg (e.g., for sanitizer tests) | ||
| if "ZE_AFFINITY_MASK" in test.config.environment: | ||
| extra_env.append( | ||
| "ZE_AFFINITY_MASK={}".format( | ||
| test.config.environment["ZE_AFFINITY_MASK"] | ||
| ) | ||
| ) | ||
|
|
||
| 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)) | ||
|
|
||
|
|
@@ -342,8 +351,14 @@ def get_extra_env(sycl_devices): | |
| elif "level_zero_v1" in full_dev_name: | ||
| expanded += " env UR_LOADER_USE_LEVEL_ZERO_V2=0" | ||
|
|
||
| # If ZE_AFFINITY_MASK is set, it filters devices so we should use :0 | ||
| device_selector = parsed_dev_name | ||
| if "ZE_AFFINITY_MASK" in test.config.environment: | ||
| backend, _ = parsed_dev_name.split(":", 1) | ||
| device_selector = f"{backend}:0" | ||
|
Comment on lines
+354
to
+358
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @sarnex , should we just unset it and report a warning instead? Somewhere around https://github.com/mateuszpn/llvm/blob/c5fa7266ca7ecfc0a265ba06da9af99a40cfd557/sycl/test-e2e/lit.cfg.py#L77-L96
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah I recommend this way, having code trying to play nice with existing envvars seems bad |
||
|
|
||
| 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 ... %{ ... %}). | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,9 +9,6 @@ | |
| import shlex | ||
| import shutil | ||
|
|
||
| import lit.formats | ||
| import lit.util | ||
|
|
||
|
Comment on lines
-12
to
-14
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unrelated. |
||
| from lit.llvm import llvm_config | ||
| from lit.llvm.subst import ToolSubst, FindTool | ||
|
|
||
|
|
@@ -917,12 +914,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): | ||
|
|
@@ -948,6 +947,16 @@ def get_sycl_ls_verbose(sycl_device, env): | |
|
|
||
| config.sycl_devices = filtered_sycl_devices | ||
|
|
||
| # Determine ZE_AFFINITY_MASK for Level Zero devices. | ||
| # Sanitizer tests need to set ZE_AFFINITY_MASK to a single device index | ||
| config.ze_affinity_mask = None | ||
| for sycl_device in remove_level_zero_suffix(config.sycl_devices): | ||
| be, dev = sycl_device.split(":") | ||
| if be == "level_zero" and dev.isdigit(): | ||
| if config.ze_affinity_mask is None: | ||
| config.ze_affinity_mask = dev | ||
| break | ||
|
|
||
| for sycl_device in remove_level_zero_suffix(config.sycl_devices): | ||
| be, dev = sycl_device.split(":") | ||
| config.available_features.add("any-device-is-" + dev) | ||
|
|
@@ -1112,6 +1121,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) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why this line? Isn't 1120 enough? |
||
|
|
||
| be, dev = sycl_device.split(":") | ||
| features.add(dev.replace("fpga", "accelerator")) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have
below, is
hasattrcheck needed?