Author Topic: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)  (Read 5888 times)

0 Members and 1 Guest are viewing this topic.

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
Well the good news is the performance gain alone may be enough incentive for a mass effort to fix all the old models floating around.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
That is on ARM, i dont think x86 will have any performance gain im afraid. But i will check just to be sure.

At any rate, ARM is becoming more and more powerfull and common.

  

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:16:47 am by ShivanSpS »

 

Offline taylor

  • Super SCP/Linux Guru
  • Moderator
  • 212
    • http://www.icculus.org/~taylor
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
ARM is little endian so that code is unused in this case. But yeah, that 1 byte at the start is :sigh:. Even if that swapping code is unused, that 1 byte means the shield collision data is going to be unaligned.

INTEL_INT/INTEL_FLOAT are for byte swapping.

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
Then disabling SLDC data loading on archs that are not x86 is the way to go, because the workaround i came out with in fvi.cpp with all those memcpy that are done at every shild hit is in no way faster and fixing SLDC for non x86 archs would mean having to do it again, chaging that char for an int, making models incompatible.

Maybe there is some other way, but no other comes to mind right now. Dealing with it would need to do an unaligned access at some point or the other, that you can never be sure that the kernel is going to be able to fix or not.

Now if i can only figure out what bit of data is causing the release build to crash at model load on bsp_collide_tree...

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
Why would the model alignment affect FPS?  Aren't models completely loaded into memory before the mission starts?  So during the mission they should be referenced from their FSO data structure, not from the POF file.

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:17:03 am by ShivanSpS »

 

Offline Col. Fishguts

  • voodoo doll
  • 211
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
Maybe there is some other way, but no other comes to mind right now. Dealing with it would need to do an unaligned access at some point or the other, that you can never be sure that the kernel is going to be able to fix or not.

This thread triggers PTSD flashbacks from when I was trying to get a Doom sourceport working on a Sparc workstation (sparc64 doesn't take a performance hit with unaligned memory access, it just goes lolnope SIGBUS).

Unaligned POF data needs to be fixed externally, but the unaligned structs in FSO code you should be able to fix by telling gcc to enforce alignment during compile time:

https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Type-Attributes.html

Sprinkle in "__attribute__ ((aligned (4)))"
(or 8) where needed.

I know other compilers (like the Sun CC) have command line flags to enforce that globally during compilation, but gcc seems to be missing such a feature?
"I don't think that people accept the fact that life doesn't make sense. I think it makes people terribly uncomfortable. It seems like religion and myth were invented against that, trying to make sense out of it." - D. Lynch

Visit The Babylon Project, now also with HTL flavour  ¦ GTB Rhea

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:17:19 am by ShivanSpS »

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:17:30 am by ShivanSpS »

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:17:42 am by ShivanSpS »

 

Offline Goober5000

  • HLP Loremaster
  • Moderator
  • 214
    • Goober5000 Productions
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
This is part of the scripting system.  There have been several fixes to that over the years; it's entirely possible that this is related.  See these PRs for example:
https://github.com/scp-fs2open/fs2open.github.com/pull/2119
https://github.com/scp-fs2open/fs2open.github.com/pull/1960

You may be stuck with coding up an alignment-fixer-loader, unless you want to be restricted to only a subset of mods.  There are literally thousands of POFs that have been released for FreeSpace -- perhaps tens of thousands -- and it would be impractical to fix them all.

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
Perhaps, but starting with ones released on Knossos would be a big win and a much smaller subset.
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:17:53 am by ShivanSpS »

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:18:07 am by ShivanSpS »

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:18:17 am by ShivanSpS »

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
I wonder if we could integrate this conversion into knossos/nebula if it ever gets stable enough...
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:18:27 am by ShivanSpS »

 

Offline ShivanSpS

  • 210
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
-removed-
« Last Edit: August 25, 2020, 11:18:36 am by ShivanSpS »

 

Offline chief1983

  • Still lacks a custom title
  • Moderator
  • 212
  • ⬇️⬆️⬅️⬅️🅰➡️⬇️
    • Minecraft
    • Skype
    • Steam
    • Twitter
    • Fate of the Galaxy
Re: [3.7.2-ARM] Unaligned Memory Access at modeloctant.cpp:28 (title edited)
Just compile it default disabled on ARM maybe.  Just like SLDC.  Solved!
Fate of the Galaxy - Now Hiring!  Apply within | Diaspora | SCP Home | Collada Importer for PCS2
Karajorma's 'How to report bugs' | Mantis
#freespace | #scp-swc | #diaspora | #SCP | #hard-light on EsperNet

"You may not sell or otherwise commercially exploit the source or things you created based on the source." -- Excerpt from FSO license, for reference

Nuclear1:  Jesus Christ zack you're a little too hamyurger for HLP right now...
iamzack:  i dont have hamynerge i just want ptatoc hips D:
redsniper:  Platonic hips?!
iamzack:  lays