// // 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 "../../test_common/harness/compat.h" #include #include #include #include #include #include "procs.h" const char *int_add_kernel_code = "__kernel void test_int_add(__global int *srcA, __global int *srcB, __global int *dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" " dst[tid] = srcA[tid] + srcB[tid];\n" "}\n"; const char *int_sub_kernel_code = "__kernel void test_int_sub(__global int *srcA, __global int *srcB, __global int *dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" " dst[tid] = srcA[tid] - srcB[tid];\n" "}\n"; const char *int_mul_kernel_code = "__kernel void test_int_mul(__global int *srcA, __global int *srcB, __global int *dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" " dst[tid] = srcA[tid] * srcB[tid];\n" "}\n"; const char *int_mad_kernel_code = "__kernel void test_int_mad(__global int *srcA, __global int *srcB, __global int *srcC, __global int *dst)\n" "{\n" " int tid = get_global_id(0);\n" "\n" " dst[tid] = srcA[tid] * srcB[tid] + srcC[tid];\n" "}\n"; static const float MAX_ERR = 1e-5f; int verify_int_add(int *inptrA, int *inptrB, int *outptr, int n) { int r; int i; for (i=0; i