Bug 97190 - Segmentation Fault when Compiling Kernel
Summary: Segmentation Fault when Compiling Kernel
Status: RESOLVED MOVED
Alias: None
Product: Beignet
Classification: Unclassified
Component: Beignet (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: ruiling
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-02 14:21 UTC by Dominik Ernst
Modified: 2018-10-12 21:24 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
reduced sample of the crashing kernel (425 bytes, text/plain)
2016-08-02 14:21 UTC, Dominik Ernst
Details
fix patch (2.10 KB, patch)
2016-08-04 06:22 UTC, ruiling
Details | Splinter Review
Reduced sample of the kernel with wrong output (672 bytes, text/plain)
2016-08-04 15:40 UTC, Dominik Ernst
Details

Description Dominik Ernst 2016-08-02 14:21:07 UTC
Created attachment 125482 [details]
reduced sample of the crashing kernel

I have a program that segfaults reliably(always) when compiling the attached kernel and using beignet as OpenCL platform. The sample is part of a bigger kernel, of which I have stripped everything that is not necessary to provoke the crash. I actually have three different kernels that crash, that all have this pattern. Other Kernels compile fine. The Kernels compile and run with the Intel, AMD and nvidia platforms.

The hardware is Skylake ULX GT2. I built commit b55060c02d945f3140f2291f70e5f9df019d34ac from the beignet repository with GCC6.1.1 and LLVM 3.8.0.
Comment 1 Xiuli Pan 2016-08-04 02:31:47 UTC
Hi Dominik,

The bug is confirmed, I will try to find what is happening here in backend.
Thanks for you reproduce kernel!

Thanks
Xiuli
Comment 2 ruiling 2016-08-04 06:22:15 UTC
Created attachment 125518 [details] [review]
fix patch
Comment 3 ruiling 2016-08-04 06:27:24 UTC
Hi Dominik,

I have make a fix patch, could you have a try if it works on your large kernel? It should fix the small kernel issue. I am just worried if there is any further issue. Thanks very much for reporting the issue to us. I am sorry for any inconvenience to you.

Thanks!
Ruiling
Comment 4 Dominik Ernst 2016-08-04 08:57:04 UTC
Yes, this patch fixes the segmentation fault on all previously affected kernels. Thank you for your quick reaction!
Comment 5 Dominik Ernst 2016-08-04 15:39:03 UTC
More testing today revealed differences in the results when running my kernels on a CPU platform and running on beignet. I was able to reproduce the differences in a reduced sample very similar to to the last one. 'global_A' and 'global_B' are two (different) unsigned int buffers of size 4 and initialized with the value '7'. The kernel is called with 1 workitem in 1 workgroup, the last two parameters are 4.The expected output, produced on a CPU platform is:

1 8 8 8 
2 9 9 9 
3 10 10 10 
4 11 11 11 
5 12 12 12 

1 13 13 13 
2 14 14 14 
3 15 15 15 
4 16 16 16 
5 17 17 17 

1 18 18 18 
2 19 19 19 
3 20 20 20 
4 21 21 21 
5 22 22 22 

1 23 23 23 
2 24 24 24 
3 25 25 25 
4 26 26 26 
5 27 27 27

The result with beignet on the previously described hardware/software configuration is:

1 1 1 1 
2 2 2 2 
1 1 1 1 
2 2 2 2 
1 1 1 1 

1 2 2 2 
1 1 1 1 
2 2 2 2 
1 1 1 1 
2 2 2 2 

1 1 1 1 
2 2 2 2 
1 1 1 1 
2 2 2 2 
1 1 1 1 

1 2 2 2 
1 1 1 1 
2 2 2 2 
1 1 1 1 
2 2 2 2 

Removing the comments on the first three lines will correctly produce '7 7 7 7 ' and will also lead to the bug not being triggered, so that the result is identical to the CPU platform. The software configuration is the same as previously, with the aforementioned patch applied.
Comment 6 Dominik Ernst 2016-08-04 15:40:05 UTC
Created attachment 125533 [details]
Reduced sample of the kernel with wrong output
Comment 7 GitLab Migration User 2018-10-12 21:24:03 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/beignet/beignet/issues/24.


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.