Skip to content

[Enhancement]: Arguments of the generated loopy kernel must only contain referenced variables

import pytato as pt

ns = pt.Namespace()
x = pt.make_placeholder(ns, name='x', shape=(10, 4), dtype=float)
y = pt.make_placeholder(ns, name='y', shape=(10, 4), dtype=float)

z = 2*x

print(pt.generate_loopy(z).program)

generates:

---------------------------------------------------------------------------
KERNEL: loopy_kernel
---------------------------------------------------------------------------
ARGUMENTS:
_pt_out: type: np:dtype('float64'), shape: (10, 4), dim_tags: (N1:stride:4, N0:stride:1) aspace: global
x: type: np:dtype('float64'), shape: (10, 4), dim_tags: (N1:stride:4, N0:stride:1) aspace: global
y: type: np:dtype('float64'), shape: (10, 4), dim_tags: (N1:stride:4, N0:stride:1) aspace: global
---------------------------------------------------------------------------
DOMAINS:
{  :  }
{ [_pt_out_dim0, _pt_out_dim1] : 0 <= _pt_out_dim0 <= 9 and 0 <= _pt_out_dim1 <= 3 }
---------------------------------------------------------------------------
INAME IMPLEMENTATION TAGS:
_pt_out_dim0: None
_pt_out_dim1: None
---------------------------------------------------------------------------
INSTRUCTIONS:
for _pt_out_dim0, _pt_out_dim1
    _pt_out[_pt_out_dim0, _pt_out_dim1] = 2*x[_pt_out_dim0, _pt_out_dim1]  {id=_pt_out_store}
end _pt_out_dim0, _pt_out_dim1
---------------------------------------------------------------------------

Notice the unnecessary 'y' as an argument.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information