[Mesa-dev] [PATCH] clover: Return 0 as storage size for local kernel args that are not set
Francisco Jerez
currojerez at riseup.net
Sat Mar 21 09:01:23 PDT 2015
Jan Vesely <jan.vesely at rutgers.edu> writes:
> On Sat, 2015-03-21 at 14:57 +0200, Francisco Jerez wrote:
>> Jan Vesely <jan.vesely at rutgers.edu> writes:
>>
>> > On Fri, 2015-03-20 at 23:29 +0000, Tom Stellard wrote:
>> >> The storage size for local kernel args can be queried before the
>> >> arguments are set by using the CL_KERNEL_LOCAL_MEM_SIZE param
>> >> of clGetKernelWorkGroupInfo().
>> >>
>> >> The spec says that if local kernel arguments have not been specified,
>> >> then we should assume their size is 0.
>> >> ---
>> >> src/gallium/state_trackers/clover/core/kernel.cpp | 2 ++
>> >> 1 file changed, 2 insertions(+)
>> >>
>> >> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp
>> >> index 442762c..f4f8616 100644
>> >> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
>> >> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
>> >> @@ -399,6 +399,8 @@ kernel::global_argument::unbind(exec_context &ctx) {
>> >>
>> >> size_t
>> >> kernel::local_argument::storage() const {
>> >> + if (!_set)
>> >> + return 0;
>> >
>> > Shouldn't _storage be 0 before anybody calls local_argument::set anyway?
>> > maybe initializing it in a constructor would suffice?
>> >
>> Yes, the local_argument class could really use a constructor.
>
> Not sure what the rules on using C++11 features are, but we could also
> use member initialization.
> in kernel.hpp:
>
> - size_t _storage;
> + size_t _storage = 0;
>
Yes, that would be a fine solution, probably less typing than defining
the constructor explicitly.
> jan
>
>>
>> > jan
>> >
>> >> return _storage;
>> >> }
>> >>
>> >
>> >
>> > --
>> > Jan Vesely <jan.vesely at rutgers.edu>
>> > _______________________________________________
>> > mesa-dev mailing list
>> > mesa-dev at lists.freedesktop.org
>> > http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
>
> --
> Jan Vesely <jan.vesely at rutgers.edu>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150321/bf38b861/attachment.sig>
More information about the mesa-dev
mailing list