Skip to content
Snippets Groups Projects
Commit 282abebe authored by Andreas Klöckner's avatar Andreas Klöckner
Browse files

Merge branch 'minor-fixes' into 'master'

Minor fixes

See merge request !123
parents 4ff0aef2 b4f0093f
No related branches found
No related tags found
No related merge requests found
...@@ -26,5 +26,5 @@ knl = lp.split_iname(knl, "i", 128, outer_tag="g.0", inner_tag="l.0") ...@@ -26,5 +26,5 @@ knl = lp.split_iname(knl, "i", 128, outer_tag="g.0", inner_tag="l.0")
evt, (out,) = knl(queue, a=a) evt, (out,) = knl(queue, a=a)
# ENDEXAMPLE # ENDEXAMPLE
cknl = lp.CompiledKernel(ctx, knl) knl = lp.add_and_infer_dtypes(knl, {"a": np.dtype(np.float32)})
print(cknl.get_highlighted_code({"a": np.float32})) print(lp.generate_code_v2(knl).device_code())
...@@ -48,20 +48,22 @@ def prepare_for_caching(kernel): ...@@ -48,20 +48,22 @@ def prepare_for_caching(kernel):
import loopy as lp import loopy as lp
new_args = [] new_args = []
tgt = kernel.target
for arg in kernel.args: for arg in kernel.args:
dtype = arg.dtype dtype = arg.dtype
if dtype is not None and dtype is not lp.auto: if dtype is not None and dtype is not lp.auto and dtype.target is not tgt:
dtype = dtype.with_target(kernel.target) arg = arg.copy(dtype=dtype.with_target(kernel.target))
new_args.append(arg.copy(dtype=dtype)) new_args.append(arg)
new_temporary_variables = {} new_temporary_variables = {}
for name, temp in six.iteritems(kernel.temporary_variables): for name, temp in six.iteritems(kernel.temporary_variables):
dtype = temp.dtype dtype = temp.dtype
if dtype is not None and dtype is not lp.auto: if dtype is not None and dtype is not lp.auto and dtype.target is not tgt:
dtype = dtype.with_target(kernel.target) temp = temp.copy(dtype=dtype.with_target(tgt))
new_temporary_variables[name] = temp.copy(dtype=dtype) new_temporary_variables[name] = temp
kernel = kernel.copy( kernel = kernel.copy(
args=new_args, args=new_args,
......
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