2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2019-02-27 18:39:32 +08:00
|
|
|
* Copyright (C) 2017-2019 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2019-02-27 18:39:32 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "runtime/helpers/cache_policy.h"
|
|
|
|
|
2019-02-27 18:39:32 +08:00
|
|
|
#include "runtime/helpers/aligned_memory.h"
|
2019-02-27 21:52:10 +08:00
|
|
|
#include "runtime/memory_manager/graphics_allocation.h"
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2019-02-27 18:39:32 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
bool isL3Capable(void *ptr, size_t size) {
|
2019-02-28 18:21:01 +08:00
|
|
|
return isAligned<MemoryConstants::cacheLineSize>(ptr) &&
|
|
|
|
isAligned<MemoryConstants::cacheLineSize>(size);
|
2019-02-27 21:52:10 +08:00
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
bool isL3Capable(const NEO::GraphicsAllocation &graphicsAllocation) {
|
2019-02-27 21:59:46 +08:00
|
|
|
auto ptr = ptrOffset(graphicsAllocation.getUnderlyingBuffer(), static_cast<size_t>(graphicsAllocation.getAllocationOffset()));
|
2019-02-27 21:52:10 +08:00
|
|
|
return isL3Capable(ptr, graphicsAllocation.getUnderlyingBufferSize());
|
|
|
|
}
|
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|