Bug 93696

Summary: [HSW,BDW;SKL][GLES 3.1 CTS]ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-* fail
Product: Mesa Reporter: Marta Löfstedt <marta.lofstedt>
Component: Drivers/DRI/i965Assignee: Plamena Manolova <plamena.manolova>
Status: RESOLVED FIXED QA Contact: Intel 3D Bugs Mailing List <intel-3d-bugs>
Severity: normal    
Priority: medium    
Version: 11.0   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Bug Depends on:    
Bug Blocks: 92778    

Description Marta Löfstedt 2016-01-13 12:13:12 UTC
Software versions:
    4.4.0-040400rc4-generic
    OpenGL version string: 3.0 Mesa 11.2.0-devel (git-69c4c75)

GPU hardware:
    OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 530 (Skylake GT2) 
    00:02.0 VGA compatible controller [0300]: Intel Corporation Sky Lake Integrated Graphics [8086:1912] (rev 06)

CPU hardware:
    x86_64
    Intel(R) Core(TM) i5-6600K CPU @ 3.50GHz
-----------------
Software versions:
    4.3.0-rc3+
    OpenGL version string: 3.0 Mesa 11.2.0-devel (git-69c4c75)

GPU hardware:
    OpenGL renderer string: Mesa DRI Intel(R) HD Graphics 5300 (Broadwell GT2) 
    00:02.0 VGA compatible controller [0300]: Intel Corporation Broadwell-U Integrated Graphics [8086:161e] (rev 06)

CPU hardware:
    x86_64
    Genuine Intel(R) CPU 0000 @ 0.60GHz
------------------
Software versions:
    4.2.0-1-generic
    OpenGL version string: 3.0 Mesa 11.2.0-devel (git-69c4c75)

GPU hardware:
    OpenGL renderer string: Mesa DRI Intel(R) Haswell Desktop 
    00:02.0 VGA compatible controller [0300]: Intel Corporation Xeon E3-1200 v3/4th Gen Core Processor Integrated Graphics Controller [8086:0412] (rev 06)

CPU hardware:
    x86_64
    Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
-----------------
CTS version:
git@67ae88f31295

command: 
./glcts --deqp-case=ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
./glcts --deqp-case=ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array

Environment:
Mesa built with: --enable-debug
export MESA_GLES_VERSION_OVERRIDE=3.1
export MESA_EXTENSION_OVERRIDE=GL_ARB_compute_shader

Reason for fail: Uniform ... returned location (98304) is greater than implementation dependent limit (98304)
Comment 1 Tapani Pälli 2016-01-13 12:16:48 UTC
Yes, the calculation seems incorrect, it should rather use amount of uniformremaptable entries + implicit uniforms.
Comment 2 Tapani Pälli 2016-01-13 12:17:53 UTC
I did not notice this regression because on HSW this test has always failed.
Comment 3 Marta Löfstedt 2016-01-13 12:51:15 UTC
It is a new reason for fail. We no fail to link:

 <InfoLog>error: count of uniform locations &gt;= MAX_UNIFORM_LOCATIONS(196608 &gt;= 98304)</InfoLog>

 <InfoLog>error: count of uniform locations &gt;= MAX_UNIFORM_LOCATIONS(98304 &gt;= 98304)</InfoLog>

Is mesa: git@4985159ad6 calculating correct?
Comment 4 Tapani Pälli 2016-01-13 14:11:14 UTC
(In reply to Marta Löfstedt from comment #3)
> It is a new reason for fail. We no fail to link:
> 
>  <InfoLog>error: count of uniform locations &gt;=
> MAX_UNIFORM_LOCATIONS(196608 &gt;= 98304)</InfoLog>
> 
>  <InfoLog>error: count of uniform locations &gt;=
> MAX_UNIFORM_LOCATIONS(98304 &gt;= 98304)</InfoLog>
> 
> Is mesa: git@4985159ad6 calculating correct?

no the calculation is wrong (only with some cases though) sorry for this
Comment 5 Tapani Pälli 2016-01-15 13:07:01 UTC
Fix available here:
http://cgit.freedesktop.org/~tpalli/mesa/log/?h=fixing_uniforms

Will clean this up and send to mesa-dev list soon.
Comment 6 Marta Löfstedt 2016-01-18 12:30:50 UTC
I can't reproduce this issue with:
http://patchwork.freedesktop.org/patch/70656/
Comment 7 Tapani Pälli 2016-01-20 07:41:59 UTC
commit 4475d8f9169195baefa893b9b147fe20414cda7c
Author: Tapani Pälli <tapani.palli@intel.com>
Date:   Fri Jan 15 13:11:20 2016 +0200

    glsl: move uniform calculation to link_uniforms
    
    Patch moves uniform calculation to happen during link_uniforms, this
    is possible with help of UniformRemapTable that has all the reserved
    locations.
    
    Location assignment for implicit locations is changed so that we
    utilize also the 'holes' that explicit uniform location assignment
    might have left in UniformRemapTable, this makes it possible to fit
    more uniforms as previously we were lazy here and wasting space.
    
    Fixes following CTS tests:
       ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
       ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array
    
    v2: code cleanups, increment NumUniformRemapTable correctly, fix
        find_empty_block to work properly and add some more comments.
    
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Reviewed-by: Marta Lofstedt <marta.lofstedt@intel.com>
Comment 8 Tapani Pälli 2016-01-21 03:59:18 UTC
I've reverted the fix as it had bugs, reopening.
Comment 9 Tapani Pälli 2016-02-18 10:29:27 UTC
commit 65dfb3048e8291675ca33581aeff8921f7ea509d
Author: Plamena Manolova <plamena.manolova@intel.com>
Date:   Thu Feb 11 15:00:02 2016 +0200

    compiler/glsl: Fix uniform location counting.
    
    This patch moves the calculation of current uniforms to
    link_uniforms, which makes use of UniformRemapTable which
    stores all the reserved uniform locations.
    
    Location assignment for implicit uniforms now tries to use
    any gaps left in the table after the location assignment
    for explicit uniforms. This gives us more space to store more
    uniforms.
    
    Patch is based on earlier patch with following changes/additions:
    
       1: Move the counting of explicit locations to
          check_explicit_uniform_locations and then pass
          the number to link_assign_uniform_locations.
       2: Count the number of empty slots in UniformRemapTable
          and store them in a list_head.
       3: Try to find an empty slot for implicit locations from
          the list, if that fails resize UniformRemapTable.
    
    Fixes following CTS tests:
       ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max
       ES31-CTS.explicit_uniform_location.uniform-loc-mix-with-implicit-max-array
    
    Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
    Signed-off-by: Plamena Manolova <plamena.manolova@intel.com>
    Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93696

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.