提交 5dc78876 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fix CGpuKernelBase test.

上级 0a91c7e1
#section kernels #section kernels
#kernel eye : *, size, size : #kernel eye : *, size, size, size :
/* The eye name will be used to generate supporting objects. The only /* The eye name will be used to generate supporting objects. The only
you probably need to care about is the kernel object which will be you probably need to care about is the kernel object which will be
named 'k_' + <the name above> (k_eye in this case). This name also named 'k_' + <the name above> (k_eye in this case). This name also
has to match the kernel function name below. has to match the kernel function name below.
*/ */
KERNEL void eye(GLOBAL_MEM DTYPE_OUTPUT_0 *a, ga_size n, ga_size m) { KERNEL void eye(GLOBAL_MEM DTYPE_OUTPUT_0 *a, ga_size a_off, ga_size n, ga_size m) {
a = (GLOBAL_MEM DTYPE_OUTPUT_0 *)(((char *)a) + a_off);
ga_size nb = n < m ? n : m; ga_size nb = n < m ? n : m;
for (ga_size i = LID_0; i < nb; i += LDIM_0) { for (ga_size i = LID_0; i < nb; i += LDIM_0) {
a[i*m + i] = 1; a[i*m + i] = 1;
...@@ -37,7 +38,7 @@ int APPLY_SPECIFIC(tstgpueye)(PyArrayObject *n, PyArrayObject *m, ...@@ -37,7 +38,7 @@ int APPLY_SPECIFIC(tstgpueye)(PyArrayObject *n, PyArrayObject *m,
ls = 1; ls = 1;
gs = 256; gs = 256;
/* The eye_call name comes from the kernel declaration above. */ /* The eye_call name comes from the kernel declaration above. */
err = eye_call(1, &gs, &ls, 0, (*z)->ga.data, dims[0], dims[1]); err = eye_call(1, &gs, &ls, 0, (*z)->ga.data, (*z)->ga.offset, dims[0], dims[1]);
if (err != GA_NO_ERROR) { if (err != GA_NO_ERROR) {
PyErr_Format(PyExc_RuntimeError, PyErr_Format(PyExc_RuntimeError,
"gpuarray error: kEye: %s. n%lu, m=%lu.", "gpuarray error: kEye: %s. n%lu, m=%lu.",
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论