Text archives Help
- From: boulos@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [MANTA] r1513 - in trunk: CMake Interface
- Date: Thu, 19 Jul 2007 14:31:57 -0600 (MDT)
Author: boulos
Date: Thu Jul 19 14:31:56 2007
New Revision: 1513
Modified:
trunk/CMake/ConfigCompilerFlags.cmake
trunk/Interface/RandomNumberGenerator.h
Log:
Removing incorrect ClassName:: from RNG interface
and leaving a comment about why this has moved from
the .cc to the .h
Disabling the strict aliasing warnings under gcc. They
are coming up to due to _mm_load_ps(&float_address) uses
and are probably not that useful anyway. I've left a
comment in the CMake file about why we're disabling the
warning instead of the optimization.
Modified: trunk/CMake/ConfigCompilerFlags.cmake
==============================================================================
--- trunk/CMake/ConfigCompilerFlags.cmake (original)
+++ trunk/CMake/ConfigCompilerFlags.cmake Thu Jul 19 14:31:56 2007
@@ -74,7 +74,10 @@
ENDIF(USING_ICPC)
####################
-SET(WARNING_FLAGS "-Wall")
+# NOTE(boulos): Using SSE loads on float arrays causes a lot of these
warnings. We don't
+# want to get rid of -fstrict-aliasing though, so I'm disabling the warning
(19-Jul-2007)
+###################
+SET(WARNING_FLAGS "-Wall -Wno-strict-aliasing")
SET(DEBUG_FLAGS "-O0 -g3")
SET(RELEASE_FLAGS "-O3 -DNDEBUG -g3 -fgcse-sm -funroll-loops
-fstrict-aliasing -fsched-interblock -ffast-math -freorder-blocks")
IF (USING_GCC)
Modified: trunk/Interface/RandomNumberGenerator.h
==============================================================================
--- trunk/Interface/RandomNumberGenerator.h (original)
+++ trunk/Interface/RandomNumberGenerator.h Thu Jul 19 14:31:56 2007
@@ -60,42 +60,49 @@
template<class T>
T next() { return 0; }
- virtual void RandomNumberGenerator::nextPacket(Packet<float>& results,
RayPacket& rays) {
+ // NOTE(boulos): Because random number generators in Core/Math
+ // like CheapRNG rely on this function there must be an
+ // implementation available to like the Manta_Core library. On
+ // Linux, it's okay to leave this undefined (and it'll just find
+ // it in Manta_Interface.lib at runtime) but Mac OS X is picky and
+ // wants libraries to be loadable on their own. So for now, this
+ // implementation is also in the header.
+ virtual void nextPacket(Packet<float>& results, RayPacket& rays) {
#ifdef MANTA_SSE
Packet<unsigned int> uints;
nextIntPacket(uints, rays);
for (int i = 0; i < Packet<float>::MaxSize; i+= 4) {
#if 0
- _mm_store_ps(&results.data[i],
-
_mm_mul_ps(_mm_cvtepi32_ps(_mm_load_si128((__m128i*)&uints.data[i])),
- _mm_set1_ps((float)(1./4294967296.))));
+ _mm_store_ps(&results.data[i],
+
_mm_mul_ps(_mm_cvtepi32_ps(_mm_load_si128((__m128i*)&uints.data[i])),
+ _mm_set1_ps((float)(1./4294967296.))));
#else
- // Mask out the top bit (since that's a signed number) but divide by
2/4294967296 instead
- static const float scale_float = 4.65661e-10f;
- _mm_store_ps(&results.data[i],
-
_mm_mul_ps(_mm_cvtepi32_ps(_mm_srli_epi32(_mm_load_si128((__m128i*)&uints.data[i]),
1)),
- _mm_set1_ps(scale_float)));
+ // Mask out the top bit (since that's a signed number) but divide by
2/4294967296 instead
+ static const float scale_float = 4.65661e-10f;
+ _mm_store_ps(&results.data[i],
+
_mm_mul_ps(_mm_cvtepi32_ps(_mm_srli_epi32(_mm_load_si128((__m128i*)&uints.data[i]),
1)),
+ _mm_set1_ps(scale_float)));
#if 0
- // Sanity check for RNGs.
- for (int c = 0; c < 4; c++) {
- if (results.data[i + c] < 0.f || results.data[i + c] >= 1.f) {
- throw SCIRun::InternalError("RNG generated number out of range
[0,1).", __FILE__, __LINE__);
- }
- }
+ // Sanity check for RNGs.
+ for (int c = 0; c < 4; c++) {
+ if (results.data[i + c] < 0.f || results.data[i + c] >= 1.f) {
+ throw SCIRun::InternalError("RNG generated number out of range
[0,1).", __FILE__, __LINE__);
+ }
+ }
#endif
#endif
}
#else
for (int i = 0; i < Packet<float>::MaxSize; i++) {
- results.set(i, nextFloat());
+ results.set(i, nextFloat());
}
#endif
}
- virtual void RandomNumberGenerator::nextPacket(Packet<double>& results,
RayPacket& rays) {
+ virtual void nextPacket(Packet<double>& results, RayPacket& rays) {
for (int i = 0; i < Packet<double>::MaxSize; i++) {
- results.set(i, nextDouble());
+ results.set(i, nextDouble());
}
}
- [MANTA] r1513 - in trunk: CMake Interface, boulos, 07/19/2007
Archive powered by MHonArc 2.6.16.