Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Developing most optimal DotProduct function



Well, I rechecked the code several times (and took a walk several times too :))

Originaly, i was using vecLib's "dotpr" function as a reference point, and had a bit-to-bit match with dotpr's results.
Now, as i de-serialized the Sum, i am getting different results
Here is a test output showing the mismatches then relative error is larger then 1%
Result mismatch, orig -7.40401e-08 new -7.49715e-08 diff -9.31323e-10 rel 0.0125786 VecLib -7.40401e-08
Result mismatch, orig 7.91624e-09 new 8.84756e-09 diff 9.31323e-10 rel 0.117647 VecLib 7.91624e-09
Result mismatch, orig 5.40167e-08 new 5.21541e-08 diff -1.86265e-09 rel 0.0344828 VecLib 5.40167e-08
Result mismatch, orig 7.82311e-08 new 7.91624e-08 diff 9.31323e-10 rel 0.0119048 VecLib 7.82311e-08
Result mismatch, orig 3.44589e-08 new 3.35276e-08 diff -9.31323e-10 rel 0.027027 VecLib 3.44589e-08
Result mismatch, orig 6.0536e-09 new 5.58794e-09 diff -4.65661e-10 rel 0.0769231 VecLib 6.0536e-09
Result mismatch, orig 4.88944e-08 new 4.98258e-08 diff 9.31323e-10 rel 0.0190476 VecLib 4.88944e-08
Result mismatch, orig -4.19095e-09 new -4.65661e-09 diff -4.65661e-10 rel 0.111111 VecLib -4.19095e-09
Result mismatch, orig -1.90921e-08 new -1.81608e-08 diff 9.31323e-10 rel 0.0487805 VecLib -1.90921e-08
Result mismatch, orig 5.30854e-08 new 5.21541e-08 diff -9.31323e-10 rel 0.0175439 VecLib 5.30854e-08

"orig" is my original altivec-accelerated function, "new" is the function with deserialized Sum. "VecLib" is the result obtained from dotpr.
diff is the difference between two results (original and new), and rel is relative error.
  double diffRes1 = (double)Result1 - (double)Result1Old;
  double relErrRes1 = fabs( (double)diffRes1/(double)Result1Old);

The largest relative error i am getting is with the smallest values. Absolute error is rather small, but because the numbers are small to, relative error appear to be too large.



On Nov 7, 2005, at 7:41 PM, Holger Bettag wrote:

Sometimes the relative error is rather high, like 11% or so.

That does sound like way too much.

I think i did something wrong with shifting to partial sums, but i can
not guess what.

When that happens to me, it is usually a stupid mistake like forgetting to
rename a variable in the tail loop, when its meaning has slightly changed
in the main loop. Or something like that. Take a walk, and look at the
code again in an hour with a fresh mind. :-)


--
Sincerely,
	Rustam Muginov

_______________________________________________
Do not post admin requests to the list. They will be ignored.
PerfOptimization-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/perfoptimization-dev/email@hidden

This email sent to email@hidden
References: 
 >Developing most optimal DotProduct function (From: Rustam Muginov <email@hidden>)
 >Re: Developing most optimal DotProduct function (From: Holger Bettag <email@hidden>)
 >Re: Developing most optimal DotProduct function (From: Rustam Muginov <email@hidden>)
 >Re: Developing most optimal DotProduct function (From: Holger Bettag <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.