Bug 102030 - private memory overflow in openCL
Summary: private memory overflow in openCL
Alias: None
Product: Mesa
Classification: Unclassified
Component: Mesa core (show other bugs)
Version: 17.2
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: mesa-dev
QA Contact: mesa-dev
Depends on:
Blocks: 99553
  Show dependency treegraph
Reported: 2017-08-03 17:54 UTC by Janpieter Sollie
Modified: 2017-08-09 13:59 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

program source (8.38 KB, application/x-compressed-tar)
2017-08-03 17:54 UTC, Janpieter Sollie
clover dump files (212.10 KB, application/x-compressed-tar)
2017-08-03 17:58 UTC, Janpieter Sollie
working program source (9.03 KB, application/x-compressed-tar)
2017-08-09 06:09 UTC, Janpieter Sollie

Description Janpieter Sollie 2017-08-03 17:54:28 UTC
Created attachment 133229 [details]
program source

the program is attached, I debugged using the following:
-gdb break 380 & print answer
-investigation of answer[7] and answer[8]
while in both moments of the program they point to exactly the same array, the content is different.  The only thing that happened in between is the SHA1Init(&ctx), which should not interfere with output[] and k_pad/digest.
Comment 1 Janpieter Sollie 2017-08-03 17:58:37 UTC
Created attachment 133230 [details]
clover dump files
Comment 2 Janpieter Sollie 2017-08-03 18:02:08 UTC
fyi: I ran the program through oclgrind, this reports no problems ...
I ran the program with pocl, there's no problem there,
I ran the program with amdgpu-pro, no problem either
Comment 3 Janpieter Sollie 2017-08-08 10:45:19 UTC
confirmed on -RC3 (initial report on RC2)
Comment 4 Janpieter Sollie 2017-08-09 06:03:52 UTC
I got it running on both pocl and clover.  I will attach a working version with a built_hints.txt file included, which also includes debug information to debug memory contents.
what I concluded:
- atom_add does not work correctly
- this workaround works, where it should not:
        i = ctx->l1;
        i+= len << 3;
        atom_xchg(&(ctx->l1), i);
Comment 5 Janpieter Sollie 2017-08-09 06:09:44 UTC
Created attachment 133403 [details]
working program source

the source contains the following modifications:
-use of local memory
-insertion of debug function
- removal of atom_add
Comment 6 Janpieter Sollie 2017-08-09 13:56:55 UTC
seems like I am a very bad programmer...
after investigating the OpenCL reference manual, I found out my code was unstable, and I need to fix it before I can post something useful

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.