Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Galaxy s7 edge crash
05-17-2016, 12:45 AM
Post: #62
RE: Galaxy s7 edge crash
No, thank you for testing. The hard part is really the trial and error in situations like this - we don't really know what's going on, so we have to probe the situation to figure out.

The test with block link on and the aligned code blocks sounds super good, but it's also super wasteful. Some games will hit performance problems because the jit cache space is being wasted so fast (games that run a lot of code every frame.)

Block linking is a good thing, but it's an optimization that only *sometimes* (well, most of the time) kicks in. I'm worried that if it crashes with it off, other games (or areas of this game) might crash even with it on. Even so, it's definitely major progress. We don't test with it off much, so I'm hoping there's just a bug happening when block cache is off.

If we can decrease the alignment a bit, it would really save space. Can you try this version?

Code:
while (((intptr_t)GetCodePtr()) & 0x3F) {
        HINT(HINT_NOP);
    }
(0xFF -> 0x3F)

If that works, we can try 0x1F or 0x0F too, which would waste even less space. My guess is that 0x3F is the lowest we can go, because that's the typical size of a cache line.

Another idea, that would be even better, is to disable that, and change the original code (from the post with instructions) to this:

Code:
void ARM64XEmitter::FlushIcacheSection(u8* start, u8* end)
{
    start = m_startcode + 4096 < start ? start - 4096 : m_startcode;
    end += 4096;
    while ((intptr_t)start & 0xFC) {
        start -= 4;
    }
    while ((intptr_t)end & 0xFC) {
        start += 4;
    }
#if defined(IOS)
    // Header file says this is equivalent to: sys_icache_invalidate(start, end - start);
    sys_cache_control(kCacheFunctionPrepareForExecution, start, end - start);
#else
#if defined(__clang__) && !defined(_M_IX86) && !defined(_M_X64)
    __clear_cache(start, end);
#else
#if !defined(_M_IX86) && !defined(_M_X64)
    __builtin___clear_cache(start, end);
#endif
#endif
#endif
}

This is a quick hack, but it aligns the start and end addresses of cache clears to 256. If aligning the cache clears is all that's needed, we don't need to waste space with the jit blocks. It'd be great if this option worked.

If it does, even better would be to reduce the three 4096s to like 256 or 64, or even 0. If it works with aligned clears with 0 padding, that would be awesome. There'd probably be nearly no performance penalty (some of this penalty is not immediately obvious... e.g. might cost more during loading than during actual gameplay, but both matter.)

All of this with block linking on.

Thanks again for the testing.

-[Unknown]
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Galaxy s7 edge crash - cha0tic - 03-12-2016, 02:34 PM
RE: Galaxy s7 edge crash - KingPepper - 03-12-2016, 04:55 PM
RE: Galaxy s7 edge crash - cha0tic - 03-12-2016, 07:08 PM
RE: Galaxy s7 edge crash - Henrik - 03-12-2016, 07:20 PM
RE: Galaxy s7 edge crash - cha0tic - 03-12-2016, 07:23 PM
RE: Galaxy s7 edge crash - cha0tic - 03-13-2016, 05:31 PM
RE: Galaxy s7 edge crash - thienbaont - 03-14-2016, 03:40 AM
RE: Galaxy s7 edge crash - cha0tic - 03-14-2016, 04:02 AM
RE: Galaxy s7 edge crash - jajabinx35 - 03-15-2016, 08:30 PM
RE: Galaxy s7 edge crash - cha0tic - 03-16-2016, 11:14 PM
RE: Galaxy s7 edge crash - nex86 - 03-17-2016, 04:05 AM
RE: Galaxy s7 edge crash - thienbaont - 03-17-2016, 04:12 AM
RE: Galaxy s7 edge crash - nex86 - 03-17-2016, 04:14 AM
RE: Galaxy s7 edge crash - cha0tic - 03-17-2016, 08:09 AM
RE: Galaxy s7 edge crash - heneli627 - 03-17-2016, 02:46 PM
RE: Galaxy s7 edge crash - nex86 - 03-17-2016, 03:24 PM
RE: Galaxy s7 edge crash - Ifoozle - 03-18-2016, 04:32 AM
RE: Galaxy s7 edge crash - jajabinx35 - 03-18-2016, 09:30 AM
RE: Galaxy s7 edge crash - cha0tic - 03-20-2016, 06:09 AM
RE: Galaxy s7 edge crash - Bronxc - 03-20-2016, 04:50 PM
RE: Galaxy s7 edge crash - Ifoozle - 03-20-2016, 07:46 PM
RE: Galaxy s7 edge crash - [Unknown] - 03-22-2016, 03:01 AM
RE: Galaxy s7 edge crash - cha0tic - 03-22-2016, 07:49 PM
RE: Galaxy s7 edge crash - [Unknown] - 03-22-2016, 11:45 PM
RE: Galaxy s7 edge crash - chdcchris - 03-22-2016, 10:15 PM
RE: Galaxy s7 edge crash - nex86 - 03-23-2016, 01:53 AM
RE: Galaxy s7 edge crash - Warmachine02 - 04-04-2016, 06:07 PM
RE: Galaxy s7 edge crash - heneli627 - 04-06-2016, 07:19 PM
RE: Galaxy s7 edge crash - jajabinx35 - 04-07-2016, 08:56 AM
RE: Galaxy s7 edge crash - TkSilver - 04-07-2016, 01:33 PM
RE: Galaxy s7 edge crash - jajabinx35 - 04-09-2016, 03:47 PM
RE: Galaxy s7 edge crash - Henrik - 04-09-2016, 05:32 PM
RE: Galaxy s7 edge crash - Warmachine02 - 04-09-2016, 05:49 PM
RE: Galaxy s7 edge crash - jajabinx35 - 04-09-2016, 06:40 PM
RE: Galaxy s7 edge crash - solid89 - 04-12-2016, 08:05 AM
RE: Galaxy s7 edge crash - LoAndEvolve - 04-12-2016, 10:05 AM
RE: Galaxy s7 edge crash - [Unknown] - 04-12-2016, 12:41 PM
RE: Galaxy s7 edge crash - brujo55 - 04-12-2016, 03:51 PM
RE: Galaxy s7 edge crash - [Unknown] - 04-12-2016, 06:08 PM
RE: Galaxy s7 edge crash - hitori - 04-13-2016, 04:58 PM
RE: Galaxy s7 edge crash - nex86 - 04-15-2016, 06:05 AM
RE: Galaxy s7 edge crash - hitori - 04-15-2016, 05:58 PM
RE: Galaxy s7 edge crash - destinyfates - 04-21-2016, 12:35 PM
RE: Galaxy s7 edge crash - jajabinx35 - 04-21-2016, 01:49 PM
RE: Galaxy s7 edge crash - TkSilver - 04-21-2016, 03:40 PM
RE: Galaxy s7 edge crash - fredwu - 04-27-2016, 03:17 PM
RE: Galaxy s7 edge crash - dazemu - 04-30-2016, 10:48 AM
RE: Galaxy s7 edge crash - jajabinx35 - 05-03-2016, 11:15 AM
RE: Galaxy s7 edge crash - Warmachine02 - 05-04-2016, 10:10 PM
RE: Galaxy s7 edge crash - jajabinx35 - 05-05-2016, 08:19 AM
RE: Galaxy s7 edge crash - Bobby_Flamingo - 05-15-2016, 06:24 AM
RE: Galaxy s7 edge crash - [Unknown] - 05-15-2016, 08:19 PM
RE: Galaxy s7 edge crash - Jaaan - 05-16-2016, 11:30 AM
RE: Galaxy s7 edge crash - Henrik - 05-16-2016, 01:11 PM
RE: Galaxy s7 edge crash - Jaaan - 05-16-2016, 01:35 PM
RE: Galaxy s7 edge crash - [Unknown] - 05-16-2016, 03:54 PM
RE: Galaxy s7 edge crash - Jaaan - 05-16-2016, 04:14 PM
RE: Galaxy s7 edge crash - [Unknown] - 05-16-2016, 04:27 PM
RE: Galaxy s7 edge crash - Jaaan - 05-16-2016, 04:53 PM
RE: Galaxy s7 edge crash - [Unknown] - 05-16-2016, 05:57 PM
RE: Galaxy s7 edge crash - Jaaan - 05-16-2016, 06:49 PM
RE: Galaxy s7 edge crash - [Unknown] - 05-17-2016 12:45 AM
RE: Galaxy s7 edge crash - Jaaan - 05-17-2016, 11:07 AM
RE: Galaxy s7 edge crash - [Unknown] - 05-17-2016, 05:17 PM
RE: Galaxy s7 edge crash - Jaaan - 05-17-2016, 06:59 PM
RE: Galaxy s7 edge crash - [Unknown] - 05-18-2016, 04:35 AM
RE: Galaxy s7 edge crash - Jaaan - 05-18-2016, 10:59 AM
RE: Galaxy s7 edge crash - Bobby_Flamingo - 05-18-2016, 11:58 PM
RE: Galaxy s7 edge crash - [Unknown] - 05-22-2016, 01:40 AM
RE: Galaxy s7 edge crash - jakal7x - 05-22-2016, 08:21 AM
RE: Galaxy s7 edge crash - [Unknown] - 05-22-2016, 03:13 PM
RE: Galaxy s7 edge crash - jakal7x - 05-23-2016, 12:15 PM
RE: Galaxy s7 edge crash - cha0tic - 05-23-2016, 03:58 AM
RE: Galaxy s7 edge crash - [Unknown] - 05-24-2016, 03:49 AM
RE: Galaxy s7 edge crash - Henrik - 05-24-2016, 06:58 AM
RE: Galaxy s7 edge crash - jakal7x - 05-25-2016, 01:20 AM
RE: Galaxy s7 edge crash - jajabinx35 - 05-25-2016, 05:53 PM
RE: Galaxy s7 edge crash - jajabinx35 - 05-28-2016, 12:36 PM
RE: Galaxy s7 edge crash - HANZ64 - 07-19-2016, 09:22 PM
RE: Galaxy s7 edge crash - PsyEd - 08-18-2016, 06:03 AM
RE: Galaxy s7 edge crash - n1kokpo12 - 08-26-2016, 02:36 AM
RE: Galaxy s7 edge crash - n1kokpo12 - 08-27-2016, 12:13 AM
RE: Galaxy s7 edge crash - TkSilver - 08-27-2016, 02:51 AM
RE: Galaxy s7 edge crash - [Unknown] - 09-10-2016, 05:47 PM
RE: Galaxy s7 edge crash - PsyEd - 09-21-2016, 11:20 PM
RE: Galaxy s7 edge crash - HANZ64 - 09-22-2016, 04:18 AM
RE: Galaxy s7 edge crash - RoronoARK - 09-23-2016, 03:10 PM

Forum Jump: