Changeset: 0214f0222022 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0214f0222022
Modified Files:
        monetdb5/extras/bwd/operations.c
Branch: bwd
Log Message:

* okay, I still had some segfaults when running tpch q6, they're fixed for 
full-resolution data


Unterschiede (97 Zeilen):

diff --git a/monetdb5/extras/bwd/operations.c b/monetdb5/extras/bwd/operations.c
--- a/monetdb5/extras/bwd/operations.c
+++ b/monetdb5/extras/bwd/operations.c
@@ -71,7 +71,9 @@ clHead* getPositionsColumn(cl_mem memory
        assert(memoryObject);
        if(!buffer){
                if(eagerBufferLoading){
-                       clGetMemObjectInfo(memoryObject, CL_MEM_SIZE, 
sizeof(size_t), bufferSize, NULL);
+                       unsigned int size;
+                       err = clEnqueueReadBuffer(getCommandQueue(), 
memoryObject, CL_TRUE, 0, sizeof(int), &size , 0, NULL, NULL);
+                       *bufferSize = sizeof(int)*size + sizeof(clHead);
                } else {
                        int count;
                        err = clEnqueueReadBuffer(getCommandQueue(), 
memoryObject, CL_TRUE, 0, sizeof(int), &count, 0, NULL, NULL);
@@ -763,10 +765,13 @@ str uselectrefine(bat *res, bat *bid, pt
                        cl_int err;
                        oid* positionRegion;
                        {
-                               size_t approximationSize;
-                               clGetMemObjectInfo(headApproximation, 
CL_MEM_SIZE, sizeof(size_t), &approximationSize, NULL);
+                               unsigned int approximationSize;
+                               err = clEnqueueReadBuffer(getCommandQueue(), 
batHeadApproximation(approximation), CL_TRUE, 0, sizeof(int), 
&approximationSize , 0, NULL, NULL);
+                               approximationSize *= sizeof(int);
+                               approximationSize == sizeof(clHead);
+
                                compressedHead = GDKmalloc(approximationSize);
-                               err = clEnqueueReadBuffer(getCommandQueue(), 
batHeadApproximation(approximation), CL_TRUE, 0, approximationSize, 
compressedHead , 0, NULL, NULL);       
+                               err = clEnqueueReadBuffer(getCommandQueue(), 
batHeadApproximation(approximation), CL_TRUE, 0, approximationSize, 
compressedHead , 0, NULL, NULL);
                                if(err) printf("#%s, clEnqueueReadBuffer: %s, 
%s:%u;\n", __func__, clError(err), __FILE__, __LINE__);
                        }
                        {
@@ -795,11 +800,12 @@ str uselectrefine(bat *res, bat *bid, pt
        
                                        clTail* compressedTail;
                                        {
-                                               size_t approximationSize;
-                                               if(1) printf ("%s approximation 
tail approximation: %p\n", __func__, batTailApproximation(approximation));
+                                               size_t bufferSize;
+                                               size_t approximationSize = 
sizeof(clTail) + candidateCount * 4 * 
ceil(batTailApproximationBits(approximation)/32.0);
 
-                                               
clGetMemObjectInfo(batTailApproximation(approximation), CL_MEM_SIZE, 
sizeof(size_t), &approximationSize
+                                               
clGetMemObjectInfo(batTailApproximation(approximation), CL_MEM_SIZE, 
sizeof(size_t), &bufferSize
                                                                                
                                         , NULL);
+                                               printf ("%lu/%lu\n", 
approximationSize, bufferSize);
                                                compressedTail = 
GDKmalloc(approximationSize);
                                                err = 
clEnqueueReadBuffer(getCommandQueue(), batTailApproximation(approximation), 
CL_TRUE, 0, approximationSize, compressedTail , 0, NULL, NULL);       
                                                if(err) printf("#%s, 
clEnqueueReadBuffer: %s, %s:%u;\n", __func__, clError(err), __FILE__, __LINE__);
@@ -1059,13 +1065,13 @@ str BWDSemijoinRefine(int *res, int *lid
                        {
                                if(supersetPositionsColumn){
                                         // if the approximation is empty, the 
memory objects are NULL
-                                               int* refinementRegion = (int*) 
Tloc(refinement, BUNfirst(refinement));
                                                const unsigned int* residuals = 
(unsigned int*)batTailResiduals(left);
                                                const unsigned int residualBits 
= 8*Tsize(left)-approximationBits-offsetBits;
 
                                                const unsigned int residualMask 
= (1 << (32-approximationBits-offsetBits))-1;
 
                                                if(residualBits > 0){
+                                                       int* refinementRegion = 
(int*) Tloc(refinement, BUNfirst(refinement));
                                                        unsigned int i,j;
                                                        size_t refinementCount 
= 0;
                                                        filteredResiduals = 
GDKzalloc(ceil((supersetPositionsColumn->count)*residualBits/8.0) + 
sizeof(size_t));
@@ -1117,7 +1123,33 @@ str BWDSemijoinRefine(int *res, int *lid
                                                BATsetcount(refinement, 
refinementCount);
 
                                                } else {
-                                                       
memcpy(refinementRegion, supersetApproximateValuesColumn->elements, 
BATcount(right)*sizeof(int));
+                                                       /* const int 
approximationBits =  */
+#define expansionLoop(type) {                                                  
                                                                                
                                        \
+                                       unsigned int i;                         
                                                                                
                                                                                
\
+                                       type* refinementRegion = (type*) 
Tloc(refinement,                                                       \
+                                                                               
                                                                                
                                BUNfirst(refinement));  \
+                                       for (i = 0; i< right->batCount; ++i)    
                                                                                
                        \
+                                               refinementRegion[i] = 
decompress_##type##_Value_without_residual( \
+                                                       i, approximationBits, 
supersetApproximateValuesColumn                   \
+                                                       );                      
                                                                                
                                                                                
                                        \
+                               }
+                       
+                               switch(refinement->T->width){
+                               case 8:
+                                       expansionLoop(lng);
+                                       break;
+                               case 4:
+                                       expansionLoop(int);
+                                       break;
+                               case 1:
+                                       expansionLoop(char);
+                                       break;
+                               default:
+                                       throw (MAL, "bwd problem", "this type 
(%d-byte) for %s is not implemented, %s:%d", ATOMsize(right->ttype), __func__, 
__FILE__, __LINE__);
+                               }                               
+#undef expansionLoop
+                                                       
+                                                       /* 
memcpy(refinementRegion, supersetApproximateValuesColumn->elements, 
BATcount(right)*sizeof(int)); */
                                                        BATsetcount(refinement, 
BATcount(right));
 
                                                }
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to