forked from jiuyuan/InfiniTensor
Fix: add virutal method sync in Runtime
This commit is contained in:
parent
c58b67f743
commit
95a8b90fa7
|
@ -36,7 +36,7 @@ class BangRuntimeObj : public RuntimeObj {
|
|||
bool profiling = false) const;
|
||||
// double runEvaluation(const Graph &graph, int nWarmups,
|
||||
// int nEvaluations) const;
|
||||
void sync() const;
|
||||
void sync() const override;
|
||||
BangPtr alloc(size_t size) override {
|
||||
void *ptr;
|
||||
checkBangError(cnrtMalloc(&ptr, size));
|
||||
|
|
|
@ -79,6 +79,7 @@ class RuntimeObj : public std::enable_shared_from_this<RuntimeObj> {
|
|||
virtual void copyBlobToCPU(void *dst, const void *src,
|
||||
size_t bytes) const = 0;
|
||||
virtual string toString() const = 0;
|
||||
virtual void sync() const {}
|
||||
|
||||
map<UidBaseType, bool>
|
||||
getCompileTimeComputableAttribute(const Graph &graph) const;
|
||||
|
|
|
@ -27,7 +27,7 @@ class CudaRuntimeObj : public RuntimeObj {
|
|||
bool profiling = false) const;
|
||||
// double runEvaluation(const Graph &graph, int nWarmups,
|
||||
// int nEvaluations) const;
|
||||
void sync() const;
|
||||
void sync() const override;
|
||||
CudaPtr alloc(size_t size) override {
|
||||
void *ptr;
|
||||
// printf("Try to cudaMalloc: %lu bytes\n", size);
|
||||
|
|
|
@ -29,7 +29,7 @@ class MklRuntimeObj : public CpuRuntimeObj {
|
|||
string toString() const override { return "INTELCPU Runtime"; };
|
||||
dnnl::engine getEngine() const { return dnnl::engine(engine, true); }
|
||||
dnnl::stream getStream() const { return dnnl::stream(stream, true); }
|
||||
void sync() const;
|
||||
void sync() const override;
|
||||
};
|
||||
|
||||
} // namespace infini
|
||||
|
|
|
@ -241,7 +241,7 @@ double RuntimeObj::timeNonCtcOperators(const Graph &graph, int warmup,
|
|||
kernel->compute(op, this);
|
||||
}
|
||||
},
|
||||
[&]() { sync(); }, warmup, repeat);
|
||||
[&]() { this->sync(); }, warmup, repeat);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue