[Mesa-dev] [PATCH] clover: clGetProgramInfo support for OpenCL 1.2

Francisco Jerez currojerez at riseup.net
Sat Aug 16 10:57:01 PDT 2014


EdB <edb+mesa at sigluy.net> writes:

> ---
>  src/gallium/state_trackers/clover/api/program.cpp | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/api/program.cpp b/src/gallium/state_trackers/clover/api/program.cpp
> index b81ce69..05f3840 100644
> --- a/src/gallium/state_trackers/clover/api/program.cpp
> +++ b/src/gallium/state_trackers/clover/api/program.cpp
> @@ -232,6 +232,24 @@ clGetProgramInfo(cl_program d_prog, cl_program_info param,
>           prog.devices());
>        break;
>  
> +   case CL_PROGRAM_NUM_KERNELS:
> +      buf.as_scalar<cl_uint>() = prog.symbols().size();
> +      break;
> +
> +   case CL_PROGRAM_KERNEL_NAMES: {
> +      std::string names;
> +      for (auto &symbol : prog.symbols()) {
> +         std::string name(symbol.name.begin(), symbol.name.size());
> +         name += ";";
> +         names += name;
> +      }
> +      if (!names.empty())
> +         names.pop_back(); //remove ';'
> +
> +      buf.as_string() = names;
> +      }
> +      break;
> +

How about we implement this using fold()?  It's quite a bit more
concise.  See attachment.

>     default:
>        throw error(CL_INVALID_VALUE);
>     }
> -- 
> 2.0.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

-------------- next part --------------
A non-text attachment was scrubbed...
Name: clover-cl12-get-program-info.patch
Type: text/x-diff
Size: 836 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140816/a3f2cd20/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140816/a3f2cd20/attachment.sig>


More information about the mesa-dev mailing list