merge sort cmopiles & runs

This commit is contained in:
Evghenii
2014-01-29 19:39:39 +01:00
parent 73c6989951
commit e6d7a493cc

View File

@@ -8,7 +8,7 @@
static inline static inline
int nextPowerOfTwo(int x) int nextPowerOfTwo(int x)
{ {
#if 1 #if 0
--x; --x;
x |= x >> 1; x |= x >> 1;
x |= x >> 2; x |= x >> 2;
@@ -414,7 +414,7 @@ static uniform int MAX_SAMPLE_COUNT = 0;
export export
void openMergeSort() void openMergeSort()
{ {
MAX_SAMPLE_COUNT = 32 * 131072 / programCount; MAX_SAMPLE_COUNT = 8*32 * 131072 / programCount;
assert(memPool == NULL); assert(memPool == NULL);
const uniform int nalloc = MAX_SAMPLE_COUNT * 4; const uniform int nalloc = MAX_SAMPLE_COUNT * 4;
memPool = uniform new uniform int[nalloc]; memPool = uniform new uniform int[nalloc];
@@ -498,6 +498,7 @@ void mergeSort(
copyKernel(oVal + (N - lastSegmentElements), iVal + (N - lastSegmentElements), lastSegmentElements); copyKernel(oVal + (N - lastSegmentElements), iVal + (N - lastSegmentElements), lastSegmentElements);
} }
#if 1
{ {
uniform int * uniform tmpKey = iKey; uniform int * uniform tmpKey = iKey;
iKey = oKey; iKey = oKey;
@@ -509,5 +510,6 @@ void mergeSort(
iVal = oVal; iVal = oVal;
oVal = tmpVal; oVal = tmpVal;
} }
#endif
} }
} }