Skip to content

[SYCL] Additional support for SYCL_DEVICE_ALLOWLIST #2483

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 9 commits into from
Oct 1, 2020

Conversation

glyons-intel
Copy link
Contributor

@glyons-intel glyons-intel commented Sep 16, 2020

[SYCL] Additional support for SYCL_DEVICE_ALLOWLIST

Fixed a memory issue, where memory had not been allocated properly. This caused a seg fault.
Refactored from a C-style to a C++ style.
Created a test case which tests both legal and illegal uses.
Updated the documentation.

Added support for the case where multiple devices or
platforms are listed in SYCL_DEVICE_ALLOWLIST.
Also fixed a memory issue.
Created a test case which tests both legal and illegal uses.
Updated the documentation.

Signed-off-by: Gail Lyons <[email protected]>
@glyons-intel glyons-intel requested review from kbobrovs, pvchupin and a team as code owners September 16, 2020 20:25
@glyons-intel glyons-intel changed the title Glyons/allowlist [SYCL] Additional support for SYCL_DEVICE_ALLOWLIST #2483 Sep 16, 2020
@glyons-intel glyons-intel changed the title [SYCL] Additional support for SYCL_DEVICE_ALLOWLIST #2483 [SYCL] Additional support for SYCL_DEVICE_ALLOWLIST Sep 16, 2020
pvchupin
pvchupin previously approved these changes Sep 17, 2020
Copy link
Contributor

@pvchupin pvchupin left a comment

Choose a reason for hiding this comment

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

doc changes ok

Copy link
Contributor

@s-kanaev s-kanaev left a comment

Choose a reason for hiding this comment

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

I didn't take a look at the test yet. Though, I have some comments.

@romanovvlad
Copy link
Contributor

romanovvlad commented Sep 17, 2020

[SYCL] Additional support for SYCL_DEVICE_ALLOWLIST

Added support for the case where multiple devices or
platforms are listed in SYCL_DEVICE_ALLOWLIST.
Also fixed a memory issue.
Created a test case which tests both legal and illegal uses.
Updated the documentation.

@glyons-intel
Could you please elaborate more on "case where multiple devices or platforms are listed"? Could you please provide an example which doesn't work? Also could you please provide more details about memory issue which is being fixed?

@@ -22,7 +22,7 @@ subject to change. Do not rely on these variables in production code.
| SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP | Any(\*) | Disable cleanup of finished command nodes at host-device synchronization points. |
| SYCL_THROW_ON_BLOCK | Any(\*) | Throw an exception on attempt to wait for a blocked command. |
| SYCL_DEVICELIB_INHIBIT_NATIVE | String of device library extensions (separated by a whitespace) | Do not rely on device native support for devicelib extensions listed in this option. |
| SYCL_DEVICE_ALLOWLIST | A list of devices and their minimum driver version following the pattern: DeviceName:{{XXX}},DriverVersion:{{X.Y.Z.W}}. Also may contain PlatformName and PlatformVersion | Filter out devices that do not match the pattern specified. Regular expression can be passed and the DPC++ runtime will select only those devices which satisfy the regex. |
| SYCL_DEVICE_ALLOWLIST | A list of devices and their minimum driver version following the pattern: DeviceName:{{XXX}},DriverVersion:{{X.Y.Z.W}}. Also may contain PlatformName and PlatformVersion | Filter out devices that do not match the pattern specified. Regular expression can be passed and the DPC++ runtime will select only those devices which satisfy the regex. Note that the device name, platform name and platform version are regular expressions. Special characters, such as parenthesis, must be escaped. The device driver version is treated as 4 regular expressions, separated by ".". More than one device can be specified using "|".|
Copy link
Contributor

Choose a reason for hiding this comment

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

The device driver version is treated as 4 regular expressions, separated by "."

does this mean '.' cannot be used in the regexp? Please add.

decDescs.emplace_back();
else if (',' != *str)
throw sycl::runtime_error("Malformed device allowlist", PI_INVALID_VALUE);
MatchState matchVersions(std::string Version1, std::string Version2) {
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT: does it make sense to move matching-related code to a separate source, to avoid clutter?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does not look like this in the source. The diff makes it looks confusing. Between the pink and the green, getAllowListDesc() ends in the normal way, and there is the convertVersionString() function . Then we find matchVersions().

Comment on lines 246 to 248
if (V1.size() != V2.size()) {
return MatchState::NOMATCH;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, why is that?
Unspecified version elements may be set as zero. I.e. if user specifies major version only, then we can say that minor and patch version numbers are specified as zero so we still will match 3 and 3.1.10.4.

@romanovvlad what do you think about it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Excellent point. We could be more flexible, and only worry about matching the fields that are listed. That had not occurred to me.

@romanovvlad, what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed to have an offline discussion.

int count = 0;
for (const auto &plt : platform::get_platforms()) {
if (!plt.has(aspect::host)) {
for (const auto &dev : plt.get_devices()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We may not have a machine with multiple GPUs in our testing infrastructure. Hence, there is a need to make sure that proper scenario is still produced.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point.

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 tested this, and it works fine.

s-kanaev
s-kanaev previously approved these changes Sep 30, 2020
Copy link
Contributor

@s-kanaev s-kanaev left a comment

Choose a reason for hiding this comment

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

RT and tests LGTM

@s-kanaev
Copy link
Contributor

@kbobrovs, @pvchupin, please, take a look at modified documentation.

@s-kanaev
Copy link
Contributor

/summary:run

@@ -22,7 +22,7 @@ subject to change. Do not rely on these variables in production code.
| SYCL_DISABLE_EXECUTION_GRAPH_CLEANUP | Any(\*) | Disable cleanup of finished command nodes at host-device synchronization points. |
| SYCL_THROW_ON_BLOCK | Any(\*) | Throw an exception on attempt to wait for a blocked command. |
| SYCL_DEVICELIB_INHIBIT_NATIVE | String of device library extensions (separated by a whitespace) | Do not rely on device native support for devicelib extensions listed in this option. |
| SYCL_DEVICE_ALLOWLIST | A list of devices and their minimum driver version following the pattern: DeviceName:{{XXX}},DriverVersion:{{X.Y.Z.W}}. Also may contain PlatformName and PlatformVersion | Filter out devices that do not match the pattern specified. Regular expression can be passed and the DPC++ runtime will select only those devices which satisfy the regex. |
| SYCL_DEVICE_ALLOWLIST | A list of devices and their driver version following the pattern: DeviceName:{{XXX}},DriverVersion:{{X.Y.Z.W}}. Also may contain PlatformName and PlatformVersion | Filter out devices that do not match the pattern specified. Regular expression can be passed and the DPC++ runtime will select only those devices which satisfy the regex. Special characters, such as parenthesis, must be escaped. More than one device can be specified using the piping symbol "|".|
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
| SYCL_DEVICE_ALLOWLIST | A list of devices and their driver version following the pattern: DeviceName:{{XXX}},DriverVersion:{{X.Y.Z.W}}. Also may contain PlatformName and PlatformVersion | Filter out devices that do not match the pattern specified. Regular expression can be passed and the DPC++ runtime will select only those devices which satisfy the regex. Special characters, such as parenthesis, must be escaped. More than one device can be specified using the piping symbol "|".|
| SYCL_DEVICE_ALLOWLIST | A list of devices and their driver version following the pattern: DeviceName:{{XXX}},DriverVersion:{{X.Y.Z.W}}. Also may contain PlatformName and PlatformVersion | Filter out devices that do not match the pattern specified. Regular expression can be passed and the DPC++ runtime will select only those devices which satisfy the regex. Special characters, such as parenthesis, must be escaped. More than one device can be specified using the piping symbol "\|".|

escape required for pipe to visualize properly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks for catching this.

@s-kanaev
Copy link
Contributor

s-kanaev commented Oct 1, 2020

/summary:run

@bader bader merged commit dbf31c3 into intel:sycl Oct 1, 2020
@glyons-intel glyons-intel deleted the glyons/allowlist branch October 1, 2020 13:43
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Oct 5, 2020
…_wrapper

* upstream/sycl: (1021 commits)
  [SYCL] Enable async_work_group_copy for scalar and vector bool types (intel#2582)
  [SYCL] Fix element type in handler::copy (intel#2590)
  [NFC][SYCL] Remove unnecessary if condition (intel#2585)
  [SYCL][NFC] Fix SYCL lit test execution on a system w/o GPU (intel#2584)
  [SYCL] Add error handling for non-uniform work group size case (intel#2569)
  [SYCL][ESIMD] Preserve undef initializer for globals in ESIMDLowerVecArg pass (intel#2555)
  [SYCL] Make Level-Zero events visible on the host (intel#2576)
  [Driver][SYCL][NFC] Add help information for -Wno-sycl-strict (intel#2570)
  [SYCL] Relax test to work in Win32 environment. (intel#2580)
  [SYCL] Emit suppressed warnings from SYCL headers (intel#2575)
  [SYCL][NFC] Cover more classes with ABI tests (intel#2577)
  [SYCL][ESIMD] Update ESIMD tests and add raw send support. (intel#2482)
  [SYCL] Make ESIMD on-device tests require linux,gpu,opencl. (intel#2560)
  [SYCL] Release commands with no dependencies after they're enqueued (intel#2492)
  [SYCL] Add multi-device and multi-platform support for SYCL_DEVICE_ALLOWLIST  (intel#2483)
  [SYCL] Try to enqueue host command depencies (intel#2561)
  [SYCL][ESIMD][NFC] Align namespace name with the spec guidelines (intel#2573)
  [SYCL][NFC] Add class layout ABI tests for memory objects (intel#2559)
  [SYCL] Change adress space for global variables (intel#2534)
  [NFC][SYCL] Fix comment. (intel#2541)
  ...
iclsrc pushed a commit that referenced this pull request Apr 11, 2024
Update a test after llvm-project commit 379628d ("[RemoveDIs] Add
flag to preserve the debug info format of input IR (#87379)",
2024-04-05).

Original commit:
KhronosGroup/SPIRV-LLVM-Translator@cf64d9a98402d8f
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.

6 participants