Open tonikitoo opened 10 years ago
Concern noted, but I'm quite sure this is not the bottleneck in validator library's performance. One can check those arguments against strings just once per instrumented kernel. If kernel is called multiple times one does not have to keep on interpreting strings again.
Agreed. If string parsing really becomes a bottleneck, the results can be cached. Also, it's probably a good idea to align with clGetKernelArgInfo
which returns the type name as char[]
, see http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clGetKernelArgInfo.html.
// Get type of a kernel argument in the program CLV_API cl_int CLV_CALL clvGetKernelArgType( clv_program program, cl_uint kernel, cl_uint arg, size_t type_buf_size, char type_buf, size_t type_size_ret);
The above API is how to query the validator about specific kernel parameters' type. Its out parameter (type_buf) can be used by the WebCL implementation to compare what the program passes in with what the kernel declares.
Given that this should ideally be performed before clSetKernelArg make its way to OpenCL, it can add a non-zero performance overhead to the execution. That happens because kernels tend to have various parameters, and setArg is usually called from within a simulation loop. Having string comparisons there is undesired.
On MPB it has a noticeable difference in performance. On mobile, it must be greater.