-
Notifications
You must be signed in to change notification settings - Fork 67
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
Should accessors created from a command group handler throw if passed empty buffers? #408
Comments
|
There's several cases here that we should consider:
I think that cases 2. and 3. should have the same behavior, either both throw or none throws. Ideally, the three cases should have the same behavior. However, I don't see an easy way to differentiate when an accessor is empty because the buffer is empty, or because there is no buffer at all (default constructor). |
My guess is that we intended to say that
Is it hard for the implementation to differentiate between a default-constructed accessor and other empty accessors? |
I don't think it is, no. Worst case scenario would be having to add a bool to mark default-constructed cases, but probably we already have enough information to differentiate. |
Thinking about the default-constructed accessor some more, it seems weird that we say "A default constructed accessor can be passed to a SYCL kernel function":
Since a default-constructed accessor isn't associated with a |
The previous wording caused some confusion about whether a default constructed `accessor` is a placeholder. In general, the accessor constructors that do not take a `handler` parameter construct placeholder accessors, which could give the impression that the default constructed accessor is a placeholder. Clarify this by specifically stating that the default constructed accessor is not a placeholder and that it may be passed as a kernel parameter without calling `handler::require`. The default constructed `accessor` and the default constructed `local_accessor` are similar because they can both be passed as kernel parameters and neither allocates any memory for use in the kernel. Adjust the wording for these two constructors to be more similar. Remove wording from `handler::require` saying that it is an error to call this function for a zero sized accessor. We allow non-placeholder accessor that are zero sized, so it makes no sense to disallow this for placeholder accessors. Remove wording from the default `accessor` constructor saying that it is an error to pass such an accessor to `handler::require`. We allow other non-placeholder accessors to be passed to `handler::require`, so it makes sense to allow this for the default constructed accessor too. Clarify the wording for `accessor::is_placeholder`. The previous wording "if the accessor was constructed as a placeholder" caused confusion. What if an accessor was constructed as a placeholder and then later assigned to a non-placeholder accessor (or swapped to a non-placeholder accessor)? Presumably, we want `is_placeholder` to return `false` in such a case. The new wording removes this confusing phrasing. Closes KhronosGroup#408.
Here's how I think we should resolve these issues:
See my proposed wording in #434. |
Clarify default constructed accessor and "require". The previous wording caused some confusion about whether a default constructed accessor is a placeholder. In general, the accessor constructors that do not take a handler parameter construct placeholder accessors, which could give the impression that the default constructed accessor is a placeholder. Clarify this by specifically stating that the default constructed accessor is not a placeholder and that it may be passed as a kernel parameter without calling handler::require. The default constructed accessor and the default constructed local_accessor are similar because they can both be passed as kernel parameters and neither allocates any memory for use in the kernel. Adjust the wording for these two constructors to be more similar. Remove wording from handler::require saying that it is an error to call this function for a zero sized accessor. We allow non-placeholder accessor that are zero sized, so it makes no sense to disallow this for placeholder accessors. Remove wording from the default accessor constructor saying that it is an error to pass such an accessor to handler::require. We allow other non-placeholder accessors to be passed to handler::require, so it makes sense to allow this for the default constructed accessor too. Clarify the wording for accessor::is_placeholder. The previous wording "if the accessor was constructed as a placeholder" caused confusion. What if an accessor was constructed as a placeholder and then later assigned to a non-placeholder accessor (or swapped to a non-placeholder accessor)? Presumably, we want is_placeholder to return false in such a case. The new wording removes this confusing phrasing. Closes #408.
Following the resolution of KhronosGroup/SYCL-Docs#408 with KhronosGroup/SYCL-Docs#434 DPC++ has been changed to not throw for empty accessors. As such, the test cases using check_zero_length_buffer_constructor can now be enabled. Signed-off-by: Larsen, Steffen <steffen.larsen@intel.com>
Clarify default constructed accessor and "require". The previous wording caused some confusion about whether a default constructed accessor is a placeholder. In general, the accessor constructors that do not take a handler parameter construct placeholder accessors, which could give the impression that the default constructed accessor is a placeholder. Clarify this by specifically stating that the default constructed accessor is not a placeholder and that it may be passed as a kernel parameter without calling handler::require. The default constructed accessor and the default constructed local_accessor are similar because they can both be passed as kernel parameters and neither allocates any memory for use in the kernel. Adjust the wording for these two constructors to be more similar. Remove wording from handler::require saying that it is an error to call this function for a zero sized accessor. We allow non-placeholder accessor that are zero sized, so it makes no sense to disallow this for placeholder accessors. Remove wording from the default accessor constructor saying that it is an error to pass such an accessor to handler::require. We allow other non-placeholder accessors to be passed to handler::require, so it makes sense to allow this for the default constructed accessor too. Clarify the wording for accessor::is_placeholder. The previous wording "if the accessor was constructed as a placeholder" caused confusion. What if an accessor was constructed as a placeholder and then later assigned to a non-placeholder accessor (or swapped to a non-placeholder accessor)? Presumably, we want is_placeholder to return false in such a case. The new wording removes this confusing phrasing. Closes #408.
According to Table 131,
require
throws an exception if(acc.empty() == true)
. However, another way of creating a requirement is directly creating an accessor from a command group handler, as described in 4.9.4.1:If an accessor created from a command group handler is passed and empty buffer, should it throw an exception too?
The text was updated successfully, but these errors were encountered: