nan values when optimizations are turned on
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: nan values when optimizations are turned on
What platform/CPU is this on? The default release settings include the -ffast-math flag which omits certain finite math checks that a few CPUs need to operate correctly. Most modern CPUs (x86, PPC, ARM, etc) generally implement enough of the floating point standard in silicon that you don't need the extra finite math checks. That is my best guess of what is happening anyway.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: nan values when optimizations are turned on
Hmm. That's weird then. Are you sure it's an issue in the Chipmunk code? Are you building a static library for Chipmunk using the scripts or as source in your project? If you are using the scripts, you'll never have a debug version built of the lib on device, which would mean the issue is outside somewhere. If you are building Chipmunk from source within your project, I'd recommend making a separate target for it so you can more carefully control the compile options to track down where the issue is.
CPUs in iOS devices do infinite math just fine and Chipmunk doesn't use NaN checks. AFAIK, the only way I know to end up with NaNs coming out of Chipmunk is to pass bad numbers in.
CPUs in iOS devices do infinite math just fine and Chipmunk doesn't use NaN checks. AFAIK, the only way I know to end up with NaNs coming out of Chipmunk is to pass bad numbers in.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: nan values when optimizations are turned on
Did end up picking up a retina iPad yesterday. There is definitely something fishy going on. Am looking into it now.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: nan values when optimizations are turned on
/me facepalm
Yup, be careful about those casts. Pick any line in the NEON optimized solver and it looks something like this:
float32x2_t vb1 = vadd_f32(vBias_a, vmul_n_f32(r1p, vget_lane_f32(wBias, 0)));
Crud... Realistically this would indicate that you are probably the first person to even attempt running Pro on 64 bit, which is a little surprising. I guess most people use the prebuilt binaries?
I could use quad sized registers, but that would mean half as many registers to use. I wouldn't expect it to run much faster than using regular doubles either.
So you have a few options:
* Set up Chipmunk not to use doubles on 64 bit. (You lose CGPoint <-> cpVect equivalency which is handy)
* Disable the NEON optimized solver. (You lose some performance)
* Don't build for 64 bit. (You don't lose much right now honestly)
I'm looking into making a double version of the solver, but I wouldn't really hold my breath. I wouldn't expect it to outperform the regular solver by much, and would be surprised if it was comparable to the NEON/float version of the solver. It's looking like it will require a rewrite too.
Yup, be careful about those casts. Pick any line in the NEON optimized solver and it looks something like this:
float32x2_t vb1 = vadd_f32(vBias_a, vmul_n_f32(r1p, vget_lane_f32(wBias, 0)));
Crud... Realistically this would indicate that you are probably the first person to even attempt running Pro on 64 bit, which is a little surprising. I guess most people use the prebuilt binaries?
I could use quad sized registers, but that would mean half as many registers to use. I wouldn't expect it to run much faster than using regular doubles either.
So you have a few options:
* Set up Chipmunk not to use doubles on 64 bit. (You lose CGPoint <-> cpVect equivalency which is handy)
* Disable the NEON optimized solver. (You lose some performance)
* Don't build for 64 bit. (You don't lose much right now honestly)
I'm looking into making a double version of the solver, but I wouldn't really hold my breath. I wouldn't expect it to outperform the regular solver by much, and would be surprised if it was comparable to the NEON/float version of the solver. It's looking like it will require a rewrite too.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 1 guest