HMLP: High-performance Machine Learning Primitives
hmlp::Cache1D< NSET, NWAY, T > Class Template Reference

Cache1D<NSET, NWAY, T> creates a layer of cache with NSET that directly maps a 1D array. The direct map is [ id % NSET ]. Each set has NWAY that are fully associated. More...

#include <Cache.hpp>

Public Member Functions

 Cache1D (size_t unit)
 
Data< T > Read (size_t id)
 
void Write (size_t id, Data< T > &input)
 

Detailed Description

template<size_t NSET, size_t NWAY, typename T>
class hmlp::Cache1D< NSET, NWAY, T >

Cache1D<NSET, NWAY, T> creates a layer of cache with NSET that directly maps a 1D array. The direct map is [ id % NSET ]. Each set has NWAY that are fully associated.

Constructor & Destructor Documentation

template<size_t NSET, size_t NWAY, typename T >
hmlp::Cache1D< NSET, NWAY, T >::Cache1D ( size_t  unit)
inline

resize table and locks

resize frequency

resize buffer

all units

Member Function Documentation

template<size_t NSET, size_t NWAY, typename T >
Data<T> hmlp::Cache1D< NSET, NWAY, T >::Read ( size_t  id)
inline

use direct map to find the set

use std::map::find inside the fully associated set

cache hit

increate frequency

template<size_t NSET, size_t NWAY, typename T >
void hmlp::Cache1D< NSET, NWAY, T >::Write ( size_t  id,
Data< T > &  input 
)
inline

use direct map to find the set

compute the offset of the whole NSET-by-NWAY cachline

early return if id has been written to the cache

column id of the buffer

insert id into table[ id % NSET ]

cache replacement

compute the minimal frequency

match the cahceline and replace


The documentation for this class was generated from the following file: