Skip to content

Commit

Permalink
#174 add arg index and name to setkernelarg message [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
arporter committed Jul 20, 2018
1 parent 91ec86c commit 3dc8fee
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions src/psyclone/psyGen.py
Original file line number Diff line number Diff line change
Expand Up @@ -2908,18 +2908,24 @@ def call(self, value):
''' set the node that this argument is associated with '''
self._call = value

def set_kernel_arg(self, parent):
def set_kernel_arg(self, parent, index, kname):
'''
Generate the code to set this argument for an OpenCL kernel
Generate the code to set this argument for an OpenCL kernel.
:param parent: the node in the Schedule to which to add the code.
:param int index: the (zero-based) index of this argument in the
list of kernel arguments.
'''
from psyclone.f2pygen import AssignGen, CallGen
parent.add(AssignGen(
parent, lhs="ierr",
rhs="clSetKernelArg({0}, arg_idx, C_SIZEOF({1}), C_LOC({2}))".
format("kernel_obj", self.name, self.name)))
parent.add(CallGen(parent, "check_status",
["'clSetKernelArg'", "ierr"]))
parent.add(AssignGen(parent, lhs="arg_idx", rhs="arg_idx + 1"))
rhs="clSetKernelArg({0}, {1}, C_SIZEOF({2}), C_LOC({2}))".
format("kernel_obj", index, self.name)))
parent.add(CallGen(
parent, "check_status",
["'clSetKernelArg: arg {0} of {1}'".format(index,
kname),
"ierr"]))

def backward_dependence(self):
'''Returns the preceding argument that this argument has a direct
Expand Down

0 comments on commit 3dc8fee

Please sign in to comment.