Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost of Sparta crashing with jit/ir in some situations (HW tess?) #10897

Closed
zminhquanz opened this issue Apr 10, 2018 · 38 comments
Closed

Ghost of Sparta crashing with jit/ir in some situations (HW tess?) #10897

zminhquanz opened this issue Apr 10, 2018 · 38 comments
Milestone

Comments

@zminhquanz
Copy link
Contributor

What happens?
GOW Ghost of Sparta crashed when i'm turn on HW Tessellation at this scene , when i'm turn off , it's normal , crashed appear the same in Mobile
image
image

@unknownbrackets
Copy link
Collaborator

That looks somewhat like jit. If you enable the IR Interpreter instead of jit, does it still crash? And if so, does it give a more useful Call Stack?

-[Unknown]

@zminhquanz
Copy link
Contributor Author

zminhquanz commented Apr 10, 2018

image
Same for JIT , i switch to IR Interpreter , it still crashes ( HW Tessellation On )

@zminhquanz
Copy link
Contributor Author

Oh , I find out , fast memory caused crashes , this is my mistake , so I closed this

@hrydgard
Copy link
Owner

Hm. If fast memory crashes, there's still some issue, though may not really be related to tesselation..

@zminhquanz zminhquanz reopened this Apr 10, 2018
@zminhquanz
Copy link
Contributor Author

zminhquanz commented Apr 10, 2018

@hrydgard Hm , I tested on these conditions
Condition 1 : HW Tessellation On , Fast Memory Off , It doesn't crash
Condition 2 : HW Tessellation Off , Fast Memory On , It doesn't crash , but on Mobile i tested it'll crash
Condition 3 : HW Tessellation On , Fast Memory On , It'll crash and throw the exception
image

@hrydgard
Copy link
Owner

Any idea if this is new, or if it's happened for a long time in this place in the game? Do you have a savegame nearby?

@zminhquanz
Copy link
Contributor Author

zminhquanz commented Apr 10, 2018

@hrydgard yeah , i load game in savegame , not using save state . I play this game from beginning to this scene

@hrydgard
Copy link
Owner

hrydgard commented Apr 10, 2018

Well I meant, can you upload the savegame? Useful for debugging this. Or I guess if this is right at the beginning, that's not needed :)

@zminhquanz
Copy link
Contributor Author

GOW savedata.zip
Here is it , you can check it again

@zminhquanz
Copy link
Contributor Author

@hrydgard Hey , how was it , can you found a bug ?

@hrydgard
Copy link
Owner

Sorry, today I've been working on restoring hardware skinning. But will take a look soon.

@zminhquanz zminhquanz changed the title HW Tessellation caused crash PPSSPP Fast memory caused crash PPSSPP Apr 11, 2018
@Leopard20
Copy link
Contributor

@hrydgard
Sorry for asking this here. What is hardware skinning? How does it compare with software skinning?

@weihuoya
Copy link
Contributor

use Interpreter, not crash

use IR Interpreter, m is nullptr, crash

int IRDestGPR(const IRInst &inst) {
	const IRMeta *m = GetIRMeta(inst.op);

	if ((m->flags & IRFLAG_SRC3) == 0 && m->types[0] == 'G') {
		return inst.dest;
	}
	return -1;
}

JIT, crash

@weihuoya
Copy link
Contributor

inst.op is RestoreRoundingMode 94

@hrydgard
Copy link
Owner

Thanks @weihuoya , that's helpful! I'll look into this soon.

@Leopard20 The PSP has a rather peculiar way of doing bones/skeletal animation ( https://en.wikipedia.org/wiki/Skeletal_animation ) in hardware. We have to emulate it, and it can either be done by performing all the math in vertex shaders on the GPU, which is what we call "hardware skinning", or on the CPU, which we call "software skinning". Unfortunately games are not very efficient about how they use this feature, they will draw a few triangles, upload a new bone matrix, then draw a few more etc. This is expensive for us to do on the GPU since that's a lot of "draw calls", but if we do it on the CPU, we can combine them. So effectively:

  • If games use a lot of small draws and switches bones a lot, and draw calls are slow (like OpenGL), software skinning wins since we can make much fewer draw calls, but it's a bit more CPU work.
  • If games use very large draws, or draw calls are fast, hardware skinning can be equally fast or in rare cases faster.

@hrydgard
Copy link
Owner

@weihuoya Added a fix for the IR Interpreter bug. Won't fix the JIT problem though, or whatever it is.

@weihuoya
Copy link
Contributor

RestoreRoundingMode, crash

u32 IRInterpret(MIPSState *mips, const IRInst *inst, int count) {
	default:
			Crash();
}

@hrydgard
Copy link
Owner

hrydgard commented Apr 11, 2018

Huh. Seems we never properly implemented these ops. @unknownbrackets do you remember why we emit Apply/Restore/UpdateRoundingMode in the IR interpreter but don't have any code to interpret them?

@hrydgard
Copy link
Owner

Added some code to ignore those for now, will need to get them implemented at some point.

@weihuoya
Copy link
Contributor

IR Interpreter crash there, maybe same with jit.

inline u32 ReadUnchecked_U32(const u32 address) {
	return *(u32_le *)(base + address);
}
u32 IRInterpret(MIPSState *mips, const IRInst *inst, int count) {
	case IROp::Load32:
		mips->r[inst->dest] = Memory::ReadUnchecked_U32(mips->r[inst->src1] + inst->constant);
		break;
}

inst is begin+4

s

@zminhquanz
Copy link
Contributor Author

zminhquanz commented Apr 11, 2018

@hrydgard Oh , look like it's a CPU Core problem
@weihuoya Yeah , i tested with IR Interpreter and JIT , two of them crashes

@hrydgard
Copy link
Owner

hrydgard commented Apr 11, 2018

Yeah, seems likely. But confusing :) thanks.

@unknownbrackets
Copy link
Collaborator

@hrydgard well, I think you added them, we probably never finished with them?

We'd also added the metadata here:
https://github.com/hrydgard/ppsspp/commits/ir-fpu-round

-[Unknown]

@hrydgard
Copy link
Owner

Hm. but when did they then disappear from IRInst and IRInterpret? Because they weren't there now.

Guess I gotta go git digging...

@unknownbrackets
Copy link
Collaborator

We never merged that branch, I think it wasn't working still?

-[Unknown]

@hrydgard
Copy link
Owner

Oh, right :/

@zminhquanz
Copy link
Contributor Author

@hrydgard I think if you didn't fix that bug , so the temporary solution is Turn off Fast Memory

@weihuoya
Copy link
Contributor

an invalid memory access, turn off fast memory will ignore this access

@unknownbrackets unknownbrackets changed the title Fast memory caused crash PPSSPP Ghost of Sparta crashing with jit/ir in some situations (HW tess?) Apr 15, 2018
@unknownbrackets
Copy link
Collaborator

unknownbrackets commented Apr 15, 2018

Just to say: fast memory is like using a knife to cook food. Turning it off is like using a knife and taking tons of painkiller medicine.

So if you cut yourself by accident with fast memory on, you crash and stop cooking. If you cut yourself while fast memory is off, you just don't notice and keep cooking. Sometimes it's only a tiny scratch, so maybe it's okay.

The PSP always uses fast memory. Games crash immediately when they cut themselves. So we have a bug if the game is cutting itself, but the bug (probably) isn't with fast memory - it's somewhere else.

What's interesting here is if it doesn't crash with the interpreter. Unless I'm mistaken, the interpreter ALWAYS runs in fast memory mode. So that would imply a jit bug (potentially all backends if the IR interpreter shares the problem.)

-[Unknown]

@zminhquanz
Copy link
Contributor Author

@unknownbrackets yeah , some situation , HW Tess caused crashed when turn on fast memory with JIT/IR , turn off HW Tess is temporary fix but sometimes it crashes

@zminhquanz
Copy link
Contributor Author

We need to implement to ignore this or fix this @hrydgard

@rolffot
Copy link

rolffot commented Dec 28, 2019

Here you may be interested, to skip this error, you have deactivated the fast memory and set the CPU speed to 101, so it has not exploded and after jumping all the position as it was before. I comment in case someone got stuck and could not pass.

regards

@rolffot
Copy link

rolffot commented Dec 28, 2019

Screenshot_20191228-190526
Screenshot_20191228-190623

@ghost
Copy link

ghost commented Sep 8, 2021

@zminhquanz is HW Tessellation is related to crash? or fast memory only? on android.
Recently hrydgard fixed the issue on hw tessellation on neo game stations maybe that help this.?

@ghost
Copy link

ghost commented Oct 1, 2021

What happens? GOW Ghost of Sparta crashed when i'm turn on HW Tessellation at this scene , when i'm turn off , it's normal , crashed appear the same in Mobile image image

I cannot reproduce this issue on the latest build possibility this was fixed by #14805?

@ghost
Copy link

ghost commented Oct 1, 2021

Here's the the proof.
Vulkan ✓
HW Tessellation ✓
Fast Memory ✓

Screenrecorder-2021-10-01-22-04-46-55.online-video-cutter.com.mp4

@unknownbrackets
Copy link
Collaborator

Great, thanks for checking. I think there's a good chance that would've helped. I'll close this.

If anyone has more information or can confirm it still happens in the latest git builds, please reply to this issue with more details (i.e. which device and specific git build version), and it'll be reopened. If you have a new issue with the same game, just create a new issue instead.

-[Unknown]

@ghost
Copy link

ghost commented Oct 1, 2021

IDK why in that particular area still crashing using ir interpreter created new issue #14958

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants