[Bug 93840] [i965] Compiler backend uses too much stack with Alien: Isolation

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Mon Feb 13 16:50:19 UTC 2017


https://bugs.freedesktop.org/show_bug.cgi?id=93840

--- Comment #23 from Eero Tamminen <eero.t.tamminen at intel.com> ---
(In reply to Eero Tamminen from comment #22)
> Short term workaround in Mesa could be checking current thread's stack size
> before compilation and fixing the size, if it's set too low by the
> application.

Tried:

* Adding such functionality to _mesa_compile_shader() -> there were still
crashes

* Using LD_PRELOAD for pthread_attr_setstacksize() which filters out all calls
setting stack sizes <8MB -> game works fine (so doing same manually with Gdb
wasn't just timing related luck)

-> I assume compiler thread isn't the only one with stack size issues

(And this isn't the only issue with this game's stack handling, its stack is
both writable & executable which is security-wise nasty for anything
networked.)


Btw. While testing the Mesa workaround, I bumped also into larger reg
allocation:
(gdb) bt
#0  __memset_avx2 () at ../sysdeps/x86_64/multiarch/memset-avx2.S:161
#1  0x00007f935282bf5c in memset (__len=968064, __ch=0, __dest=0x7f934000a6c0)
at /usr/include/x86_64-linux-gnu/bits/string3.h:90
#2  fs_instruction_scheduler::calculate_deps (this=0x7f93400f6e90) at
../../../../../../src/mesa/drivers/dri/i965/brw_schedule_instructions.cpp:991
(gdb) print 968064/16/8
$1 = 7563

That's 1MB stack allocation for this one array... 


> As to longer term solution... Just changing compiler to do larger allocs
> from heap instead of using stack, will still assume certain amount of stack
> being free, and it's not easy to track how much each compiler commit changes
> that.
> -> Better would be doing compilation in separate thread (i.e. where
> application won't mess with its stack size).

That would hopefully also speed up AlienIsolation startup, both to main menu,
and from that to actual game.  Currently it's really slow.

-- 
You are receiving this mail because:
You are the QA Contact for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/intel-3d-bugs/attachments/20170213/8cf3bfd9/attachment.html>


More information about the intel-3d-bugs mailing list