@ -52,6 +52,7 @@ namespace dsacache {
constexpr uint64_t FLAG_WAIT_WEAK = 0b1ULL < < 63 ;
constexpr uint64_t FLAG_HANDLE_PF = 0b1ULL < < 62 ;
constexpr uint64_t FLAG_ACCESS_WEAK = 0b1ULL < < 61 ;
constexpr uint64_t FLAG_FORCE_MAP_PAGES = 0b1ULL < < 60 ;
constexpr uint64_t FLAG_DEFAULT = 0ULL ;
class Cache ;
@ -392,7 +393,7 @@ inline std::unique_ptr<dsacache::CacheData> dsacache::Cache::Access(uint8_t* dat
// data source location
if ( CheckFlag ( flags , FLAG_ACCESS_WEAK ) ) {
std : : cerr < < " WEAK ACCESS FAILED! " < < std : : endl ;
std : : cerr < < " [x] WEAK ACCESS FAILED!" < < std : : endl ;
task - > SetCacheToSource ( ) ;
return std : : move ( task ) ;
}
@ -466,6 +467,14 @@ inline uint8_t* dsacache::Cache::AllocOnNode(const size_t size, const int node)
return nullptr ;
}
if ( CheckFlag ( flags_ , FLAG_TRIGGER_PAGES ) ) {
static const size_t page_size_b = getpagesize ( ) ;
for ( size_t i = 0 ; i < size ; i + = page_size_b ) {
dst [ i ] = 0 ;
}
}
return dst ;
}
@ -513,15 +522,15 @@ inline dml::handler<dml::mem_copy_operation, std::allocator<uint8_t>> dsacache::
dml : : data_view dstv = dml : : make_view ( dst , size ) ;
if ( CheckFlag ( flags_ , FLAG_HANDLE_PF ) ) {
return dml : : submit < dml : : hard ware> (
return dml : : submit < dml : : soft ware> (
dml : : mem_copy . block_on_fault ( ) , srcv , dstv ,
dml : : execution_interface < dml : : hard ware, std : : allocator < uint8_t > > ( ) , node
dml : : execution_interface < dml : : soft ware, std : : allocator < uint8_t > > ( ) , node
) ;
}
else {
return dml : : submit < dml : : hard ware> (
return dml : : submit < dml : : soft ware> (
dml : : mem_copy , srcv , dstv ,
dml : : execution_interface < dml : : hard ware, std : : allocator < uint8_t > > ( ) , node
dml : : execution_interface < dml : : soft ware, std : : allocator < uint8_t > > ( ) , node
) ;
}
}
@ -769,7 +778,7 @@ inline void dsacache::CacheData::WaitOnCompletion() {
for ( auto & handler : * local_handlers ) {
if ( CheckFlag ( flags_ , FLAG_WAIT_WEAK ) & & ! handler . is_finished ( ) ) {
std : : cerr < < " WEAK WAIT FAIL! " < < std : : endl ;
std : : cerr < < " [x] WEAK WAIT FAIL!" < < std : : endl ;
handlers_ - > store ( local_handlers ) ;
return ;
}
@ -779,7 +788,7 @@ inline void dsacache::CacheData::WaitOnCompletion() {
if ( result . status ! = dml : : status_code : : ok ) {
// if one of the copy tasks failed we abort the whole task
// after all operations are completed on it
std : : cerr < < " ERROR ( " < < dml : : StatusCodeToString ( result . status ) < < " ) FOUND FOR TASK IN WAIT! " < < std : : endl ;
std : : cerr < < " [x] ERROR (" < < dml : : StatusCodeToString ( result . status ) < < " ) FOUND FOR TASK IN WAIT! " < < std : : endl ;
error = true ;
}
}