https://bugs.freedesktop.org/show_bug.cgi?id=88444

            Bug ID: 88444
           Summary: :Access violation error while calculating SumIfs using
                    OpenCL on CPU device causes crash
           Product: LibreOffice
           Version: 4.2.0.0.beta2
          Hardware: All
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: critical
          Priority: high
         Component: Spreadsheet
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: evgeniy.tyu...@intel.com
                CC: michael.me...@collabora.com, t...@iki.fi

Created attachment 112270
  --> https://bugs.freedesktop.org/attachment.cgi?id=112270&action=edit
Attachments zipped: spreadsheet to reproduce, SumIfs OpenCL kernel code, the
log.

The issue can be identified as an endless run with PCMark8, when selecting
Spreadsheet in Work test, using acceleration mode.
After a bit of investigation, we have identify the issue seems like incorrect
set/usages of parameters that result out-of-boundaries in OpenCL kernel
execution.
And it seems located somewhere around
https://gitorious.org/libreoffice/core/source/7d68e43e8b35419dc481ce3a06716113b4045839:sc/source/core/opencl/op_math.cxx#
Line 442 void OpSumIfs::GenSlidingWindowFunction(std::stringstream &ss,        
      const std::string sSymName, SubArguments &vSubArguments).

More information:

Here is an example of a buffer allocated with wrong size.

DEBUG 13:58:16               4032      
c:\work\aderi\vcp_olc-opencl-sdk\src\framework\Context\context_module.cpp      
         (1635)   Intel::OpenCL::Framework::ContextModule::CreateBuffer        
 CreateBuffer return handle 120115056
clCreateBuffer(0x2db9228, CL_MEM_READ_ONLY | CL_MEM_ALLOC_HOST_PTR |
CL_MEM_COPY_HOST_PTR, 8, 0x153de490, CL_SUCCESS) = 0x728cf70

DEBUG 13:58:16               4032      
c:\work\aderi\vcp_olc-opencl-sdk\src\framework\Context\kernel.cpp              
 (797)                Intel::OpenCL::Framework::Kernel::SetKernelArg           
SetKernelArg buffer cl_mem=120115056
clSetKernelArg(0x7234350, 4, 4, 0x1383e10) = CL_SUCCESS

DEBUG 13:58:16               4032      
c:\work\aderi\vcp_olc-opencl-sdk\src\devices\cpu_device\cpu_device.cpp     
(2019)               
Intel::OpenCL::CPUDevice::CPUDevice::clDevFlushCommandList             
clDevFlushCommandList Function enter
clEnqueueNDRangeKernel(0x2dd5768, 0x7234350, 2, nullptr, { 256, 100 }, { 256, 1
}, 0, nullptr, nullptr) = CL_SUCCESS

The buffer allocated for 5th argument (argument number 4) of kernel
tmp0_0_0_SumIfs_reduction was created with size 8 bytes.
The kernel was executed with global size = {256, 100} and local size {256, 1}
=> group size = {1, 100}
The kernel tmp0_0_0_SumIfs_reduction access 5th argument __global double
*tmp0_0_4 as follows:
tmp4= fsum(tmp0_0_4[get_group_id(1)], 0);

Summary by Tor:

- The version you are using is the tag libreoffice-4-2-milestone-5, in the
branch libreoffice-4-2.

- The call to clCreateBuffer() that your log shows is most likely the one in
ParallelReductionVectorRef::Marshal() and the clSetKernelArg() call is the one
in DynamicKernelSoPArguments::Marshal(), the one in the for (size_t j=0; j<
vclmem.size(); j++) loop, and it is the ‘redKernel’ kernel that has the name
“tmp0_0_0_SumIfs_reduction”. This all is in the
sc/source/core/opencl/formulagroupcl.cxx source file.

- The problematic OpenCL code line tmp4= fsum(tmp0_0_4[get_group_id(1)], 0) is
generated in CheckVariables::CheckSubArgumentIsNan2() in
sc/source/core/opencl/opbase.cxx.

The issue is reproducible sporadically. We experience failures while running
PCMark.
One can trigger SumIfs calculation using spreadsheet in the attachment, if
OpenCL acceleration is turned on and maybe even forced.

The archive attached contains:
- spreadsheet that uses SumIfs. SumIfs are located on the sheet named 'Main',
starting S3.
- SumIfs kernel source code, that is generated while calculating the formula.
- Log file of OpenCL calls.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to