Skip to content

[SYCL] Removed deprecated environment variables #12007

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

Closed
wants to merge 5 commits into from

Conversation

eunakim0103
Copy link
Contributor

@eunakim0103 eunakim0103 commented Nov 26, 2023

Removed deprecated environment variables in below including in the .md files, corresponding source code as well as test codes:

  • SYCL_DEVICE_TYPE
  • SYCL_DEVICE_FILTER
  • SYCL_BE

SYCL_DEVICE_FILTER has been replaced with ONEAPI_DEVICE_SELECTOR. Removed the below two items from available backend lists and a device type which are deprecated in SYCL_DEVICE_FILTER.

  • backend: esimd_emulator (deprecated), **host (deprecated) was kept
  • device type: host (deprecated) but kept

Modified/Replaced test files are as below:

  • llvm/sycl/test/invoke_simd.cpp
  • llvm/sycl/test-e2e/DeprecatedFeatures/deprecated_removed_sycl_device_filter.cpp

Added “__INTEL_PREVIEW_BREAKING_CHANGES macro” macro for breaking changes

@eunakim0103 eunakim0103 requested review from a team as code owners November 26, 2023 07:27
@eunakim0103 eunakim0103 marked this pull request as draft November 26, 2023 07:27
@@ -1,350 +0,0 @@
// RUN: %clangxx -fsycl -fsyntax-only -fno-sycl-device-code-split-esimd -Xclang -fsycl-allow-func-ptr %s
Copy link
Contributor

Choose a reason for hiding this comment

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

Removal of this test doesn't seem right: it has nothing to do with environment variable you are removing, the test doesn't even launch the binary it builds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

While removing SYCL_DEVICE_FILTER, I found esimd_emulator has been deprecated from backend list in SYCL_DEVICE_FILTER (and does not exist in ONEAPI_DEVICE_SELECTOR). I removed esimd_emulator part and test as well. Let me double check the spec first.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not remove this test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks all! Evgeniy confirmed that this test is not for emulator-specific and we should keep it. I will fix it.

```
$ SYCL_DEVICE_FILTER=level_zero sycl-ls
$ ONEAPI_DEVICE_SELECTOR=level_zero sycl-ls
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a valid use of ONEAPI_DEVICE_SELECTOR. I believe it should be

Suggested change
$ ONEAPI_DEVICE_SELECTOR=level_zero sycl-ls
$ ONEAPI_DEVICE_SELECTOR=level_zero:* sycl-ls

Same applies to the other example below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, we should use the official ext_oneapi_level_zero spelling.

Copy link
Contributor

Choose a reason for hiding this comment

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

According to this documentation, the official spelling is "level_zero".

Copy link
Contributor

@aelovikov-intel aelovikov-intel Nov 27, 2023

Choose a reason for hiding this comment

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

sycl-ls uses ext_oneapi_* for level_zero/hip/cuda in its output. I would expect that the document is slightly obsolete and needs to be fixed.

Copy link
Contributor

Choose a reason for hiding this comment

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

We've used the spelling "level_zero" in every presentation that I can think of. @cperkinsintel, I think you implemented ONEAPI_DEVICE_SELECTOR. Does it expect "level_zero" or "ext_oneapi_level_zero" as the name of the backend?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the confusion came from the fact that ONEAPI_DEVICE_SELECTOR has

<backend> ::= { * | level_zero | opencl | cuda | hip | native_cpu }  // case insensitive

while
https://github.com/intel/llvm/blob/sycl/sycl/doc/extensions/supported/sycl_ext_oneapi_backend_level_zero.md has

enum class backend {
  // ...
  ext_oneapi_level_zero,
  // ...
};

SYCL2020 6.3.7. Adding a backend says this:

The extension should add a new value to the sycl::backend enumeration type using a naming scheme like ext__. For example, if the Acme vendor adds a backend named "foo", it would add an enumerated value named sycl::backend::ext_acme_foo.

As such, I have two questions:

  1. What would happen if we'll have two vendors providing backends with the same name?
  2. Why doesn't native_cpu follow the naming convention required by the specification (see
    enum class backend : char {
    host __SYCL2020_DEPRECATED("'host' backend is no longer supported") = 0,
    opencl = 1,
    ext_oneapi_level_zero = 2,
    ext_oneapi_cuda = 3,
    all = 4,
    ext_intel_esimd_emulator __SYCL_DEPRECATED(
    "esimd emulator is no longer supported") = 5,
    ext_oneapi_hip = 6,
    ext_native_cpu = 7,
    };
    )?

Copy link
Contributor

Choose a reason for hiding this comment

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

What would happen if we'll have two vendors providing backends with the same name

Is your question about the enum class backend enumeration? Two vendors would have different "vendor strings" (e.g. ours is "oneapi"), so the enumerators would not collide.

Why doesn't native_cpu follow the naming convention required by the specification

This is a bug. @PietroGhg this should be named like ext_oneapi_native_cpu instead. Could you rename this? I'm not sure if you have existing users that might be depending on this symbol. If so, you can deprecate the old name and add a new one that is an alias like ext_oneapi_native_cpu = ext_native_cpu.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @gmlueck, sorry about this, we'll create a PR to fix it soon. We should be able to just rename it, thank you

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks @PietroGhg!

Copy link
Contributor

@al42and al42and Dec 15, 2023

Choose a reason for hiding this comment

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

I checked and the ONEAPI_DEVICE_SELECTOR environment variable accepts the string "level_zero" as the name of the backend. This is also what we show in the documentation.

I would like to voice a strong support for keeping the current behavior of the environment variable: accepting level_zero/cuda/hip without any prefixes. ONEAPI_* environment variables are already an implementation detail. Adding ext_oneapi_ in them won't add any clarity but will irritate users who has to type it.

That does not concern enum values in the code (as noted, the standard is clear how they should look like); if it is seen beneficial to allow setting ONEAPI_DEVICE_SELECTOR=ext_oneapi_level_zero:gpu, then I think that should be in addition to, not instead of, the current ONEAPI_DEVICE_SELECTOR=level_zero:gpu spelling.

getSyclDeviceTypeMap() {
static const std::array<std::pair<std::string, info::device_type>, 6>
SyclDeviceTypeMap = {{{"host", info::device_type::host},
Copy link
Contributor

Choose a reason for hiding this comment

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

The sycl_ext_oneapi_filter_selector still accepts "host" as device type and backend, so we can't remove it from here just yet.

Copy link
Contributor

Choose a reason for hiding this comment

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

can we just drop that from both? My understanding that even if the "host" is part of the extension, it cannot be selected because the support for the device itself has been dropped.

Copy link
Contributor

Choose a reason for hiding this comment

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

Problem is that the extension is supported, so we normally can't just change it out of the blue. Removing it might mean that filter_selector would start failing at construction with "host" input rather than on device selection.

@gmlueck | @jbrodman - Thoughts on this? We should probably write a new variant of this extension using SYCL 2020 device selector structure.

Copy link
Contributor

Choose a reason for hiding this comment

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

I also think it would be good to deprecate (and eventually remove) sycl_ext_oneapi_filter_selector, mostly because the input "filter" language doesn't match the language used by ONEAPI_DEVICE_SELECTOR. I think the structure of the selector is OK, though. Doesn't it already match the SYCL 2020 selector structure? As a comparison, see how the aspect_selector is structured.

Assuming we replace this with some new extension that uses the ONEAPI_DEVICE_SELECTOR language, we'd need some new name for the API. Suggestions are welcome.

Another option is to just deprecate / remove sycl_ext_oneapi_filter_selector without adding a replacement. Do we think this is an important extension that customers use?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I took back the host in both device type and backend. The "deprecate/remove sycl_ext_oneapi_filter_selector" job can be done separately from this environment variable removal.

@rolandschulz
Copy link
Contributor

Can we please add a diagnostic if the removed environment variables are used?

@eunakim0103
Copy link
Contributor Author

Can we please add a diagnostic if the removed environment variables are used?

Good idea. Will do.

@eunakim0103 eunakim0103 marked this pull request as ready for review November 28, 2023 16:57
@@ -14,9 +14,6 @@ inputs:
default: 'llvm_sycl.tar.zst'
decompress_command:
default: zstd
sycl_device_filter:
Copy link
Contributor

Choose a reason for hiding this comment

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

That removal shouldn't be done - it needs to be updated to the new filter instead. That said, I don't think our CI uses this and we should probably just drop the entire file/directory (possibly in a separate PR).

There is also some (currently unused) CTS support in https://github.com/intel/llvm/blob/sycl/.github/workflows/sycl_linux_run_tests.yml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's a point. We should probably open another ticket

@eunakim0103 eunakim0103 marked this pull request as draft November 30, 2023 01:35
std::cerr << "ESIMD EMU plugin error or not loaded - try setting "
"SYCL_DEVICE_FILTER=esimd_emulator:gpu environment variable"
<< std::endl;
#else
std::cerr << "ESIMD EMU plugin error or not loaded" << std::endl;
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

I would say we just remove the old print. I don't think we should suggest a deprecated env var even if it is still there.

Comment on lines +2 to +3
// RUN: env --unset=SYCL_DEVICE_FILTER --unset=ONEAPI_DEVICE_SELECTOR sycl-ls --verbose >%t.default.out
// RUN: %if preview-breaking-changes-supported %{ env --unset=ONEAPI_DEVICE_SELECTOR sycl-ls --verbose >%t.default.out %}
Copy link
Contributor

Choose a reason for hiding this comment

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

This new test case does not make sense to me. First of all, we simply overwrite the previous output file before we've even checked it. Second, the command that's run doesn't do anything special. I doubt we've built sycl-ls with the -fpreview-breaking-changes flag, so running it an extra time if that flag is supported adds nothing new to the test.

// RUN: env --unset=SYCL_DEVICE_FILTER --unset=ONEAPI_DEVICE_SELECTOR sycl-ls --verbose >%t.default.out
// RUN: %if preview-breaking-changes-supported %{ env --unset=ONEAPI_DEVICE_SELECTOR sycl-ls --verbose >%t.default.out %}
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as my other comment.

return device.is_gpu() ? 1000 : -1;
}
};
#endif //__INTEL_PREVIEW_BREAKING_CHANGES
Copy link
Contributor

Choose a reason for hiding this comment

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

ONEAPI_DEVICE_SELECTOR is available with or without breaking changes. Is there a reason we wouldn't just use it here instead of the deprecated one? In fact, we don't built this test with -fpreview-breaking-changes so the new branch is dead code.

In reality I don't even think it matters much. This test is compile-only so this selector really has no effect on whether the test passes or fails.

@@ -126,6 +127,7 @@ int main(int argc, char **argv) {
<< std::endl
<< std::endl;
}
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we build sycl-ls with -fpreview-breaking-changes ever, so there is really no point in masking this out now, other than maybe to remind us to remove it in the future.

@@ -1,5 +1,6 @@
// RUN: %clangxx -fsycl -fsycl-targets=%sycl_triple %s -o %t.out
// RUN: env SYCL_DEVICE_FILTER="" %t.out
// RUN: %if preview-breaking-changes-supported %{ env ONEAPI_DEVICE_SELECTOR="" %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.

This doesn't do anything different than line 2, except being dependent on the preview flag being available. Seems like it should be:

Suggested change
// RUN: %if preview-breaking-changes-supported %{ env ONEAPI_DEVICE_SELECTOR="" %t.out %}
// RUN: %if preview-breaking-changes-supported %{ %clangxx -fsycl -fsycl-targets=%sycl_triple -fpreview-breaking-changes %s -o %t_prev.out %}
// RUN: %if preview-breaking-changes-supported %{ env ONEAPI_DEVICE_SELECTOR="" %t_prev.out %}

@@ -2,12 +2,13 @@
// RUN: env SYCL_DEVICE_FILTER='*' %{run-unfiltered-devices} %t.out &> %t.log
// RUN: FileCheck %s < %t.log
//
// CHECK: WARNING: The enviroment variable SYCL_DEVICE_FILTER is deprecated.
// CHECK: WARNING: The enviroment variable SYCL_DEVICE_FILTER is removed.
Copy link
Contributor

Choose a reason for hiding this comment

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

Where does this warning come from? Originally it came from sycl/source/detail/config.hpp in the part that is now masked out by the preview macro, but I would expect it to still report "deprecated" in this test in its current form. I have no idea what it would say if you set -fpreview-breaking-changes in line 2, but I suspect it won't be this.

@@ -16,14 +17,14 @@
//===-----------------------------------------------------------------------------------------===//

// This test is to check if a warning message is displayed when using the
// enviroment variable SYCL_DEVICE_FILTER
// TODO: Remove test when SYCL_DEVICE_FILTER is removed
// enviroment variable SYCL_DEVICE_FILTERll
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// enviroment variable SYCL_DEVICE_FILTERll
// enviroment variable SYCL_DEVICE_FILTER.

Copy link
Contributor

This pull request is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be automatically closed in 30 days.

@github-actions github-actions bot added the Stale label Sep 13, 2024
Copy link
Contributor

This pull request was closed because it has been stalled for 30 days with no activity.

@github-actions github-actions bot closed this Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants