https://llvm.org/bugs/show_bug.cgi?id=26343

            Bug ID: 26343
           Summary: Cuda: Relocatable device code doesn't work
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangb...@nondot.org
          Reporter: crtr...@sandia.gov
                CC: llvm-bugs@lists.llvm.org
    Classification: Unclassified

Created attachment 15733
  --> https://llvm.org/bugs/attachment.cgi?id=15733&action=edit
Reproduction code

With nvcc one can use the option "-rdc true", to allow device (or device host)
functions to be declared "extern". This means device functions can be compiled
in one compilation unit and called from others. This doesn't work here:

Error:
[crtrott@apollo test_relocatable_device_code]$ ./build_clang 
ptxas fatal   : Unresolved extern function '_Z4calcv'
fatal error: cannot open file '/tmp/main-b2a94f.fatbin': No such file or
directory
1 error generated.
clang-3.9: error: ptxas command failed with exit code 255 (use -v to see
invocation)
clang-3.9: error: no such file or directory: 'main.o'


Code:
extern int __device__ calc();

__global__ void foo(int* a) {
   a[blockIdx.x*blockDim.x+threadIdx.x] = calc();
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to