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

Crashes on mvdsv 0.32 #17

Closed
drzel opened this issue Aug 13, 2018 · 2 comments
Closed

Crashes on mvdsv 0.32 #17

drzel opened this issue Aug 13, 2018 · 2 comments

Comments

@drzel
Copy link
Member

drzel commented Aug 13, 2018

12:40 AM] drzel: hey @meag I'm really hoping to upgrade my server to 0.32 if possible, is there anything else I can do re: QW-Group/mvdsv#34 ?
GitHub
Server dying after about 90 seconds · Issue #34 · deurk/mvdsv
Hey I'm running 0.31 fine at qw://fortressone.ga Compiled 0.32 and swapped out the binary and the server crashes after about 90 seconds with: sv_error: Program error At least that's what I ...

[12:41 AM] meag: are you compiling it with the same flags etc as you compiled 0.31?
[1:16 AM] Spoike: @drzel which qcc are you using?
[1:18 AM] Spoike: I'm assuming its frikqcc
[1:21 AM] Spoike: frikqcc (when using -O3 or whatever it was) also enables a 'logic-ops' optimisation.
[1:21 AM] Spoike: this allows it to short-circuit conditionals in an attempt to avoid needing to evaluate expensive expressions (like function calls)
[1:23 AM] Spoike: it does this by using OP_IF/OP_IFNOT directly on the lhs of any && or || operators so that it can just skip over the logic needed for the rhs+dependant operations etc
[1:24 AM] Spoike: unfortunately, those two instructions expressely operate only on ints and not floats.
[1:25 AM] Spoike: this means that (-0.0 && -0.0) suddenly ends up considered as true, instead of false.(edited)
[1:26 AM] Spoike: bitwise, -0.0 == 0x80000000, so true
[1:27 AM] Spoike: unfortunately whether a float is 0 or not is more complicated than just testing the non-sign bits.
[1:28 AM] Spoike: not all cpus support denormalised floats for instance, and normally handle them as if they're 0 (this can be a potentially significant speedup for intel cpus for instance).
[1:29 AM] Spoike: so yeah, disable that optimisation or rewrite the qc so that it doesn't matter so much
[1:34 AM] drzel: Hrmmm honestly a lot of that has gone over my head. I’m compiling with gmqcc -std=gmqcc -fftepp @meag
[1:36 AM] drzel: I’m in bed now but really appreciate the explanation. I’ll pore over it tomorrow
[4:36 AM] Spoike: oh, I'm sure gmqcc works well enough with DP, but you're not using DP.
[5:49 AM] Spoike: you could try changing your player_run line to if not(self.velocity_x || self.velocity_y) (the not there actually being hexenc syntax). I assume that'll be understood by gmqcc too, and should ensure both places use the exact same early-out logic (thus fixing the issue), as well as being a smidge faster (not that two opcodes difference is all that significant).
[5:49 AM] Spoike: but if you have any similar cases in your code, you'll have to find+fix those too.
[7:20 PM] drzel: Oh wow that's awesome, I'll look at that thanks @spoike
[9:26 PM] drzel: So just to clarify @spoike, you're saying that the reason the server is dying on mvdsv 0.32, but not 0.31 might be resolved by either:

  • compiling qwprogs.dat with frikqcc, or
  • changing if (!self.velocity_x && !self.velocity_y) to if not(self.velocity_x || self.velocity_y) and anywhere else that might end up with float && float?
@lordee
Copy link
Member

lordee commented Aug 20, 2018

fixed?

@drzel
Copy link
Member Author

drzel commented Aug 20, 2018

Fixed

@drzel drzel closed this as completed Aug 20, 2018
drzel pushed a commit that referenced this issue Dec 23, 2018
bring shock/plasma up to date with master
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

2 participants