2017-12-21 00:45:38 +01:00
|
|
|
/*
|
2019-02-27 11:39:32 +01:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
2019-02-27 11:39:32 +01:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 00:45:38 +01:00
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "runtime/helpers/cache_policy.h"
|
|
|
|
|
|
2019-02-27 11:39:32 +01:00
|
|
|
#include "runtime/helpers/aligned_memory.h"
|
2019-02-27 14:52:10 +01:00
|
|
|
#include "runtime/memory_manager/graphics_allocation.h"
|
|
|
|
|
|
|
|
|
|
namespace OCLRT {
|
2019-02-27 11:39:32 +01:00
|
|
|
|
2017-12-21 00:45:38 +01:00
|
|
|
bool isL3Capable(void *ptr, size_t size) {
|
|
|
|
|
if (alignUp(ptr, MemoryConstants::cacheLineSize) == ptr &&
|
|
|
|
|
alignUp(size, MemoryConstants::cacheLineSize) == size) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
return false;
|
2019-02-27 14:52:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool isL3Capable(const OCLRT::GraphicsAllocation &graphicsAllocation) {
|
|
|
|
|
auto ptr = ptrOffset(graphicsAllocation.getUnderlyingBuffer(), static_cast<size_t>(graphicsAllocation.allocationOffset));
|
|
|
|
|
return isL3Capable(ptr, graphicsAllocation.getUnderlyingBufferSize());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} // namespace OCLRT
|