Bug 100134 - Decreasing for loops over shared arrays hang the GPU (GEN9)
Summary: Decreasing for loops over shared arrays hang the GPU (GEN9)
Status: RESOLVED NOTOURBUG
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/Vulkan/intel (show other bugs)
Version: 13.0
Hardware: Other All
: medium normal
Assignee: Intel 3D Bugs Mailing List
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-03-08 23:27 UTC by Forrest Reiling
Modified: 2017-03-15 19:30 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
Offending SPIR-V (1.15 KB, text/plain)
2017-03-08 23:27 UTC, Forrest Reiling
Details

Description Forrest Reiling 2017-03-08 23:27:23 UTC
Created attachment 130135 [details]
Offending SPIR-V

We have a very simple glsl compute shader which hangs gen9

#version 450
#extension GL_ARB_separate_shader_objects : enable

shared int roi[8];

void main() {
  for (uint i = 7; i >= 0; i--) {
    roi[i] = 1;
  }
}

Heres some things we know about it

-changing the loop condition to "for (uint i = 0; i < 8; i++)" fixes the problem
-making roi a function scoped "local" variable fixes the problem
-the spir-v we get out of GLSLang looks legit afaict (attached for your reference)
-the same spir-v works on nvidia

Let us know if you have any questions.


Forrest
Comment 1 Jason Ekstrand 2017-03-15 17:25:27 UTC
(In reply to Forrest Reiling from comment #0)
> Created attachment 130135 [details]
> Offending SPIR-V
> 
> We have a very simple glsl compute shader which hangs gen9
> 
> #version 450
> #extension GL_ARB_separate_shader_objects : enable
> 
> shared int roi[8];
> 
> void main() {
>   for (uint i = 7; i >= 0; i--) {

If you made this a signed integer, it would properly go below 0 and the loop would terminate. :-)

>     roi[i] = 1;
>   }
> }
Comment 2 Josh Gargus 2017-03-15 18:39:30 UTC
Hmm, now I need to figure out where to file a bug against NVIDIA, since the buggy code "works as intended" on their driver :-D
Comment 3 Jason Ekstrand 2017-03-15 19:30:37 UTC
(In reply to Josh Gargus from comment #2)
> Hmm, now I need to figure out where to file a bug against NVIDIA, since the
> buggy code "works as intended" on their driver :-D

I've heard rumors they so something silly like make all loops terminate after 10,000 iterations or something like that regardless of what the user writes.  I can't be 100% sure though.


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.