1 /* 2 * Copyright (C) 2018-2021 Intel Corporation 3 * 4 * SPDX-License-Identifier: MIT 5 * 6 */ 7 8 #pragma once 9 10 #include "shared/source/helpers/completion_stamp.h" 11 #include "shared/source/utilities/reference_tracked_object.h" 12 #include "shared/source/utilities/stackvec.h" 13 14 namespace NEO { 15 struct FlushStampTrackingObj : public ReferenceTrackedObject<FlushStampTrackingObj> { 16 FlushStamp flushStamp = 0; 17 std::atomic<bool> initialized{false}; 18 }; 19 20 class FlushStampTracker { 21 public: 22 FlushStampTracker() = delete; 23 FlushStampTracker(bool allocateStamp); 24 ~FlushStampTracker(); 25 26 FlushStamp peekStamp() const; 27 void setStamp(FlushStamp stamp); 28 void replaceStampObject(FlushStampTrackingObj *stampObj); 29 30 // Temporary. Method will be removed getStampReference()31 FlushStampTrackingObj *getStampReference() { 32 return flushStampSharedHandle; 33 } 34 35 protected: 36 FlushStampTrackingObj *flushStampSharedHandle = nullptr; 37 }; 38 39 class FlushStampUpdateHelper { 40 public: 41 void insert(FlushStampTrackingObj *stampObj); 42 void updateAll(const FlushStamp &flushStamp); 43 size_t size() const; 44 45 private: 46 StackVec<FlushStampTrackingObj *, 64> flushStampsToUpdate; 47 }; 48 } // namespace NEO 49