Files
compute-runtime/runtime/helpers/cache_policy.cpp
Mrozek, Michal 6cb4732abe Move isl3Capable outside of Graphics Allocation.
Change-Id: If9949f0d6d3405dcdeb221cbee1ce30307166c21
2019-02-28 10:48:27 +01:00

29 lines
770 B
C++

/*
* Copyright (C) 2017-2019 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#include "runtime/helpers/cache_policy.h"
#include "runtime/helpers/aligned_memory.h"
#include "runtime/memory_manager/graphics_allocation.h"
namespace OCLRT {
bool isL3Capable(void *ptr, size_t size) {
if (alignUp(ptr, MemoryConstants::cacheLineSize) == ptr &&
alignUp(size, MemoryConstants::cacheLineSize) == size) {
return true;
}
return false;
}
bool isL3Capable(const OCLRT::GraphicsAllocation &graphicsAllocation) {
auto ptr = ptrOffset(graphicsAllocation.getUnderlyingBuffer(), static_cast<size_t>(graphicsAllocation.allocationOffset));
return isL3Capable(ptr, graphicsAllocation.getUnderlyingBufferSize());
}
} // namespace OCLRT