-
Notifications
You must be signed in to change notification settings - Fork 738
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
[SYCL] Add '--ignore-device-selectors' CLI option to sycl-ls and improve warning messages #12718
Conversation
sycl/tools/sycl-ls/sycl-ls.cpp
Outdated
} else { | ||
// Parse CLI options. | ||
for (int i = 1; i < argc; i++) { | ||
if (std::string(argv[i]) == "--verbose") |
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.
I'd do
using namespace std::literals;
if (argv[i] == "--verbose"sv)
instead.
sycl/test/tools/sycl-ls.test
Outdated
@@ -1,3 +1,18 @@ | |||
-- Check that sycl-ls exits with 0 exit code. | |||
-- Check that sycl-ls exits with 0 exit code. |
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.
That's slightly inaccurate - you're verifying the output as well.
sycl/tools/sycl-ls/sycl-ls.cpp
Outdated
// Restore filter related environment variables that we unset earlier. | ||
static void restoreFilterEnvVars() { | ||
for (auto it : FilterEnvVars) { | ||
#ifdef _WIN32 | ||
_putenv_s(it.first.c_str(), it.second.c_str()); | ||
#else | ||
setenv(it.first.c_str(), it.second.c_str(), 1); | ||
#endif | ||
} | ||
} |
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.
I don't think we need to do that.
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.
IIUC, setenv is not supported by MSVC and that's why I used _putenv_s for windows. Some other tests also use a similar approach: https://github.com/intel/llvm/blob/sycl/sycl/include/sycl/ext/intel/fpga_device_selector.hpp#L38
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.
What I meant is we don't need to restore at all. sycl-ls
process is going to die anywhere and its environment won't affect anyone.
if (argc == 1) { | ||
verbose = false; | ||
DiscardFilters = false; | ||
} else { |
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.
Do we use any command line options parsing libraries anywhere in sycl?
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.
We do use LLVM's CLI support (https://llvm.org/docs/CommandLine.html) at a couple of places but I'm not sure if we should use that here because we just have two CLI options for sycl-ls and both of them are just boolean flags.
Do we really need this option? Why not just modify sycl-ls so that's what it always does? ( ie. always shows all the devices, regardless of the filter). If there are real use cases for using |
I mostly agree with that. My only concern with changing the default behavior of sycl-ls is that it might be ABI-breaking (is it?), if we have any customer application using ONEAPI_DEVICE_SELECTOR or SYCL_DEVICE_ALLOWLIST along with sycl-ls. |
It would probably be safer to wait until a major release before changing the default behavior. I think our plan is to move the handling of ONEAPI_DEVICE_SELECTOR into the unified runtime at some point, and I think the unified runtime will provide two APIs: one that retrieves the filtered device list and another that retrieves the unfiltered list. When that happens, sycl-ls can use the new API to get the unfiltered list. Be careful with documenting this option. I presume sycl-ls will always respect Level Zero environment variables like ZE_AFFINITY_MASK, and some people might consider this a "filter". |
@cperkinsintel The only thing changed since your last review is re-naming of "--discard-filters" to "--ignore-device-selectors". The failure in pre-commit on Windows is unrelated: it looks like a driver issue on our runners. I've seen similar failures on other PRs as well: https://github.com/intel/llvm/actions/runs/7995620747/job/21837754530 |
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.
lets go to mars!
@intel/llvm-gatekeepers the PR is ready! |
Windows Gen12:
|
This PR adds a '--ignore-device-selectors' CLI option to sycl-ls that prints all platforms available in the user's system, irrespective of the DPCPP filter environment variables like ONEAPI_DEVICE_SELECTOR.