2017-12-21 07:45:38 +08:00
|
|
|
/*
|
2021-05-17 02:51:16 +08:00
|
|
|
* Copyright (C) 2018-2021 Intel Corporation
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
2018-09-18 15:11:08 +08:00
|
|
|
* SPDX-License-Identifier: MIT
|
2017-12-21 07:45:38 +08:00
|
|
|
*
|
|
|
|
*/
|
2018-09-18 15:11:08 +08:00
|
|
|
|
2017-12-21 07:45:38 +08:00
|
|
|
#pragma once
|
|
|
|
|
2020-02-24 05:44:01 +08:00
|
|
|
#include "shared/source/helpers/completion_stamp.h"
|
|
|
|
#include "shared/source/utilities/reference_tracked_object.h"
|
|
|
|
#include "shared/source/utilities/stackvec.h"
|
2017-12-21 07:45:38 +08:00
|
|
|
|
2019-03-26 18:59:46 +08:00
|
|
|
namespace NEO {
|
2017-12-21 07:45:38 +08:00
|
|
|
struct FlushStampTrackingObj : public ReferenceTrackedObject<FlushStampTrackingObj> {
|
2018-02-02 21:50:09 +08:00
|
|
|
FlushStamp flushStamp = 0;
|
|
|
|
std::atomic<bool> initialized{false};
|
2017-12-21 07:45:38 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
class FlushStampTracker {
|
|
|
|
public:
|
|
|
|
FlushStampTracker() = delete;
|
|
|
|
FlushStampTracker(bool allocateStamp);
|
|
|
|
~FlushStampTracker();
|
|
|
|
|
|
|
|
FlushStamp peekStamp() const;
|
|
|
|
void setStamp(FlushStamp stamp);
|
|
|
|
void replaceStampObject(FlushStampTrackingObj *stampObj);
|
|
|
|
|
|
|
|
// Temporary. Method will be removed
|
|
|
|
FlushStampTrackingObj *getStampReference() {
|
|
|
|
return flushStampSharedHandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected:
|
|
|
|
FlushStampTrackingObj *flushStampSharedHandle = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
class FlushStampUpdateHelper {
|
|
|
|
public:
|
|
|
|
void insert(FlushStampTrackingObj *stampObj);
|
2019-11-24 21:50:41 +08:00
|
|
|
void updateAll(const FlushStamp &flushStamp);
|
2017-12-21 07:45:38 +08:00
|
|
|
size_t size() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
StackVec<FlushStampTrackingObj *, 64> flushStampsToUpdate;
|
|
|
|
};
|
2019-03-26 18:59:46 +08:00
|
|
|
} // namespace NEO
|