[LLVMdev] Function pointer parameters in PTX backend

Alberto Magni alberto.magni86 at gmail.com
Mon Oct 24 03:24:48 PDT 2011

Hi everybody,

I am trying to produce ptx code starting from OpenCL C.
I am experiencing a problem concerning pointer parameters.
Here follows an example:

kernel void function(__global float* parameter1) {}


.entry function(
 .param .u32 *.ptr* .global .align 4 function_param_0

CLANG + LLVM PTX backend

// (skipping builtin functions definitions)

.entry function (.param .b32 __param_1) // @function

// BB#0:                                // %entry

As you can see the code generated by the LLVM backend lacks the kernel
parameter attribute
.ptr, required to identify pointers [1]. I can understand that the address
space attribute (.global)
is not defined since there is no agreement on how to represent them in the

The command I use to compile is:
clang kernels/parameters.cl -include ocldef.h -include
builtin_functions_ptx.cl -ccc-host-triple ptx32 -S -o -

where ocldef.h contains the definitions of OpenCL vector data types,
builtin_functions_ptx.cl is the file provided by Justin in a previous
message [2].

Is this a bug? Or the .ptr attribute is just not supported yet ?

Thank you



[1] PTX: Parallel Thread Execution ISA Version 2.3, page 30
[2] http://lists.cs.uiuc.edu/pipermail/cfe-dev/2011-October/017699.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20111024/b175bbfe/attachment.html>

More information about the llvm-dev mailing list