[tests] Fix for permutation_iterator tests with transform_iterator index #1489
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR should fix the
permutation_iterator
tests withtransform_iterator
as index. In practice, without this PR, errors only appear on Windows platforms, however it may not be limited to windows.The SYCL spec requires that template arguments (captures) to lambda functions submitted as sycl kernels must be included in the kernel name and must be "forward declarable at namespace scope".
https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#sec:interfaces.kernels.as.lambdas
When we use a functor in a
transform_iterator
which is then used as index for apermutation_iterator
, the type of the resulting range must be forward declarable at namespace scope as it is used in the reduce kernel as an input capture to the lambda sycl kernel. When we define the functor within a function's scope, rather than within the structure's scope, we lose this, and end up with an invalid kernel name. This PR simply moves the functor definition to a scope which makes it forward declarable at namespace scope.On windows, it seems that this results in an exception when attempting to call the kernel:
"No kernel named was found -46 (PI_ERROR_INVALID_KERNEL_NAME)"