Use fusion target function name as kernel name
@@ -37,12 +37,6 @@ class FusionOp(object):
return "<FusionOp, name={}, types=[{}]>".format(
self.name, ', '.join(_.name for _ in self.types))
- def build_kernel_name(self):
- return self.name + '_' + '_'.join([
- 'IN_' + '_'.join(build_kernel_name(_) for _ in self.in_vars),
- 'OUT_' + '_'.join(build_kernel_name(_) for _ in self.out_vars),
- ])
-
class _FusionVar(object):
@@ -55,9 +49,6 @@ class _FusionVar(object):
return "<_FusionVar, num={}, ty={}, const={}>".format(
self.num, self.ty, self.const)
- def build_kernel_name(self):
- return self.ty.name + '_at' + str(self.num)
-
class _FusionMem(object):
@@ -94,9 +85,6 @@ class _FusionRef(object):
def __repr__(self):
return "<_FusionRef, dtype=%s>" % self.dtype
- def build_kernel_name(self):
- return build_kernel_name(self._var)
-
def __neg__(self):
return negative(self)
@@ -498,7 +486,7 @@ def _get_fix_code(data_type, fixed_type, operation):
return module_code
-def _get_fusion(func, nin, reduce, post_map, identity, input_types, name=None):
+def _get_fusion(func, nin, reduce, post_map, identity, input_types, name):
in_vars = [_FusionVar(i, t) for i, t in enumerate(input_types)]
mem = _FusionMem(in_vars)
in_refs = [_FusionRef(_, mem) for _ in in_vars]
@@ -517,9 +505,6 @@ def _get_fusion(func, nin, reduce, post_map, identity, input_types, name=None):
operation += ''.join(_get_declaration_from_op(_) for _ in op_list)
operation += '\n'.join(_get_operation_code(_) for _ in op_list)
- if name is None:
- name = 'fusion__' + '__'.join(build_kernel_name(_) for _ in op_list)
-
if reduce is None:
if not out_params:
in_params = ', '.join(_get_params(in_vars[:-1]))
@@ -633,7 +618,7 @@ class Fusion(object):
else:
nin = len(args)
f = _get_fusion(self.func, nin, self.reduce,
- self.post_map, self.identity, types)
+ self.post_map, self.identity, types, self.name)
self._memo[key] = f
f = self._memo[key]
if self.reduce is None:
@@ -680,17 +665,6 @@ def fuse(*args, **kwargs):
wrapper(f, *args, **kwargs), f)
-def build_kernel_name(entity):
- if isinstance(entity, FusionOp):
- return entity.build_kernel_name()
- elif isinstance(entity, _FusionVar):
- return entity.build_kernel_name()
- elif isinstance(entity, _FusionRef):
- return entity.build_kernel_name()
- else:
- assert False, type(entity)
-
-
class ufunc(core.ufunc):
def __init__(self, fusion_op, cupy_op, numpy_op):
