Skip to content

Commit d9573ed

Browse files
committed
Rename kernels to kmain since main forbidden...
1 parent a13d85e commit d9573ed

15 files changed

+20
-17
lines changed

opencl/common.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void common_create_kernel(
7171
) {
7272
if (NULL != source) {
7373
common_create_program(common, source, options, &common->program);
74-
common->kernel = clCreateKernel(common->program, "main", NULL);
74+
common->kernel = clCreateKernel(common->program, "mymain", NULL);
7575
} else {
7676
common->kernel = NULL;
7777
common->program = NULL;

opencl/inc.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ int main(void) {
1919
const char *source =
2020
/* kernel pointer arguments must be __global, __constant, or __local. */
2121
/* https://www.khronos.org/registry/cl/sdk/2.1/docs/man/xhtml/restrictions.html */
22-
"__kernel void main(__global int *out) {\n"
22+
/**/
23+
/* Kernel functions cannot be called main... NVIDIA's compiler may allow that
24+
* but others don't, so don't do it. */
25+
"__kernel void kmain(__global int *out) {\n"
2326
" out[0]++;\n"
2427
"}\n";
2528
cl_command_queue command_queue;
@@ -37,7 +40,7 @@ int main(void) {
3740
context = clCreateContext(NULL, 1, &device, NULL, NULL, NULL);
3841
program = clCreateProgramWithSource(context, 1, &source, NULL, NULL);
3942
clBuildProgram(program, 1, &device, "", NULL, NULL);
40-
kernel = clCreateKernel(program, "main", NULL);
43+
kernel = clCreateKernel(program, "kmain", NULL);
4144
buffer = clCreateBuffer(context, CL_MEM_READ_WRITE | CL_MEM_COPY_HOST_PTR, sizeof(cl_int), &input, NULL);
4245
clSetKernelArg(kernel, 0, sizeof(buffer), &buffer);
4346
command_queue = clCreateCommandQueue(context, device, 0, NULL);

opencl/inc_vector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ it is just a clEnqueueNDRangeKernel + get_global_id hello world.
1313

1414
int main(int argc, char **argv) {
1515
const char *source =
16-
"__kernel void main(__global int *io) {\n"
16+
"__kernel void kmain(__global int *io) {\n"
1717
" io[get_global_id(0)]++;\n"
1818
"}\n";
1919
cl_int *io, *expected_output;

opencl/inc_vector_globals.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ API exercise, increment a vector with less global work groups than integers,
33
which forces us to put a for loop in the kernel.
44
55
I don't think we can get the size of each global work group from the kernel,
6-
so we just calculate it on CPU ans pass a sa parameter.
6+
so we just calculate it on CPU and pass as a parameter.
77
88
This is how the work will be split:
99
@@ -17,7 +17,7 @@ This is how the work will be split:
1717

1818
int main(void) {
1919
const char *source =
20-
"__kernel void main(uint group_nlems, __global int *out) {\n"
20+
"__kernel void kmain(uint group_nlems, __global int *out) {\n"
2121
" uint i_min = get_global_id(0) * group_nlems;\n"
2222
" uint i_max = i_min + group_nlems;\n"
2323
" for (uint i = i_min; i < i_max; ++i) {\n"

opencl/matmul.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__kernel void main(
1+
__kernel void kmain(
22
__global float *A,
33
__global float *B,
44
__global float *C,

opencl/matmul_block.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__kernel void main(
1+
__kernel void kmain(
22
__global const float* restrict A,
33
__global const float* restrict B,
44
__global float* restrict C,

opencl/matmul_row_local.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__kernel void main(
1+
__kernel void kmain(
22
__global float* A,
33
__global float* B,
44
__global float* C,

opencl/matmul_row_priv.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__kernel void main(
1+
__kernel void kmain(
22
__global float* A,
33
__global float* B,
44
__global float* C,

opencl/matmul_row_priv_col_local.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__kernel void main(
1+
__kernel void kmain(
22
__global float* A,
33
__global float* B,
44
__global float* C,

opencl/matmul_row_priv_cols_local.cl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__kernel void main(
1+
__kernel void kmain(
22
__global float* A,
33
__global float* B,
44
__global float* C,

0 commit comments

Comments
 (0)