mirror of
https://github.com/intel/compute-runtime.git
synced 2026-01-09 22:43:00 +08:00
[34/N] Internal 4GB allocator.
- Change dirty state helpers to work on IndirectHeaps. - Instead of comparing size in bytes and cpu pointers, compare gpu base address and size of the heap in pages - That allows to not have dirty flag for heaps that are coming from 4GB allocator. Change-Id: I0ff81e3c0945b32e4f872a100cd10b332b27ed24
This commit is contained in:
committed by
sys_ocldev
parent
10e5b71111
commit
621a2dfcd1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -21,15 +21,19 @@
|
||||
*/
|
||||
|
||||
#include "runtime/helpers/dirty_state_helpers.h"
|
||||
#include "runtime/command_stream/linear_stream.h"
|
||||
#include "runtime/indirect_heap/indirect_heap.h"
|
||||
|
||||
using namespace OCLRT;
|
||||
|
||||
bool HeapDirtyState::updateAndCheck(const LinearStream *heap) {
|
||||
bool dirty = address != heap->getCpuBase() || size != heap->getMaxAvailableSpace();
|
||||
bool HeapDirtyState::updateAndCheck(const IndirectHeap *heap) {
|
||||
if (!heap->getGraphicsAllocation()) {
|
||||
sizeInPages = 0llu;
|
||||
return true;
|
||||
}
|
||||
bool dirty = gpuBaseAddress != heap->getHeapGpuBase() || sizeInPages != heap->getHeapSizeInPages();
|
||||
if (dirty) {
|
||||
address = heap->getCpuBase();
|
||||
size = heap->getMaxAvailableSpace();
|
||||
gpuBaseAddress = heap->getHeapGpuBase();
|
||||
sizeInPages = heap->getHeapSizeInPages();
|
||||
}
|
||||
return dirty;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Intel Corporation
|
||||
* Copyright (c) 2017 - 2018, Intel Corporation
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
@@ -22,16 +22,17 @@
|
||||
|
||||
#pragma once
|
||||
#include <cstdlib>
|
||||
#include <cstdint>
|
||||
|
||||
namespace OCLRT {
|
||||
class LinearStream;
|
||||
class IndirectHeap;
|
||||
|
||||
class HeapDirtyState {
|
||||
public:
|
||||
bool updateAndCheck(const LinearStream *heap);
|
||||
bool updateAndCheck(const IndirectHeap *heap);
|
||||
|
||||
protected:
|
||||
void *address = nullptr;
|
||||
size_t size = 0u;
|
||||
uint64_t gpuBaseAddress = 0llu;
|
||||
size_t sizeInPages = 0u;
|
||||
};
|
||||
} // namespace OCLRT
|
||||
|
||||
Reference in New Issue
Block a user