1

I'm using the OpenCL clBuildProgram() API function on a program created from a source string. The source is:

kernel void foo(int val, write_only pipe int outPipe)
{
    write_pipe(outPipe, &val);
}

I compile it using NVIDIA CUDA 12.9.86's OpenCL implementation. For command-line options, I use: -cl-std=CL2.0. The build fails, and I get the following build log:

ptxas fatal   : Unresolved extern function '__write_pipe_2'

I didn't ask for the __write_pipe_2 function - NVIDIA put it there in its implementation of write_pipe() - which is an OpenCL 2.0-specified intrinsic function available in kernel code. So, why doesn't NVIDIA's OpenCL implementation provide the object code (or source code) for that function, during the build? Did I need to do something extra to get my build to succeed?

4
  • 1
    Have you got #define CL_TARGET_OPENCL_VERSION 200 in your code? Commented Jul 27 at 21:31
  • @SimonGoater: You mean, my kernel code, or my host-side code? Commented Jul 28 at 5:23
  • @SimonGoater: 1. I have; and since I don't really use cl.hpp, I also defined CL_VERSION_2_0 to be 1. Commented Jul 28 at 12:55
  • This is probably a driver bug. Try a different cuda version, or opencl vendor, such as pocl. It is calling __write_pipe_2 because there are two ways to call write_pipe, and the compiler switches between them. If you call read_pipe (outPipe, 0, 0, &val), you should get it to call __write_pipe_1. That won't work for you, though. This has been a driver bug in the past. Commented Aug 27 at 17:52

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.