Bug 93336 - [IVB,HSW] piglit.spec.arb_program_interface_query.arb_program_interface_query-getprogramresourceiv crashes
Summary: [IVB,HSW] piglit.spec.arb_program_interface_query.arb_program_interface_query...
Status: RESOLVED FIXED
Alias: None
Product: piglit
Classification: Unclassified
Component: tests (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Jordan Justen
QA Contact: Piglit Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-10 20:08 UTC by Mark Janes
Modified: 2016-02-11 18:13 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments

Description Mark Janes 2015-12-10 20:08:42 UTC
This test was enabled with compute shaders:

d04612b60d98ff785646affaffc3d7243deecb74 regressed this test on 32 bit hsw/ivb:

Author:     Jordan Justen <jordan.l.justen@intel.com>
AuthorDate: Wed Sep 2 15:47:33 2015 -0700
Commit:     Jordan Justen <jordan.l.justen@intel.com>
CommitDate: Wed Dec 9 23:50:38 2015 -0800

    i965: Enable ARB_compute_shader extension on supported hardware
    
    Enable ARB_compute_shader on gen7+, on hardware that supports the
    OpenGL 4.3 requirements of a local group size of 1024.
    
    With SIMD16 support, this is limited to Ivy Bridge and Haswell.
    
    Broadwell will work with a local group size up to 896 on SIMD16
    meaning programs that use this size or lower should run when setting
    MESA_EXTENSION_OVERRIDE=GL_ARB_compute_shader.
    
    Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
    Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
    Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>


Test output:

/tmp/build_root/m32/lib/piglit/bin/arb_program_interface_query-getprogramresourceiv -auto
piglit: debug: Requested an OpenGL 3.2 Core Context, and received a matching 3.3 context

Standard Error

Failed to compile compute shader: 0:9(8): error: unrecognized layout identifier `size4x32'

source:
#version 150
#extension GL_ARB_shader_subroutine : require
#extension GL_ARB_shader_image_load_store : require
#extension GL_ARB_compute_shader : require
layout(local_size_x = 4) in;
uniform cs_uniform_block {
	uniform vec4 cs_test;
};
layout(size4x32) uniform image2D tex;
subroutine vec4 com_offset();
subroutine uniform com_offset COMPUTE;
subroutine (com_offset) vec4 css() { return vec4(1, 0, 0, 0); }
void main() {
	imageStore(tex, ivec2(0.0), cs_test + COMPUTE());
}
Comment 1 Alejandro Piñeiro (freenode IRC: apinheiro) 2016-02-11 11:03:22 UTC
I took a brief look to this one. Two quick notes.

(In reply to Mark Janes from comment #0)

> Failed to compile compute shader: 0:9(8): error: unrecognized layout
> identifier `size4x32'

<skip>

> uniform cs_uniform_block {
> 	uniform vec4 cs_test;
> };
> layout(size4x32) uniform image2D tex;

Using "layout(rgba32f)" gets the shader being compiled without problem, and the subtest passing (the test itself still fails). After a skim reading on EXT_shader_image_load_store and ARB_shader_image_load_store (the latter depends on the former), that layout should be allowed, and it is also more general (for example, using rgba32i fails due a format mismatch). So I suspect that this is a bug on the implementation for those extensions. The problem was hidden until now because this shader needed compute shader.

Using glslangValidator with that shader also prints a "unrecognized layout identifier". Having said so, it prints several other errors.

NVIDIA proprietary drivers handle that shader without problems (as pointed on the commit log of those tests)

Will keep investigating to check if the problem is in the shader. In that case, the bug would be on the piglit test.

> subroutine vec4 com_offset();
> subroutine uniform com_offset COMPUTE;
> subroutine (com_offset) vec4 css() { return vec4(1, 0, 0, 0); }
> void main() {
> 	imageStore(tex, ivec2(0.0), cs_test + COMPUTE());
> }


Second note: piglit.spec.arb_program_interface_query.arb_program_interface_query-resource-location is affected by the same problem, that got also fixed by changing size4x32 for rgba32f.
Comment 2 Alejandro Piñeiro (freenode IRC: apinheiro) 2016-02-11 12:11:59 UTC
(In reply to Alejandro Piñeiro (freenode IRC: apinheiro) from comment #1)
> I took a brief look to this one. Two quick notes.
> 
> (In reply to Mark Janes from comment #0)
> 
> > Failed to compile compute shader: 0:9(8): error: unrecognized layout
> > identifier `size4x32'
> 
> <skip>
> 
> > uniform cs_uniform_block {
> > 	uniform vec4 cs_test;
> > };
> > layout(size4x32) uniform image2D tex;
> 
> Using "layout(rgba32f)" gets the shader being compiled without problem, and
> the subtest passing (the test itself still fails). After a skim reading on
> EXT_shader_image_load_store and ARB_shader_image_load_store (the latter
> depends on the former), that layout should be allowed, and it is also more
> general (for example, using rgba32i fails due a format mismatch). So I
> suspect that this is a bug on the implementation for those extensions. The
> problem was hidden until now because this shader needed compute shader.
> 
> Using glslangValidator with that shader also prints a "unrecognized layout
> identifier". Having said so, it prints several other errors.
> 
> NVIDIA proprietary drivers handle that shader without problems (as pointed
> on the commit log of those tests)
> 
> Will keep investigating to check if the problem is in the shader. In that
> case, the bug would be on the piglit test.

Ok, after a more deep reading on the spec, from ARB_shader_image_load_store spec:

    "(0) How does this extension differ from the similar
        EXT_shader_image_load_store?

      RESOLVED:  The functionality provided by this extension is very similar
      to that provided by EXT_shader_image_load_stores.  There are some
      functional differences.

        * "size" layout qualifiers replaced with "format" qualifiers."

So, layout(size4x32) was valid for EXT_shader_image_load_store but not for ARB_shader_image_load_store.

About why this doesn't fail on NVIDIA drivers, at the same spec:
"Dependencies on EXT_shader_image_load_store

    Both this extension and EXT_shader_image_load_store provide nearly the
    identical functionality.

    If both extensions are enabled in the shading language, the "size*" layout
    qualifiers are treated as format qualifiers, and are mapped to equivalent
    format qualifiers in the table below, according to the type of image
    variable. "

So I understand that if both extensions are enabled, size* is still allowed, but mapped to the format qualifiers. NVIDIA supports both extensions while hsw/i965 only the ARB one, explaining the difference between both.

So. I think that the way to solve this would be change the layout at the test, to one using the format qualifier, as is the one required by the ARB version of the extension.
Comment 3 Alejandro Piñeiro (freenode IRC: apinheiro) 2016-02-11 12:47:22 UTC
(In reply to Alejandro Piñeiro (freenode IRC: apinheiro) from comment #2)

> So. I think that the way to solve this would be change the layout at the
> test, to one using the format qualifier, as is the one required by the ARB
> version of the extension.

Patch sent to piglit:
https://patchwork.freedesktop.org/patch/73278/

Note that the test itself still fails after this patch. But fixes the bug in any case, as the problem reported is about a shader compile error.

Also moving the bug to piglit.
Comment 4 Alejandro Piñeiro (freenode IRC: apinheiro) 2016-02-11 18:13:29 UTC
(In reply to Alejandro Piñeiro (freenode IRC: apinheiro) from comment #3)
> (In reply to Alejandro Piñeiro (freenode IRC: apinheiro) from comment #2)
> 
> > So. I think that the way to solve this would be change the layout at the
> > test, to one using the format qualifier, as is the one required by the ARB
> > version of the extension.
> 
> Patch sent to piglit:
> https://patchwork.freedesktop.org/patch/73278/

Patch reviewed and pushed:

commit b7a65af75afb3664a1e908b09c8a39fa4490c2cc
Author: Alejandro Piñeiro <apinheiro@igalia.com>
Date:   Thu Feb 11 12:04:40 2016 +0100

    program_interface_query: use format layout qualifiers instead of size* layout qualifiers
    
    From ARB_shader_image_load_store spec:
    
    "    (0) How does this extension differ from the similar
            EXT_shader_image_load_store?
    
          RESOLVED:  The functionality provided by this extension is very similar
          to that provided by EXT_shader_image_load_stores.  There are some
          functional differences.
    
            * "size" layout qualifiers replaced with "format" qualifiers.
    
            * Image loads aren't restricted to "1x8", "1x16", "1x32", "2x32", and
              "4x32" formats.  Instead, each supported image format has a layout
              qualifier, and values loaded from images are converted to an
              vec4/ivec4/uvec4 representation appropriate for the image format."
    
    size4x32 was valid for EXT_shader_image_load_store. That explains
    why this test works properly on proprietary NVIDIA drivers, as
    both extensions are supported.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93336
    Reviewed-by: Tapani Pälli <tapani.palli@intel.com>


Closing bug.


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.