<html>
<head>
<base href="https://bugs.freedesktop.org/">
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW - [i965] Compiler backend uses too much stack with Alien: Isolation"
href="https://bugs.freedesktop.org/show_bug.cgi?id=93840#c23">Comment # 23</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW - [i965] Compiler backend uses too much stack with Alien: Isolation"
href="https://bugs.freedesktop.org/show_bug.cgi?id=93840">bug 93840</a>
from <span class="vcard"><a class="email" href="mailto:eero.t.tamminen@intel.com" title="Eero Tamminen <eero.t.tamminen@intel.com>"> <span class="fn">Eero Tamminen</span></a>
</span></b>
<pre>(In reply to Eero Tamminen from <a href="show_bug.cgi?id=93840#c22">comment #22</a>)
<span class="quote">> 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.</span >
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...
<span class="quote">> 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).</span >
That would hopefully also speed up AlienIsolation startup, both to main menu,
and from that to actual game. Currently it's really slow.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the QA Contact for the bug.</li>
</ul>
</body>
</html>