Bug 94050

Summary: test_vec4_register_coalesce regression
Product: Mesa Reporter: Vinson Lee <vlee>
Component: Mesa coreAssignee: Matt Turner <mattst88>
Status: RESOLVED FIXED QA Contact: mesa-dev
Severity: normal    
Priority: medium CC: imirkin
Version: gitKeywords: bisected, regression
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Vinson Lee 2016-02-08 20:06:53 UTC
mesa: 01dacc83ff43a054513277e3e1296c3fc8cd750a (master 11.2.0-devel)

Running main() from gtest_main.cc
[==========] Running 2 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 2 tests from copy_propagation_test
[ RUN      ] copy_propagation_test.test_swizzle_swizzle

Program received signal SIGSEGV, Segmentation fault.
brw::vec4_visitor::opt_copy_propagation (this=this@entry=0xab73a0, do_constant_prop=do_constant_prop@entry=true)
    at brw_vec4_copy_propagation.cpp:403
403	      prog_data->dispatch_mode == DISPATCH_MODE_4X2_DUAL_OBJECT ? 1 : 2;
(gdb) bt
#0  brw::vec4_visitor::opt_copy_propagation (this=this@entry=0xab73a0, do_constant_prop=do_constant_prop@entry=true)
    at brw_vec4_copy_propagation.cpp:403
#1  0x000000000040aa89 in copy_propagation (v=0xab73a0) at test_vec4_copy_propagation.cpp:118
#2  copy_propagation_test_test_swizzle_swizzle_Test::TestBody (this=<optimized out>) at test_vec4_copy_propagation.cpp:146
#3  0x000000000042eb63 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void> (
    location=0x744498 "the test body", method=<optimized out>, object=<optimized out>) at ./src/gtest.cc:2078
#4  testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void> (object=object@entry=0xab6950, 
    method=(void (testing::Test::*)(testing::Test * const)) 0x40a860 <copy_propagation_test_test_swizzle_swizzle_Test::TestBody()>, location=location@entry=0x744498 "the test body") at ./src/gtest.cc:2114
#5  0x00000000004265da in testing::Test::Run (this=0xab6950) at ./src/gtest.cc:2151
#6  0x0000000000426728 in testing::TestInfo::Run (this=0xab2cb0) at ./src/gtest.cc:2326
#7  0x0000000000426805 in testing::TestCase::Run (this=0xab31a0) at ./src/gtest.cc:2444
#8  0x000000000042745f in testing::internal::UnitTestImpl::RunAllTests (this=0xab2de0) at ./src/gtest.cc:4315
#9  0x000000000042f043 in testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (
    location=0x743760 "auxiliary test code (environments or event listeners)", method=<optimized out>, object=<optimized out>)
    at ./src/gtest.cc:2078
#10 testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool> (object=0xab2de0, 
    method=(bool (testing::internal::UnitTestImpl::*)(testing::internal::UnitTestImpl * const)) 0x427220 <testing::internal::UnitTestImpl::RunAllTests()>, location=location@entry=0x743760 "auxiliary test code (environments or event listeners)")
    at ./src/gtest.cc:2114
#11 0x00000000004268d4 in testing::UnitTest::Run (this=0xa9b380 <testing::UnitTest::GetInstance()::instance>)
    at ./src/gtest.cc:3926
#12 0x0000000000407cd2 in RUN_ALL_TESTS () at ../../src/gtest/include/gtest/gtest.h:2288
#13 main (argc=1, argv=0x7fffffffde88) at src/gtest_main.cc:37
(gdb) frame 0
#0  brw::vec4_visitor::opt_copy_propagation (this=this@entry=0xab73a0, do_constant_prop=do_constant_prop@entry=true)
    at brw_vec4_copy_propagation.cpp:403
403	      prog_data->dispatch_mode == DISPATCH_MODE_4X2_DUAL_OBJECT ? 1 : 2;
(gdb) print prog_data
$1 = (brw_vue_prog_data * const) 0x0

9f2e22bf343b21d6b44e6a502f00a86d169f5ade is the first bad commit
commit 9f2e22bf343b21d6b44e6a502f00a86d169f5ade
Author: Matt Turner <mattst88@gmail.com>
Date:   Sun Jan 17 20:30:14 2016 -0500

    i965/vec4: don't copy ATTR into 3src instructions with complex swizzles
    
    The vec4 backend, at the end, does this:
    
        if (inst->is_3src()) {
           for (int i = 0; i < 3; i++) {
              if (inst->src[i].vstride == BRW_VERTICAL_STRIDE_0)
                 assert(brw_is_single_value_swizzle(inst->src[i].swizzle));
    
    So make sure that we use the same conditions when trying to
    copy-propagate. UNIFORMs will be converted to vstride 0 in
    convert_to_hw_regs, but so will ATTRs when interleaved (as will happen
    in a GS with multiple attributes). Since the vstride is not set at
    copy-prop time, infer it by inspecting dispatch_mode and reject ATTRs if
    they have non-scalar swizzles and are interleaved.
    
    Fixes assertion errors in dolphin-generated geometry shaders (or
    misrendering on opt builds) on Sandybridge or on IVB/HSW with
    INTEL_DEBUG=nodualobj.
    
    Co-authored-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93418
    Cc: "11.0 11.1" <mesa-stable@lists.freedesktop.org>

:040000 040000 94f60208f3cd3e0345ea3201f522616d7c36272a c0846463c47e4d72e129afdd4efcf90afa5ee71b M	src
bisect run success
Comment 1 Ilia Mirkin 2016-02-08 20:11:50 UTC
From a quick glance, this appears to be a test shortcoming, not an issue with the actual patch. It assumes that prog_data is there, which is true in real life, but I guess the test doesn't set that up.
Comment 2 Matt Turner 2016-02-08 23:32:23 UTC
Thanks. I've pushed this commit which solves it:

commit c300559fbfa6127320b78c130061fdb6a454658d
Author: Matt Turner <mattst88@gmail.com>
Date:   Mon Feb 8 15:32:12 2016 -0800

    i965/vec4: Update vec4 unit tests for commit 01dacc83ff.
    
    Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=94050

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.