Closed Bastacyclop closed 3 years ago
This didn't work, hitting an assertion:
depFun((n: Nat) => fun((n`.`i32) ->: (n`.`i32))(in => mapSeq(add(li32(2)))(in) |> store(x => oclRun(LocalSize(2), GlobalSize(n/2))(mapGlobal(add(li32(1)))(x))) ))
Now, it generates:
#include "ocl/ocl.h" struct foo_t { Kernel k0; }; typedef struct foo_t foo_t; void foo_init(Context ctx, foo_t* self){ (*self).k0 = loadKernel(ctx, k0); } void foo_destroy(Context ctx, foo_t* self){ destroyKernel(ctx, (*self).k0); } void foo_run(Context ctx, foo_t* self, Buffer moutput, int n1, Buffer me2){ { Buffer mx101 = createBuffer(ctx, n1 * sizeof(int32_t), HOST_WRITE | DEVICE_READ); { int32_t* x101 = (int32_t*)hostBufferSync(ctx, mx101, n1 * sizeof(int32_t), HOST_WRITE); int32_t* e2 = (int32_t*)hostBufferSync(ctx, me2, n1 * sizeof(int32_t), HOST_READ); /* mapSeq */ for (int i_110 = 0; i_110 < n1; i_110 = 1 + i_110) { x101[i_110] = ((int32_t)2) + e2[i_110]; } } { DeviceBuffer b0 = deviceBufferSync(ctx, moutput, n1 * sizeof(int32_t), DEVICE_WRITE); DeviceBuffer b2 = deviceBufferSync(ctx, mx101, n1 * sizeof(int32_t), DEVICE_READ); const size_t global_size[3] = (const size_t[3]){n1 / 2, 1, 1}; const size_t local_size[3] = (const size_t[3]){2, 1, 1}; const KernelArg args[3] = (const KernelArg[3]){KARG(b0), KARG(n1), KARG(b2)}; launchKernel(ctx, (*self).k0, global_size, local_size, 3, args); } destroyBuffer(ctx, mx101); } } void foo_init_run(Context ctx, Buffer moutput, int n1, Buffer me2){ foo_t foo; foo_init(ctx, &foo); foo_run(ctx, &foo, moutput, n1, me2); foo_destroy(ctx, &foo); }
However there seems to be another type of bug remaining. It looks like the "one_copy" buffer implementation is failing to produce the correct output.
This didn't work, hitting an assertion:
Now, it generates:
However there seems to be another type of bug remaining. It looks like the "one_copy" buffer implementation is failing to produce the correct output.