Bug 89607 - Assertion hit in opt_array_splitting with recursive array indexing
Summary: Assertion hit in opt_array_splitting with recursive array indexing
Status: RESOLVED FIXED
Alias: None
Product: Mesa
Classification: Unclassified
Component: Drivers/DRI/i965 (show other bugs)
Version: git
Hardware: Other All
: medium normal
Assignee: Ian Romanick
QA Contact: Intel 3D Bugs Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-03-17 09:57 UTC by Iago Toral
Modified: 2016-03-08 09:41 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:


Attachments
shader runner test file triggering the assertion (684 bytes, text/plain)
2015-03-17 10:01 UTC, Iago Toral
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Iago Toral 2015-03-17 09:57:01 UTC
Recursive array indexing where more than one array is used with non-constant indexing can lead to opt_array_splitting hitting an assertion after failing to realize that one of the arrays is not always accessed via constant indexing. This is present in master 1a469a34d517d4c2:

$ bin/shader_runner  opt_array_splitting_crash.test
shader_runner: opt_array_splitting.cpp:296: void ir_array_splitting_visitor::split_deref(ir_dereference**): Assertion `constant' failed.
Aborted (core dumped)

I'll attach the offending shader runner test.
Comment 1 Iago Toral 2015-03-17 10:01:00 UTC
Created attachment 114380 [details]
shader runner test file triggering the assertion

Notice that even if the crash is fixed the test won't pass with current master. For the test to pass we need to support recursive reladdr scratch access, which I implement here:
http://lists.freedesktop.org/archives/mesa-dev/2015-March/079631.html

If the crash is fixed and that patch is applied then the test should pass. I can get the test to pass with that patch by disabling the optimization pass to work around the assertion.
Comment 2 Iago Toral 2015-09-14 11:51:07 UTC
Patch sent for review:
http://lists.freedesktop.org/archives/mesa-dev/2015-September/094355.html
Comment 3 Timothy Arceri 2016-03-08 09:41:52 UTC
Fixed by:

commit	4a600024242be2b8684ab2cc215171f31db594b0

glsl/opt_array_splitting: Fix crash when doing array indexing into other arrays

When we find indirect indexing into an array, the current implementation
of the array spliiting optimization pass does not look further into the
expression tree. However, if the variable expression involves variable
indexing into other arrays, we can miss that these other arrays also have
variable indexing. If that happens, the pass will crash later on after
hitting an assertion put there to ensure that split arrays are in fact
always indexed via constants:

shader_runner: opt_array_splitting.cpp:296:
void ir_array_splitting_visitor::split_deref(ir_dereference**): Assertion `constant' failed.

This patch fixes the problem by letting the pass step into the variable
index expression to identify these cases properly.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89607
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>


bug/show.html.tmpl processed on Mar 24, 2017 at 12:07:32.
(provided by the Example extension).