-
Notifications
You must be signed in to change notification settings - Fork 769
Adding a test case for reqd_work_group_size using L0 backend. #2005
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
Conversation
Resolved issues test case discovered. Signed-off-by: Cory Levels <cory.levels@intel.com>
@@ -21,6 +21,35 @@ namespace detail { | |||
|
|||
namespace enqueue_kernel_launch { | |||
|
|||
bool L0HandleInvalidWorkGroupSize(const device_impl &DeviceImpl, |
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.
There should be no L0-specifc in this checking, it should be covered by PI API. Can you combine this with oclHandleInvalidWorkGroupSize
into just HandleInvalidWorkGroupSize
?
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.
Hi Sergey, could you please see this section here https://github.com/intel/llvm/pull/1998/files#diff-5b57d29ae1eb53bd221ca97692974846R48? I think that is valid for L0 and should be added here.
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.
Hi @smaslov-intel , If you look at the current function L0HandleInvalidWorkGroupSize
10000
code> the code is doing the same thing as a couple parts of
oclHandleInvalidWorkGroupSize
. So agreed they should be combined. I spoke to Rehana offline and we discussed renaming oclHandleInvalidWorkGroupSize
to the generic HandleInvalidWorkGroupSize
and just adding conditional statements if (PlatformName.find("OpenCL") != std::string::npos)
around all the checks that are openCL specific. Would this be the best approach?
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.
Probably, yes. I'd still want to see if any backend specifics can be hidden under PI, so that those specifics are implemented in the relevant plugins not in in SYCL RT.
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.
LGTM
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.
LGTM
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.
LGTM
|
||
size_t VerSize = 0; | ||
Plugin.call<PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_VERSION, 0, | ||
nullptr, &VerSize); | ||
assert(VerSize >= 10 && | ||
"Unexpected device version string"); // strlen("OpenCL X.Y") | ||
if (Platform.get_backend() == cl::sycl::backend::opencl) { |
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 expected SYCL runtime to performs back-end agnostic checks only, so parsing OpenCL version in this file doesn't seem right to me.
Shouldn't we sink most of these error checks into corresponding plug-ins?
throw sycl::nd_range_error( | ||
"Total number of work-items in a work-group cannot exceed " | ||
"info::kernel_work_group::work_group_size which is equal to " + | ||
std::to_string(KernelWGSize) + " for this kernel", |
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.
"for this kernel" doesn't help if I have more than one. I suggest adding a kernel name to the message.
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.
Note, however, that:
-
Kernels do not always have a name that is meaningful to the user since the
KernelName
template parameter is optional as of SYCL 2020 provisional. -
The exception is thrown synchronously when submitting a kernel, so the problematic kernel should be clear if the application uses try/catch around the code that submits the kernel.
Adding the name of the kernel to the exception string does seem reasonable in the case where the user specified a name. If we decide to do that, we should do it uniformly for all the exceptions diagnosed in this function, not just for this one exception.
@@ -0,0 +1,109 @@ | |||
// XFAIL: cuda || opencl |
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.
There were changes in opencl specific code, so I suggest validate opencl back-end as well.
I think it better to use unittest framework with mocking API.
Co-authored-by: Alexey Bader <alexey.bader@intel.com>
Co-authored-by: Alexey Bader <alexey.bader@intel.com>
Co-authored-by: Alexey Bader <alexey.bader@intel.com>
Co-authored-by: Alexey Bader <alexey.bader@intel.com>
Co-authored-by: Alexey Bader <alexey.bader@intel.com>
Co-authored-by: smaslov-intel <48694368+smaslov-intel@users.noreply.github.com>
@clevels and I agreed to address the rest of the comments in follow-up PRs. |
return 1; | ||
} | ||
|
||
// Positive test-cases that should pass on any underlying OpenCL runtime |
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.
This test case is not specific to OpenCL, so I would change this comment to something like: "... that should pass on any backend".
if (Platform.get_backend() == cl::sycl::backend::opencl) { | ||
assert(VerSize >= 10 && | ||
"Unexpected device version string"); // strlen("OpenCL X.Y") | ||
} | ||
string_class VerStr(VerSize, '\0'); | ||
Plugin.call<PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_VERSION, | ||
VerSize, &VerStr.front(), nullptr); |
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.
This comment applies to the entire block of code:
size_t VerSize = 0;
Plugin.call<PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_VERSION, 0,
nullptr, &VerSize);
if (Platform.get_backend() == cl::sycl::backend::opencl) {
assert(VerSize >= 10 &&
"Unexpected device version string"); // strlen("OpenCL X.Y")
}
string_class VerStr(VerSize, '\0');
Plugin.call<PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_VERSION,
VerSize, &VerStr.front(), nullptr);
const char *Ver = &VerStr[7]; // strlen("OpenCL ")
There are two problems here:
- The
Ver
pointer could point to uninitialized memory when the backend is not OpenCL. - The name of the
Ver
variable should indicate that it is specific to OpenCL.
It would also be nice to include a comment, so readers understand why you are getting the version only for OpenCL.
I'd suggest rewriting the code to follow this form:
// Some of the error handling below is special for particular OpenCL versions.
// If this is an OpenCL backend, get the version.
const char *OpenClVer = nullptr;
string_class OpenClVerStr;
if (Platform.get_backend() == cl::sycl::backend::opencl) {
size_t OclVerSize = 0;
Plugin.call<PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_VERSION, 0,
nullptr, &OclVerSize);
assert(VerSize >= 10 &&
"Unexpected device version string"); // strlen("OpenCL X.Y")
OpenClVerStr.assign(OclVerSize, '\0');
Plugin.call<PiApiKind::piDeviceGetInfo>(Device, PI_DEVICE_INFO_VERSION,
OclVerSize, &OpenClVerStr.front(), nullptr);
OpenClVer = &OpenClVerStr[7]; // strlen("OpenCL ")
}
"OpenCL 1.x and 2.0 requires to pass local size argument even if " | ||
"required work-group size was specified in the program source", | ||
PI_INVALID_WORK_GROUP_SIZE); | ||
} | ||
// Any OpenCL version: |
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.
This error check is not specific to OpenCL, so remove this part of the comment.
std::to_string(MaxWGSize), | ||
PI_INVALID_WORK_GROUP_SIZE); | ||
} else { | ||
// RELEVENT // OpenCL 2.x: |
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 see you added the word "RELEVANT" to this comment. Was that a note to yourself indicating that this arm of the if
statement was relevant to L0 (non-OpenCL backends)? If so, I think you should either change the code like this:
if (Platform.get_backend() == cl::sycl::backend::opencl && OpenClVer[0] == '1') {
// Do the first check
}
else {
// Do the second check
}
Or, if you are planning to do this as part of a subsequent PR, add a more informative TODO comment indicating what needs to be done.
} | ||
} | ||
throw sycl::nd_range_error( | ||
"Non-uniform work-groups are not supported by the target device", | ||
PI_INVALID_WORK_GROUP_SIZE); | ||
} |
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.
All of the checks above are done only for the OpenCL backend. I presume something is needed for the other backends too? If so, I'd recommend at least adding a TODO comment to that effect:
}
else {
// TODO: Similar checks should be done for the non-OpenCL backends.
}
Here, the else
should match the if (Platform.get_backend() == cl::sycl::backend::opencl)
on line 143.
Currently only to DebugInfo/X86 Currently failing tests can be noticed by RUNx line Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com> Original commit: KhronosGroup/SPIRV-LLVM-Translator@772c7be
Currently only to DebugInfo/X86 Currently failing tests can be noticed by RUNx line Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com> Original commit: KhronosGroup/SPIRV-LLVM-Translator@772c7be
Currently only to DebugInfo/X86 Currently failing tests can be noticed by RUNx line Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com> Original commit: KhronosGroup/SPIRV-LLVM-Translator@772c7be
Currently only to DebugInfo/X86 Currently failing tests can be noticed by RUNx line Signed-off-by: Sidorov, Dmitry <dmitry.sidorov@intel.com> Original commit: KhronosGroup/SPIRV-LLVM-Translator@772c7be
Resolved issues test case discovered.
Signed-off-by: Cory Levels cory.levels@intel.com