source: icGREP/icgrep-devel/icgrep/toolchain/object_cache_manager.cpp @ 6184

Last change on this file since 6184 was 6184, checked in by nmedfort, 12 months ago

Initial version of PipelineKernel? + revised StreamSet? model.

File size: 1.7 KB
Line 
1#include "object_cache_manager.h"
2#include <kernels/kernel.h>
3#include <kernels/kernel_builder.h>
4#include <toolchain/toolchain.h>
5#include <llvm/Support/raw_ostream.h>
6
7std::unique_ptr<ParabixObjectCache> ObjectCacheManager::mCache;
8
9/** ------------------------------------------------------------------------------------------------------------- *
10 * @brief initializeCacheSystems
11 ** ------------------------------------------------------------------------------------------------------------- */
12void ObjectCacheManager::initializeCacheSystems() {
13    if (LLVM_LIKELY(mCache.get() == nullptr)) {
14        if (LLVM_LIKELY(codegen::EnableObjectCache)) {
15            if (codegen::ObjectCacheDir) {
16                mCache.reset(new ParabixObjectCache(codegen::ObjectCacheDir));
17            } else {
18                mCache.reset(new ParabixObjectCache());
19            }
20        }
21    }
22}
23
24/** ------------------------------------------------------------------------------------------------------------- *
25 * @brief checkForCachedKernel
26 ** ------------------------------------------------------------------------------------------------------------- */
27bool ObjectCacheManager::checkForCachedKernel(const std::unique_ptr<kernel::KernelBuilder> & b, kernel::Kernel * const kernel) noexcept {
28    return mCache.get() && mCache->loadCachedObjectFile(b, kernel);
29}
30
31/** ------------------------------------------------------------------------------------------------------------- *
32 * @brief performIncrementalCacheCleanupStep
33 ** ------------------------------------------------------------------------------------------------------------- */
34void ObjectCacheManager::performIncrementalCacheCleanupStep() noexcept {
35    if (mCache.get()) mCache->performIncrementalCacheCleanupStep();
36}
Note: See TracBrowser for help on using the repository browser.