Skip to content
Snippets Groups Projects
Commit d15404bb authored by Nick Curtis's avatar Nick Curtis
Browse files

ditch _as_strided, as it's causing segfaults in my more complicated kernels

parent 853346ee
No related branches found
No related tags found
1 merge request!108C execution
...@@ -97,23 +97,31 @@ class CExecutionWrapperGenerator(ExecutionWrapperGeneratorBase): ...@@ -97,23 +97,31 @@ class CExecutionWrapperGenerator(ExecutionWrapperGeneratorBase):
var("_lpy_shape_%d" % i) var("_lpy_shape_%d" % i)
for i in range(num_axes)) for i in range(num_axes))
# find order of array
order = "'C'"
if num_axes > 1:
ldim = arg.unvec_strides[1]
if ldim == arg.unvec_shape[0]:
order = "'F'"
else:
order = "'C'"
gen("%(name)s = _lpy_np.empty(%(shape)s, " gen("%(name)s = _lpy_np.empty(%(shape)s, "
"%(dtype)s)" "%(dtype)s, order=%(order)s)"
% dict( % dict(
name=arg.name, name=arg.name,
shape=strify(sym_shape), shape=strify(sym_shape),
dtype=self.python_dtype_str( dtype=self.python_dtype_str(
kernel_arg.dtype.numpy_dtype))) kernel_arg.dtype.numpy_dtype),
order=order))
#check strides #check strides
gen("%(name)s = _lpy_strided(%(name)s, %(shape)s, "
"%(strides)s)"
% dict(
name=arg.name,
shape=strify(sym_shape),
strides=strify(sym_strides)))
if not skip_arg_checks: if not skip_arg_checks:
gen("assert '%(strides)s == %(name)s.strides', "
"'Strides of loopy created array %(name)s, "
"do not match expected.'" %
dict(name=arg.name,
strides=strify(sym_strides)))
for i in range(num_axes): for i in range(num_axes):
gen("del _lpy_shape_%d" % i) gen("del _lpy_shape_%d" % i)
gen("del _lpy_strides_%d" % i) gen("del _lpy_strides_%d" % i)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment