| 636 | |
| 637 | |
| 638 | static void generate_kernel_args(cl_context context, cl_kernel kernel, const WorkSizeInfo& ws, KernelArgs& cl_args, const cl_device_id device) |
| 639 | { |
| 640 | int error = CL_SUCCESS; |
| 641 | cl_uint num_args = 0; |
| 642 | KernelArg* cl_arg = NULL; |
| 643 | DataGenerator* dg = DataGenerator::getInstance(); |
| 644 | |
| 645 | error = clGetKernelInfo( kernel, CL_KERNEL_NUM_ARGS, sizeof( num_args ), &num_args, NULL ); |
| 646 | if( error != CL_SUCCESS ) |
| 647 | { |
| 648 | throw Exceptions::TestError("Unable to get kernel arg count\n", error); |
| 649 | } |
| 650 | |
| 651 | for ( cl_uint j = 0; j < num_args; ++j ) |
| 652 | { |
| 653 | KernelArgInfo kernel_arg_info; |
| 654 | size_t size; |
| 655 | const int max_name_len = 512; |
| 656 | char name[max_name_len]; |
| 657 | |
| 658 | // Try to get the address qualifier of each argument. |
| 659 | error = clGetKernelArgInfo( kernel, j, CL_KERNEL_ARG_ADDRESS_QUALIFIER, sizeof(cl_kernel_arg_address_qualifier), kernel_arg_info.getAddressQualifierRef(), &size); |
| 660 | if( error != CL_SUCCESS ) |
| 661 | { |
| 662 | throw Exceptions::TestError("Unable to get argument address qualifier\n", error); |
| 663 | } |
| 664 | |
| 665 | // Try to get the access qualifier of each argument. |
| 666 | error = clGetKernelArgInfo( kernel, j, CL_KERNEL_ARG_ACCESS_QUALIFIER, sizeof(cl_kernel_arg_access_qualifier), kernel_arg_info.getAccessQualifierRef(), &size ); |
| 667 | if( error != CL_SUCCESS ) |
| 668 | { |
| 669 | throw Exceptions::TestError("Unable to get argument access qualifier\n", error); |
| 670 | } |
| 671 | |
| 672 | // Try to get the type qualifier of each argument. |
| 673 | error = clGetKernelArgInfo( kernel, j, CL_KERNEL_ARG_TYPE_QUALIFIER, sizeof(cl_kernel_arg_type_qualifier), kernel_arg_info.getTypeQualifierRef(), &size ); |
| 674 | if( error != CL_SUCCESS ) |
| 675 | { |
| 676 | throw Exceptions::TestError("Unable to get argument type qualifier\n", error); |
| 677 | } |
| 678 | |
| 679 | // Try to get the type of each argument. |
| 680 | memset( name, 0, max_name_len ); |
| 681 | error = clGetKernelArgInfo(kernel, j, CL_KERNEL_ARG_TYPE_NAME, max_name_len, name, NULL ); |
| 682 | if( error != CL_SUCCESS ) |
| 683 | { |
| 684 | throw Exceptions::TestError("Unable to get argument type name\n", error); |
| 685 | } |
| 686 | kernel_arg_info.setTypeName(name); |
| 687 | |
| 688 | // Try to get the name of each argument. |
| 689 | memset( name, 0, max_name_len ); |
| 690 | error = clGetKernelArgInfo( kernel, j, CL_KERNEL_ARG_NAME, max_name_len, name, NULL ); |
| 691 | if( error != CL_SUCCESS ) |
| 692 | { |
| 693 | throw Exceptions::TestError("Unable to get argument name\n", error); |
| 694 | } |
| 695 | kernel_arg_info.setName(name); |
no test coverage detected