KhronosGroup / KhronosGroup/SYCL-Docs

Placeholder behavior in SYCL kernel functions and host_task

Open
#368 2 comments 0 reactions 0 assignees View on GitHub
clarification
Dominant language
JavaScript
Stars
158
Forks
80
Avg merge
7d 6h
Merged PRs (30d)
5

Description

The exception thrown for passing a placeholder accessor to a command is described as:

> If a placeholder accessor is passed as an argument to a [command](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#command) without first being bound to a [command group](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#command-group) with handler::require(), the implementation throws a synchronous exception with the errc::kernel_argument error code when the [command](https://registry.khronos.org/SYCL/specs/sycl-2020/html/sycl-2020.html#command) is submitted.

Based on it it also follows that a `host_task` should throw an exception with `errc::kernel_argument` synchronously when being passed a placeholder accessor. This has the following issues:

1. It require introspection into the arguments captured or stored in a `host_task` function objects.
2. Throwing an exception with `errc::kernel_argument` from a `host_task` launch is potentially confusing, given a host task isn't considered a SYCL kernel function.

Suggested solution: Change the wording to specify that the above statement only applies to SYCL kernel functions. Additionally, clarify that operations useable inside a `host_task` that require non-placeholder accessors (e.g. `interop_handle::get_native_mem()`) throws a more appropriate exception during the execution of the host task function, which in turn would be an asynchronous exception.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the cited SYCL 2020 wording for placeholder accessors, commands, command groups, and host_task. Clarify that the synchronous kernel_argument behavior applies only to SYCL kernel functions, and document the more appropriate exception behavior for non-placeholder-only operations used during host_task execution.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.