tests/cuda2.2/sdk/bank_checker.cpp
void BankChecker::
access( unsigned int tidx, unsigned int tidy, unsigned int tidz,
        unsigned int bdimx, unsigned int bdimy, unsigned int bdimz,
        const char* file, const int line, const std::string& aname,
        const int index)
{ 
    is_active = true;

    // linearized thread id
    unsigned int ltid = getLtid( tidx, tidy, tidz, bdimx, bdimy, bdimz);

    // reset state if new warp
    if( 0 == (ltid & (warp_size - 1))) 
    {
        // double check to handle multiple shared mem accesses in one line
        if( last_ltid != 0) 
        {
            reset();
        }
    }

    AccessLocation loc( file, line, aname, ltid);
    AccessInfo info( ltid, tidx, tidy, tidz, index);
    access_data[loc][(index % warp_size)].push_back( info);

    if( 15 == (ltid & (warp_size - 1))) 
    {
        analyse( access_data. find( loc));
    }

    last_ltid = (ltid % warp_size);
}
////////////////////////////////////////////////////////////////////////////////
//! Side effect of shared memory access
//! Side effect of shared memory access
//! @param tidx  thread id in x dimension of block
//! @param tidy  thread id in y dimension of block
//! @param tidz  thread id in z dimension of block
//! @param bdimx block size in x dimension
//! @param bdimy block size in y dimension
//! @param bdimz block size in z dimension
//! @param file  name of the source file where the access takes place
//! @param line  line in the source file where the access takes place
//! @param aname name of the array which is accessed
//! @param index index into the array
////////////////////////////////////////////////////////////////////////////////
Side effect of shared memory access
Side effect of shared memory access
Side effect of shared memory access Side effect of shared memory access
void BankChecker::
access( unsigned int tidx, unsigned int tidy, unsigned int tidz,
        unsigned int bdimx, unsigned int bdimy, unsigned int bdimz,
        const char* file, const int line, const std::string& aname,
        const int index)
{ 
    is_active = true;
    unsigned int ltid = getLtid( tidx, tidy, tidz, bdimx, bdimy, bdimz);
    if( 0 == (ltid & (warp_size - 1))) 
    {
        if( last_ltid != 0) 
        {
            reset();
        }
    }
    AccessLocation loc( file, line, aname, ltid);
    AccessInfo info( ltid, tidx, tidy, tidz, index);
    access_data[loc][(index % warp_size)].push_back( info);
    if( 15 == (ltid & (warp_size - 1))) 
    {
        analyse( access_data. find( loc));
    }
    last_ltid = (ltid % warp_size);
}
void BankChecker :: access ( unsigned int tidx , unsigned int tidy , unsigned int tidz , unsigned int bdimx , unsigned int bdimy , unsigned int bdimz , const char * file , const int line , const std :: string & aname , const int index ) { is_active = true ; unsigned int ltid = getLtid ( tidx , tidy , tidz , bdimx , bdimy , bdimz ) ; if ( 0 == ( ltid & ( warp_size - 1 ) ) ) { if ( last_ltid != 0 ) { reset ( ) ; } } AccessLocation loc ( file , line , aname , ltid ) ; AccessInfo info ( ltid , tidx , tidy , tidz , index ) ; access_data [ loc ] [ ( index % warp_size ) ] . push_back ( info ) ; if ( 15 == ( ltid & ( warp_size - 1 ) ) ) { analyse ( access_data . find ( loc ) ) ; } last_ltid = ( ltid % warp_size ) ; }
Side effect of shared memory access
Side effect of shared memory access
Side effect of shared memory access Side effect of shared memory access
// linearized thread id // reset state if new warp // double check to handle multiple shared mem accesses in one line