// // Copyright (c) 2017 The Khronos Group Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // #include "procs.h" const char *kernel_call_kernel_code[] = { "void test_function_to_call(__global int *output, __global int *input, int where);\n" "\n" "__kernel void test_kernel_to_call(__global int *output, __global int *input, int where) \n" "{\n" " int b;\n" " if (where == 0) {\n" " output[get_global_id(0)] = 0;\n" " }\n" " for (b=0; b 10) continue; if (errors == 10) { log_error("Suppressing further results...\n"); continue; } log_error("Results do not match: output[%d]=%d != expected[%d]=%d\n", i, output[i], i, expected[i]); errors++; pass = 0; } } if (pass) log_info("Passed kernel calling kernel...\n"); // Test kernel calling a function log_info("Testing kernel calling function...\n"); // Reset the inputs for (int i=0; i 10) continue; if (errors > 10) { log_error("Suppressing further results...\n"); continue; } log_error("Results do not match: output[%d]=%d != expected[%d]=%d\n", i, output[i], i, expected[i]); errors++; pass = 0; } } if (pass) log_info("Passed kernel calling function...\n"); // Test calling the kernel we called from another kernel log_info("Testing calling the kernel we called from another kernel before...\n"); // Reset the inputs for (int i=0; i 10) continue; if (errors > 10) { log_error("Suppressing further results...\n"); continue; } log_error("Results do not match: output[%d]=%d != expected[%d]=%d\n", i, output[i], i, expected[i]); errors++; pass = 0; } } if (pass) log_info("Passed calling the kernel we called from another kernel before...\n"); free( input ); free( output ); free( expected ); return errors; }