<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - OpenCL segfaults during compilation"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=94503">94503</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>OpenCL segfaults during compilation
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Mesa
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>medium
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>twhitehead@gmail.com
          </td>
        </tr>

        <tr>
          <th>QA Contact</th>
          <td>mesa-dev@lists.freedesktop.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=122238" name="attach_122238" title="Simplified kernel that causes compiler segfault">attachment 122238</a> <a href="attachment.cgi?id=122238&action=edit" title="Simplified kernel that causes compiler segfault">[details]</a></span>
Simplified kernel that causes compiler segfault

I'm running Debian unstable with the mesa 11.1.2 packages installed and ran
into an issue whereby the the OpenCL compiler is segfaulting.

I've chopped my kernel down as much as I could and have attached it.  Here is
an example run and backtrace

<a href="https://github.com/twhitehead/clcc">https://github.com/twhitehead/clcc</a>

$ clcc -l
Platform 0: Clover
  Device 0: AMD PITCAIRN (DRM 2.43.0, LLVM 3.7.1)
      Type = [ GPU, Accelerator, Custom ]
      Maximum compute units = 20
      Maximum work item dimensions = 3
      Maximum work item sizes = [ 256, 256, 256 ]
      Maximum work group size = 256
      Image support = False
      Global memory size = 1073741824
      Local memory size = 32768
Platform 1: Intel Gen OCL Driver
  Device 0: Intel(R) HD Graphics Haswell GT2 Desktop
      Type = [ GPU, Accelerator, Custom ]
      Maximum compute units = 20
      Maximum work item dimensions = 3
      Maximum work item sizes = [ 512, 512, 512 ]
      Maximum work group size = 512
      Image support = True
        Image2D maximum width = 8192
        Image2D maximum height = 8192
        Image3D maximum width = 8192
        Image3D maximum height = 8192
        Image3D maximum depth = 2048
      Global memory size = 2147483648
      Local memory size = 65536

$ clcc -p "Clover" test.c
Segmentation fault

With the dbg packages installed the gdb backtrace functions give

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff48a77de in llvm::SlotIndex::getIndex (this=<synthetic pointer>)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/include/llvm/CodeGen/SlotIndexes.h:134

#0  0x00007ffff48a77de in llvm::SlotIndex::getIndex (this=<synthetic pointer>)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/include/llvm/CodeGen/SlotIndexes.h:134
#1  llvm::SlotIndex::operator>= (other=..., this=<synthetic pointer>)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/include/llvm/CodeGen/SlotIndexes.h:202
#2  llvm::LiveRange::find (this=this@entry=0x1df48570, Pos=..., Pos@entry=...)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/CodeGen/LiveInterval.cpp:307
#3  0x00007ffff499e477 in llvm::LiveRange::find (Pos=..., this=0x1df48570)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/include/llvm/CodeGen/LiveInterval.h:272
#4  llvm::LiveRange::liveAt (index=..., this=0x1df48570)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/include/llvm/CodeGen/LiveInterval.h:373
#5  (anonymous namespace)::RegisterCoalescer::updateRegDefsUses
(this=this@entry=0x1f7e3f80, SrcReg=2147485471, 
    DstReg=2147485589, SubIdx=17)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/CodeGen/RegisterCoalescer.cpp:1199
#6  0x00007ffff49a3e62 in (anonymous namespace)::RegisterCoalescer::joinCopy
(Again=<synthetic pointer>, 
    CopyMI=0x18fa720, this=0x1f7e3f80)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/CodeGen/RegisterCoalescer.cpp:1440
#7  (anonymous namespace)::RegisterCoalescer::copyCoalesceWorkList
(this=this@entry=0x1f7e3f80, CurrList=...)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/CodeGen/RegisterCoalescer.cpp:2767
#8  0x00007ffff49a5ecb in (anonymous
namespace)::RegisterCoalescer::coalesceLocals (this=this@entry=0x1f7e3f80)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/CodeGen/RegisterCoalescer.cpp:2892
#9  0x00007ffff49a6646 in (anonymous
namespace)::RegisterCoalescer::joinAllIntervals (this=0x1f7e3f80)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/CodeGen/RegisterCoalescer.cpp:2923
#10 (anonymous namespace)::RegisterCoalescer::runOnMachineFunction
(this=0x1f7e3f80, fn=...)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/CodeGen/RegisterCoalescer.cpp:2968
#11 0x00007ffff41ff037 in llvm::FPPassManager::runOnFunction (this=0x1f7382a0,
F=...)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/IR/LegacyPassManager.cpp:1520
#12 0x00007ffff41ff28b in llvm::FPPassManager::runOnModule (this=0x1f7382a0,
M=...)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/IR/LegacyPassManager.cpp:1540
#13 0x00007ffff41fecc4 in (anonymous namespace)::MPPassManager::runOnModule
(M=..., this=0x1685c760)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/IR/LegacyPassManager.cpp:1596
#14 llvm::legacy::PassManagerImpl::run (this=0x1dad02a0, M=...)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/IR/LegacyPassManager.cpp:1698
#15 0x00007ffff41fee59 in llvm::legacy::PassManager::run
(this=this@entry=0x7fffffffc380, M=...)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/IR/LegacyPassManager.cpp:1729
#16 0x00007ffff4c737a7 in LLVMTargetMachineEmit (T=T@entry=0x1948d20,
M=M@entry=0xa40dc0, OS=..., 
    codegen=codegen@entry=LLVMObjectFile,
ErrorMessage=ErrorMessage@entry=0x7fffffffc498)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/Target/TargetMachineC.cpp:217
#17 0x00007ffff4c73950 in LLVMTargetMachineEmitToMemoryBuffer
(T=T@entry=0x1948d20, M=M@entry=0xa40dc0, 
    codegen=codegen@entry=LLVMObjectFile,
ErrorMessage=ErrorMessage@entry=0x7fffffffc498, 
    OutMemBuf=OutMemBuf@entry=0x7fffffffc628)
    at
/build/llvm-toolchain-3.7-dRkmpB/llvm-toolchain-3.7-3.7.1/lib/Target/TargetMachineC.cpp:241
#18 0x00007ffff6733c14 in (anonymous namespace)::emit_code
(tm=tm@entry=0x1948d20, mod=mod@entry=0xa40dc0, 
    file_type=file_type@entry=LLVMObjectFile,
out_buffer=out_buffer@entry=0x7fffffffc628, 
    r_log="test.c:3:21: warning: double precision constant requires
cl_khr_fp64, casting to single precision\ntest.c:3:32: warning: double
precision constant requires cl_khr_fp64, casting to single precision\ntest"...)
    at
../../../../../../src/gallium/state_trackers/clover/llvm/invocation.cpp:621
#19 0x00007ffff6738977 in (anonymous namespace)::compile_native (
    r_log="test.c:3:21: warning: double precision constant requires
cl_khr_fp64, casting to single precision\ntest.c:3:32: warning: double
precision constant requires cl_khr_fp64, casting to single precision\ntest"..., 
    dump_asm=<optimized out>, processor="pitcairn", triple="amdgcn--",
mod=0xa40dc0)
    at
../../../../../../src/gallium/state_trackers/clover/llvm/invocation.cpp:675
#20 clover::compile_program_llvm (
    source="#line 1 \"test.c\"\n//", '-' <repeats 111 times>, "//\n__constant
const float16 mg_lbT =\n  (float16)(        1.,        0."..., headers=...,
ir=<optimized out>, target="pitcairn-amdgcn--", opts="", 
    r_log="test.c:3:21: warning: double precision constant requires
cl_khr_fp64, casting to single precision\ntest.c:3:32: warning: double
precision constant requires cl_khr_fp64, casting to single precision\ntest"...)
---Type <return> to continue, or q <return> to quit---
    at
../../../../../../src/gallium/state_trackers/clover/llvm/invocation.cpp:886
#21 0x00007ffff672e9b0 in clover::program::build (this=this@entry=0xabab90,
devs=..., opts=opts@entry=0x736ab0 "", 
    headers=std::vector of length 0, capacity 0)
    at ../../../../../../src/gallium/state_trackers/clover/core/program.cpp:63
#22 0x00007ffff6710278 in clBuildProgram (d_prog=0xabab98, num_devs=1,
d_devs=0x7fffffffdcc0, 
    p_opts=<optimized out>, pfn_notify=0x0, user_data=0x0)
    at ../../../../../../src/gallium/state_trackers/clover/api/program.cpp:184
#23 0x000000000040460f in CL_programCreate (context=0x702be8, device=0x644fb8,
codes=..., options=...)
    at clcc.c:1466
#24 0x0000000000406651 in Action_compile (settings=...) at clcc.c:1716
#25 0x0000000000406344 in main (argc=2, argv=0x7fffffffdfd8) at clcc.c:1658

I also tried the Debian mesa 11.2.0~rc3 packages without success (there is no
dbg package for them though so I can't provide a backtrace).

Thanks!  -Tyson</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>