Bug 90472

Summary: Program fails with certain OpenCL kernel defintions.
Product: Beignet Reporter: Stojan Dimitrovski <sdimitrovski>
Component: BeignetAssignee: Luo Xionghu <xionghu.luo>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
URL: http://cgit.freedesktop.org/beignet/tree/backend/src/llvm/llvm_gen_backend.cpp#n1805
Whiteboard:
i915 platform: i915 features:
Attachments: Offending OpenCL source. Notes are included within.
C++ code that runs the given file.
clinfo output
Standalone-compilable version of above (.cl)
Standalone-compilable version of above (.c)
gdb traces
valgrind (memory error checker) log

Description Stojan Dimitrovski 2015-05-15 15:19:02 UTC
Created attachment 115815 [details]
Offending OpenCL source. Notes are included within.

I have a very interesting problem with Beignet 1.0 in that certain kernel definitions crash the build.

The output of the build is:

ASSERTION FAILED: con.getName() == v.getName()
  at file /builddir/build/BUILD/Beignet-1.0.0-Source/backend/src/llvm/llvm_gen_backend.cpp, function void gbe::GenWriter::allocateGlobalVariableRegister(llvm::Function&), line 1840


Here's the line of code at the current source: http://cgit.freedesktop.org/beignet/tree/backend/src/llvm/llvm_gen_backend.cpp#n1805

Not all kernel definitions produce this bug. Attached is one file of the code that fails.
Comment 1 Stojan Dimitrovski 2015-05-15 15:19:57 UTC
Created attachment 115816 [details]
C++ code that runs the given file.
Comment 2 Stojan Dimitrovski 2015-05-15 15:25:52 UTC
Created attachment 115817 [details]
clinfo output

Running on a Fedora 20 system with kernel: 3.19.3-100.fc20.x86_64
Comment 3 Stojan Dimitrovski 2015-05-15 19:13:51 UTC
Just upgraded to Fedora 21, now I get this instead:

ASSERTION FAILED: scalarMap.find(key) != scalarMap.end()
  at file /builddir/build/BUILD/Beignet-1.0.1-Source/backend/src/llvm/llvm_gen_backend.cpp, function gbe::ir::Register gbe::RegisterTranslator::getScalar(llvm::Value*, uint32_t), line 407
Comment 4 Luo Xionghu 2015-08-18 07:38:31 UTC
hi Stojan Dimitrovski ,
please update the beignet to master and patch the link to have a try.

http://lists.freedesktop.org/archives/beignet/2015-August/005971.html
Comment 5 Rebecca Palmer 2015-09-27 21:48:57 UTC
Created attachment 118467 [details]
Standalone-compilable version of above (.cl)
Comment 6 Rebecca Palmer 2015-09-27 21:49:22 UTC
Created attachment 118468 [details]
Standalone-compilable version of above (.c)
Comment 7 Rebecca Palmer 2015-09-27 21:49:48 UTC
Created attachment 118469 [details]
gdb traces
Comment 8 Rebecca Palmer 2015-09-27 21:50:18 UTC
Created attachment 118470 [details]
valgrind (memory error checker) log
Comment 9 Rebecca Palmer 2015-09-27 21:59:29 UTC
The PrintfSlot fix *doesn't* fix this, at least for me (i5-3230M): see attached logs.

(The original test case wasn't buildable without other files; it's very possible that my hurriedly-edited version isn't valid OpenCL C (and very likely that it no longer does anything useful), but that shouldn't crash the compiler.  Removing the first __kernel still avoids the crash.)

The several different places it can crash suggest memory corruption, but I haven't yet had time to properly look at the valgrind log.
Comment 10 Rebecca Palmer 2015-11-01 22:50:34 UTC
This now appears to be fixed, probably by http://cgit.freedesktop.org/beignet/commit/?id=dcc189bed5b395d6fbcdffa29e60e68cf1071310

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.