Giter Site home page Giter Site logo

llvmamdgpucodegenbug's Introduction

Reproducing Unsupported calling convention when generating AMDGPU object from bitcode for opencl

Original issue: https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/issues/45

The source files are copied from https://github.com/RadeonOpenCompute/ROCm-CompilerSupport/

How to reproduce

Simply install llvm/clang with clang and llvm-link in ${PATH} and run ./run.sh

Bug description

Desired result: all commands run successfully. This can be achieved by using ROCm forked llvm

+ AMDGPU_ARCH=gfx803
+ echo 'Compile complete opencl code into object, step-by-step (source->bitcode->object)'
Compile complete opencl code into object, step-by-step (source->bitcode->object)
+ clang -cc1 -emit-llvm-bc -triple amdgcn-amd-amdhsa -target-cpu gfx803 -O3 -std=cl1.2 source.cl -o GPUBitcode.bc
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 GPUBitcode.bc -o GPUkernel.o
+ echo 'Compile separated opencl code into object, step-by-step (source->bitcode->object)'
Compile separated opencl code into object, step-by-step (source->bitcode->object)
+ clang -cc1 -emit-llvm-bc -triple amdgcn-amd-amdhsa -target-cpu gfx803 -O3 -std=cl1.2 source1.cl -o GPUBitcode1.bc
+ clang -cc1 -emit-llvm-bc -triple amdgcn-amd-amdhsa -target-cpu gfx803 -O3 -std=cl1.2 source2.cl -o GPUBitcode2.bc
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 GPUBitcode1.bc -o GPUkernel1.o
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 GPUBitcode2.bc -o GPUkernel2.o
+ echo 'Compile separated opencl code into object, one-step (source->object)'
Compile separated opencl code into object, one-step (source->object)
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 source1.cl -o GPUkernel1.o
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 source2.cl -o GPUkernel2.o
+ echo 'linked opencl bitcode and then compile into object, (bitcode->object)'
linked opencl bitcode and then compile into object, (bitcode->object)
+ llvm-link GPUBitcode1.bc GPUBitcode2.bc -o GPUBitcode-linked.bc
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 GPUBitcode-linked.bc -o GPUkernel-linked.o

Actual result, using vanilla llvm/clang :

+ AMDGPU_ARCH=gfx803
+ echo 'Compile complete opencl code into object, step-by-step (source->bitcode->object)'
Compile complete opencl code into object, step-by-step (source->bitcode->object)
+ clang -cc1 -emit-llvm-bc -triple amdgcn-amd-amdhsa -target-cpu gfx803 -O3 -std=cl1.2 source.cl -o GPUBitcode.bc
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 GPUBitcode.bc -o GPUkernel.o
+ echo 'Compile separated opencl code into object, step-by-step (source->bitcode->object)'
Compile separated opencl code into object, step-by-step (source->bitcode->object)
+ clang -cc1 -emit-llvm-bc -triple amdgcn-amd-amdhsa -target-cpu gfx803 -O3 -std=cl1.2 source1.cl -o GPUBitcode1.bc
+ clang -cc1 -emit-llvm-bc -triple amdgcn-amd-amdhsa -target-cpu gfx803 -O3 -std=cl1.2 source2.cl -o GPUBitcode2.bc
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 GPUBitcode1.bc -o GPUkernel1.o
fatal error: error in backend: Unsupported calling convention for call
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 GPUBitcode2.bc -o GPUkernel2.o
+ echo 'Compile separated opencl code into object, one-step (source->object)'
Compile separated opencl code into object, one-step (source->object)
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 source1.cl -o GPUkernel1.o
fatal error: error in backend: Unsupported calling convention for call
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 source2.cl -o GPUkernel2.o
+ echo 'linked opencl bitcode and then compile into object, (bitcode->object)'
linked opencl bitcode and then compile into object, (bitcode->object)
+ llvm-link GPUBitcode1.bc GPUBitcode2.bc -o GPUBitcode-linked.bc
+ clang -cc1 -emit-obj -triple amdgcn-amd-amdhsa -target-cpu gfx803 GPUBitcode-linked.bc -o GPUkernel-linked.o
fatal error: error in backend: Unsupported calling convention for call

llvmamdgpucodegenbug's People

Contributors

littlewu2508 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.