<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I'm using Clang/LLVM 3.7 and libclc from the repository to compile and OpenCL kernel.<br><br>typedef float DATA_TYPE;<br><br>__kernel void gemm(__global DATA_TYPE *a, __global DATA_TYPE *b, __global DATA_TYPE *c, DATA_TYPE alpha, DATA_TYPE beta, int ni, int nj, int nk)<br>{<br>        int j = get_global_id(0);<br>        int i = get_global_id(1);<br><br>        if ((i < ni) && (j < nj))<br>        {<br>                c[i * nj + j] *= beta;<br>                int k;<br>                for(k=0; k < nk; k++)<br>                {<br>                        c[i * nj + j] += alpha * a[i * nk + k] * b[k * nj +j];<br>                }<br>        }<br>}<br><br></div>I'm doing it as follows:<br>clang -Dcl_clang_storage_class_specifiers -isystem libclc/generic/include -include clc/clc.h -target amdgcn -S -emit-llvm -xcl -o gemm.ll <a href="http://gemm.cl" target="_blank">gemm.cl</a><br>llvm-link /usr/local/lib/clc/hawaii-amdgcn--.bc gemm.ll -o gemm.linked.bc<br>clang -target amdgcn gemm.linked.bc -S -o gemm.hawaii.s<br><br></div>When I execute the third command, I get the following error:<br><br>warning: overriding the module target triple with amdgcn [-Woverride-module]<br>Pass 'Structurize control flow' is not initialized.<br>Verify if there is a pass dependency cycle.<br>Required Passes:<br>        Lower SwitchInst's to branches<br>        Dominator Tree Construction<br>#0 0x13e06b8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x13e06b8)<br>#1 0x13e1a1b SignalHandler(int) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x13e1a1b)<br>#2 0x7fcb0f850340 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)<br>#3 0x1122128 llvm::PMTopLevelManager::schedulePass(llvm::Pass*) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x1122128)<br>#4 0xf7015e llvm::TargetPassConfig::addPass(llvm::Pass*, bool, bool) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0xf7015e)<br>#5 0x7ffd69 (anonymous namespace)::GCNPassConfig::addPreISel() (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x7ffd69)<br>#6 0xf709f5 llvm::TargetPassConfig::addISelPrepare() (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0xf709f5)<br>#7 0xef6807 addPassesToGenerateCode(llvm::LLVMTargetMachine*, llvm::legacy::PassManagerBase&, bool, void const*, void const*, void const*, llvm::MachineFunctionInitializer*) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0xef6807)<br>#8 0xef60cd llvm::LLVMTargetMachine::addPassesToEmitFile(llvm::legacy::PassManagerBase&, llvm::raw_pwrite_stream&, llvm::TargetMachine::CodeGenFileType, bool, void const*, void const*, void const*, llvm::MachineFunctionInitializer*) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0xef60cd)<br>#9 0x14b5c79 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x14b5c79)<br>#10 0x197634d clang::CodeGenAction::ExecuteAction() (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x197634d)<br>#11 0x173c9e9 clang::FrontendAction::Execute() (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x173c9e9)<br>#12 0x170d4d3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x170d4d3)<br>#13 0x17a9de3 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x17a9de3)<br>#14 0x6f6634 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x6f6634)<br>#15 0x6f586f main (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x6f586f)<br>#16 0x7fcb0ec7cec5 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21ec5)<br>#17 0x6f2893 _start (/opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7+0x6f2893)<br>Stack dump:<br>0.      Program arguments: /opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/clang-3.7 -cc1 -triple amdgcn -S -disable-free -disable-llvm-verifier -main-file-name gemm.linked.bc -mrelocation-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -no-integrated-as -mconstructor-aliases -dwarf-column-info -coverage-file /home/rjfn/Desktop/polybench-gpu-1.0/OpenCL/GEMM/gemm.hawaii.s -resource-dir /opt/clang+llvm-3.7.0-x86_64-linux-gnu-ubuntu-14.04/bin/../lib/clang/3.7.0 -fno-dwarf-directory-asm -fdebug-compilation-dir /home/rjfn/Desktop/polybench-gpu-1.0/OpenCL/GEMM -ferror-limit 19 -fmessage-length 0 -mstackrealign -fobjc-runtime=gcc -fdiagnostics-show-option -o gemm.hawaii.s -x ir gemm.linked.bc<br>clang-3.7: error: unable to execute command: Segmentation fault (core dumped)<br>clang-3.7: error: clang frontend command failed due to signal (use -v to see invocation)<br>clang version 3.7.0 (tags/RELEASE_370/final)<br>Target: amdgcn<br>Thread model: posix<br>clang-3.7: note: diagnostic msg: PLEASE submit a bug report to <a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and associated run script.<br>clang-3.7: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.<br><br></div>What I'm I doing wrong?<br></div>