// // 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 "harness/compat.h" #include #include #include #include #include #include "harness/rounding_mode.h" #include "procs.h" static const char *global_linear_id_2d_code = "__kernel void test_global_linear_id_2d(global int *dst)\n" "{\n" " int tid_x = get_global_id(0);\n" " int tid_y = get_global_id(1);\n" "\n" " int linear_id = tid_y * get_global_size(0) + tid_x;\n" " int result = (linear_id == (int)get_global_linear_id()) ? 0x1 : 0x0;\n" " dst[linear_id] = result;\n" "}\n"; static const char *global_linear_id_1d_code = "__kernel void test_global_linear_id_1d(global int *dst)\n" "{\n" " int tid_x = get_global_id(0);\n" "\n" " int result = (tid_x == (int)get_global_linear_id()) ? 0x1 : 0x0;\n" " dst[tid_x] = result;\n" "}\n"; static int verify_global_linear_id(int *result, int n) { int i; for (i=0; i