/[escript]/branches/clazy/escriptcore/src/DataLazy.cpp
ViewVC logotype

Diff of /branches/clazy/escriptcore/src/DataLazy.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2514 by jfenwick, Fri Jul 3 00:57:45 2009 UTC revision 2521 by jfenwick, Tue Jul 7 00:08:58 2009 UTC
# Line 982  DataLazy::resolveUnary(ValueType& v, siz Line 982  DataLazy::resolveUnary(ValueType& v, siz
982    {    {
983      throw DataException("Programmer error - resolveUnary should only be called on expanded Data.");      throw DataException("Programmer error - resolveUnary should only be called on expanded Data.");
984    }    }
985    const ValueType* vleft=m_left->resolveSample(v,offset,sampleNo,roffset);    const ValueType* vleft=m_left->resolveVectorSample(v,offset,sampleNo,roffset);
986    const double* left=&((*vleft)[roffset]);    const double* left=&((*vleft)[roffset]);
987    double* result=&(v[offset]);    double* result=&(v[offset]);
988    roffset=offset;    roffset=offset;
# Line 1128  DataLazy::resolveNP1OUT(ValueType& v, si Line 1128  DataLazy::resolveNP1OUT(ValueType& v, si
1128      // since we can't write the result over the input, we need a result offset further along      // since we can't write the result over the input, we need a result offset further along
1129    size_t subroffset=roffset+m_samplesize;    size_t subroffset=roffset+m_samplesize;
1130  LAZYDEBUG(cerr << "subroffset=" << subroffset << endl;)  LAZYDEBUG(cerr << "subroffset=" << subroffset << endl;)
1131    const ValueType* vleft=m_left->resolveSample(v,offset+m_left->m_samplesize,sampleNo,subroffset);    const ValueType* vleft=m_left->resolveVectorSample(v,offset+m_left->m_samplesize,sampleNo,subroffset);
1132    roffset=offset;    roffset=offset;
1133    size_t loop=0;    size_t loop=0;
1134    size_t numsteps=(m_readytype=='E')?getNumDPPSample():1;    size_t numsteps=(m_readytype=='E')?getNumDPPSample():1;
# Line 1181  DataLazy::resolveNP1OUT_P(ValueType& v, Line 1181  DataLazy::resolveNP1OUT_P(ValueType& v,
1181    }    }
1182      // since we can't write the result over the input, we need a result offset further along      // since we can't write the result over the input, we need a result offset further along
1183    size_t subroffset;    size_t subroffset;
1184    const ValueType* vleft=m_left->resolveSample(v,offset+m_left->m_samplesize,sampleNo,subroffset);    const ValueType* vleft=m_left->resolveVectorSample(v,offset+m_left->m_samplesize,sampleNo,subroffset);
1185  LAZYDEBUG(cerr << "srcsamplesize=" << offset+m_left->m_samplesize << " beg=" << subroffset << endl;)  LAZYDEBUG(cerr << "srcsamplesize=" << offset+m_left->m_samplesize << " beg=" << subroffset << endl;)
1186  LAZYDEBUG(cerr << "Offset for 5800=" << getPointOffset(5800/getNumDPPSample(),5800%getNumDPPSample()) << endl;)  LAZYDEBUG(cerr << "Offset for 5800=" << getPointOffset(5800/getNumDPPSample(),5800%getNumDPPSample()) << endl;)
1187    roffset=offset;    roffset=offset;
# Line 1252  DataLazy::resolveNP1OUT_2P(ValueType& v, Line 1252  DataLazy::resolveNP1OUT_2P(ValueType& v,
1252    }    }
1253      // since we can't write the result over the input, we need a result offset further along      // since we can't write the result over the input, we need a result offset further along
1254    size_t subroffset;    size_t subroffset;
1255    const ValueType* vleft=m_left->resolveSample(v,offset+m_left->m_samplesize,sampleNo,subroffset);    const ValueType* vleft=m_left->resolveVectorSample(v,offset+m_left->m_samplesize,sampleNo,subroffset);
1256  LAZYDEBUG(cerr << "srcsamplesize=" << offset+m_left->m_samplesize << " beg=" << subroffset << endl;)  LAZYDEBUG(cerr << "srcsamplesize=" << offset+m_left->m_samplesize << " beg=" << subroffset << endl;)
1257  LAZYDEBUG(cerr << "Offset for 5800=" << getPointOffset(5800/getNumDPPSample(),5800%getNumDPPSample()) << endl;)  LAZYDEBUG(cerr << "Offset for 5800=" << getPointOffset(5800/getNumDPPSample(),5800%getNumDPPSample()) << endl;)
1258    roffset=offset;    roffset=offset;
# Line 1429  LAZYDEBUG(cout << "Resolve binary: " << Line 1429  LAZYDEBUG(cout << "Resolve binary: " <<
1429    
1430    int resultStep=max(leftstep,rightstep);   // only one (at most) should be !=0    int resultStep=max(leftstep,rightstep);   // only one (at most) should be !=0
1431      // Get the values of sub-expressions      // Get the values of sub-expressions
1432    const ValueType* left=m_left->resolveSample(v,offset+getMaxSampleSize(),sampleNo,lroffset);   // see note on    const ValueType* left=m_left->resolveVectorSample(v,offset+getMaxSampleSize(),sampleNo,lroffset); // see note on
1433      // calcBufss for why we can't put offset as the 2nd param above      // calcBufss for why we can't put offset as the 2nd param above
1434    const ValueType* right=m_right->resolveSample(v,offset+2*getMaxSampleSize(),sampleNo,rroffset); // Note    const ValueType* right=m_right->resolveVectorSample(v,offset+2*getMaxSampleSize(),sampleNo,rroffset); // Note
1435      // the right child starts further along.      // the right child starts further along.
1436  LAZYDEBUG(cout << "Post sub calls in " << toString() << endl;)  LAZYDEBUG(cout << "Post sub calls in " << toString() << endl;)
1437  LAZYDEBUG(cout << "shapes=" << DataTypes::shapeToString(m_left->getShape()) << "," << DataTypes::shapeToString(m_right->getShape()) << endl;)  LAZYDEBUG(cout << "shapes=" << DataTypes::shapeToString(m_left->getShape()) << "," << DataTypes::shapeToString(m_right->getShape()) << endl;)
# Line 1505  LAZYDEBUG(cout << "Resolve TensorProduct Line 1505  LAZYDEBUG(cout << "Resolve TensorProduct
1505    
1506  LAZYDEBUG(cout << "Query left with offset=" << gap << endl;)  LAZYDEBUG(cout << "Query left with offset=" << gap << endl;)
1507    
1508    const ValueType* left=m_left->resolveSample(v,gap,sampleNo,lroffset);    const ValueType* left=m_left->resolveVectorSample(v,gap,sampleNo,lroffset);
1509    gap+=m_left->getMaxSampleSize();    gap+=m_left->getMaxSampleSize();
1510    
1511    
1512  LAZYDEBUG(cout << "Query right with offset=" << gap << endl;)  LAZYDEBUG(cout << "Query right with offset=" << gap << endl;)
1513    
1514    
1515    const ValueType* right=m_right->resolveSample(v,gap,sampleNo,rroffset);    const ValueType* right=m_right->resolveVectorSample(v,gap,sampleNo,rroffset);
1516    
1517  LAZYDEBUG(cerr << "[Left shape]=" << DataTypes::shapeToString(m_left->getShape()) << "\n[Right shape]=" << DataTypes::shapeToString(m_right->getShape()) << " result=" <<DataTypes::shapeToString(getShape()) <<  endl;  LAZYDEBUG(cerr << "[Left shape]=" << DataTypes::shapeToString(m_left->getShape()) << "\n[Right shape]=" << DataTypes::shapeToString(m_right->getShape()) << " result=" <<DataTypes::shapeToString(getShape()) <<  endl;
1518  cout << getNoValues() << endl;)  cout << getNoValues() << endl;)
# Line 2138  LAZYDEBUG(cout << DataTypes::pointToStri Line 2138  LAZYDEBUG(cout << DataTypes::pointToStri
2138    
2139  // the roffset is the offset within the returned vector where the data begins  // the roffset is the offset within the returned vector where the data begins
2140  const DataTypes::ValueType*  const DataTypes::ValueType*
2141  DataLazy::resolveSample(ValueType& v, size_t offset, int sampleNo, size_t& roffset)  DataLazy::resolveVectorSample(ValueType& v, size_t offset, int sampleNo, size_t& roffset)
2142  {  {
2143  LAZYDEBUG(cout << "Resolve sample " << toString() << endl;)  LAZYDEBUG(cout << "Resolve sample " << toString() << endl;)
2144      // collapse so we have a 'E' node or an IDENTITY for some other type      // collapse so we have a 'E' node or an IDENTITY for some other type
# Line 2186  DataLazy::resolveSample(BufferGroup& bg, Line 2186  DataLazy::resolveSample(BufferGroup& bg,
2186  #else  #else
2187      int tid=0;      int tid=0;
2188  #endif  #endif
2189      return resolveSample(bg.getBuffer(tid),bg.getOffset(tid),sampleNo,roffset);  #ifdef LAZY_NODE_STORAGE
2190        return resolveNodeSample(tid, sampleNo, roffset);
2191    #else
2192        return resolveVectorSample(bg.getBuffer(tid),bg.getOffset(tid),sampleNo,roffset);
2193    #endif
2194  }  }
2195    
2196    
# Line 2312  LAZYDEBUG(cout << "Total number of sampl Line 2316  LAZYDEBUG(cout << "Total number of sampl
2316    {    {
2317  LAZYDEBUG(cout << "################################# " << sample << endl;)  LAZYDEBUG(cout << "################################# " << sample << endl;)
2318  #ifdef _OPENMP  #ifdef _OPENMP
2319      res=resolveSample(v,threadbuffersize*omp_get_thread_num(),sample,resoffset);      res=resolveVectorSample(v,threadbuffersize*omp_get_thread_num(),sample,resoffset);
2320  #else  #else
2321      res=resolveSample(v,0,sample,resoffset);   // res would normally be v, but not if its a single IDENTITY op.      res=resolveVectorSample(v,0,sample,resoffset);   // res would normally be v, but not if its a single IDENTITY op.
2322  #endif  #endif
2323  LAZYDEBUG(cerr << "-------------------------------- " << endl;)  LAZYDEBUG(cerr << "-------------------------------- " << endl;)
2324  LAZYDEBUG(cerr<< "Copying sample#" << sample << endl;)  LAZYDEBUG(cerr<< "Copying sample#" << sample << endl;)

Legend:
Removed from v.2514  
changed lines
  Added in v.2521

  ViewVC Help
Powered by ViewVC 1.1.26