better throughput scheduling with steady state cost model, now limited to spatial
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include "llvm/ADT/ArrayRef.h"
|
||||
#include "llvm/ADT/SmallVector.h"
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
|
||||
namespace onnx_mlir {
|
||||
|
||||
// Emptiness is normalized after consumption. Capacity and consumed prefixes
|
||||
// cannot affect virtual timing, readiness, or the remaining FIFO sequence.
|
||||
class PimDependencyTokens {
|
||||
llvm::SmallVector<uint64_t, 1> values;
|
||||
size_t head = 0;
|
||||
public:
|
||||
void initialize(size_t distance) { values.assign(distance, 0); head = 0; }
|
||||
bool empty() const { return values.empty(); }
|
||||
void push(uint64_t time) { values.push_back(time); }
|
||||
uint64_t consume() {
|
||||
assert(!empty());
|
||||
uint64_t time = values[head++];
|
||||
if (head == values.size()) { values.clear(); head = 0; }
|
||||
else if (head >= values.size() - head) {
|
||||
values.erase(values.begin(), values.begin() + head);
|
||||
head = 0;
|
||||
}
|
||||
return time;
|
||||
}
|
||||
llvm::ArrayRef<uint64_t> remaining() const { return llvm::ArrayRef(values).drop_front(head); }
|
||||
};
|
||||
|
||||
} // namespace onnx_mlir
|
||||
Reference in New Issue
Block a user