On Wed, Aug 21, 2013 at 10:34:27PM +0300, Pekka Jääskeläinen wrote:
> On 08/21/2013 09:36 PM, Peter Colberg wrote:
> >The hack is the missing communication of parameter sizes from the
> >kernel invocation in the backend to the LLVM pass. That would need
> >some ugly string formatting and parsing for the sizes of local and
> >constant memory arguments.
> 
> I'm not sure I got this. Is this related to the fact that you
> do (in LocalParams) the reverse what the old GenerateHeaders (now
> split to AutomaticLocals by Kalle) did and it loses the size of
> the arguments and you need it to invoke the libcuda? Which patch has
> this?

The last one containing the local-params pass:

+  for (Function::const_arg_iterator i = F->arg_begin(),
+         e = F->arg_end();
+       i != e; ++i)
+    {
+      const PointerType *p = dyn_cast<PointerType>(i->getType());
+      if (p && !i->hasByValAttr()
+          && (p->getAddressSpace() == POCL_ADDRESS_SPACE_LOCAL ||
+              p->getAddressSpace() == POCL_ADDRESS_SPACE_CONSTANT))
+          locals.push_back(new GlobalVariable(*M,
+            ArrayType::get(p->getElementType(), 1), false,
+            GlobalValue::ExternalLinkage, (Constant *) 0,
+            F->getName() + "_" + i->getName(), (GlobalVariable *) 0,
+            GlobalVariable::NotThreadLocal, p->getAddressSpace()));
+      else
+        parameters.push_back(i->getType());
+    }

Right now it defines an array of size 1, which is specific to the
scalarwave test. The backend should forward the sizes of constant
and local memory parameters to the LLVM pass, as these are not
in the OpenCL kernel code but queried from the OpenCL buffer sizes.

As a consequence, the kernel cache needs to account for the sizes
of these parameters. A cached kernel must not be reused if a
buffer passed as a constant/local argument has a larger size
than the buffer passed with a prior kernel invocation.

Peter

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk
_______________________________________________
pocl-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pocl-devel

Reply via email to