提交 ec5283b2 authored 作者: Arnaud Bergeron's avatar Arnaud Bergeron

Fetch the kernel name from the Kernel object in the c_code and document what Kernel represents.

上级 2c49663e
...@@ -62,6 +62,9 @@ class HideC(object): ...@@ -62,6 +62,9 @@ class HideC(object):
class Kernel(object): class Kernel(object):
"""
This class groups together all the attributes of a gpu kernel.
"""
def __init__(self, code, params, name, flags, def __init__(self, code, params, name, flags,
codevar=None, binvar=None, objvar=None): codevar=None, binvar=None, objvar=None):
self.code = code self.code = code
...@@ -833,7 +836,7 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) { ...@@ -833,7 +836,7 @@ KERNEL void k(GLOBAL_MEM %(ctype)s *a, ga_size n, ga_size m) {
fail = sub['fail'] fail = sub['fail']
typecode = pygpu.gpuarray.dtype_to_typecode(self.dtype) typecode = pygpu.gpuarray.dtype_to_typecode(self.dtype)
sync = bool(config.gpuarray.sync) sync = bool(config.gpuarray.sync)
kname = 'k_eye_'+name kname = self.gpu_kernels()[0].objvar
s = """ s = """
size_t dims[2] = {0, 0}; size_t dims[2] = {0, 0};
void *args[3]; void *args[3];
......
...@@ -867,8 +867,8 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base): ...@@ -867,8 +867,8 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
return [Kernel(code=code, name="mrg_uniform", return [Kernel(code=code, name="mrg_uniform",
params=[gpuarray.GpuArray, gpuarray.GpuArray, params=[gpuarray.GpuArray, gpuarray.GpuArray,
'uint32', 'uint32'], 'uint32', 'uint32'],
flags=Kernel.get_flags(self.output_type.dtype, 'int32'), flags=Kernel.get_flags(self.output_type.dtype, 'int32'))
objvar='k_mrg_uniform')] ]
def c_code(self, node, nodename, inp, out, sub): def c_code(self, node, nodename, inp, out, sub):
rstate, size = inp rstate, size = inp
...@@ -877,7 +877,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base): ...@@ -877,7 +877,7 @@ class GPUA_mrg_uniform(GpuKernelBase, mrg_uniform_base):
ndim = self.output_type.ndim ndim = self.output_type.ndim
o_type_num = numpy.asarray(0, dtype=self.output_type.dtype).dtype.num o_type_num = numpy.asarray(0, dtype=self.output_type.dtype).dtype.num
fail = sub['fail'] fail = sub['fail']
kname = 'k_mrg_uniform' kname = self.gpu_kernels()[0].objvar
if self.output_type.dtype == 'float32': if self.output_type.dtype == 'float32':
otype = 'float' otype = 'float'
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论