inoryQwQ commited on
Commit
8104c58
·
verified ·
1 Parent(s): 1819b27

Upload sdk/src/ax_engine.cpp with huggingface_hub

Browse files
Files changed (1) hide show
  1. sdk/src/ax_engine.cpp +2 -0
sdk/src/ax_engine.cpp CHANGED
@@ -99,6 +99,7 @@ void ModelSession::SetInput(const std::string& name, const void* data, size_t by
99
  auto& buf = impl_->inputs[it->second];
100
  if (bytes > buf.nSize) throw std::runtime_error("input too large " + name);
101
  std::memcpy(buf.pVirAddr, data, bytes);
 
102
  }
103
 
104
  void ModelSession::Run() {
@@ -117,6 +118,7 @@ void ModelSession::GetOutput(const std::string& name, void* out, size_t bytes) c
117
  if (it == impl_->output_index.end()) throw std::runtime_error("no output named " + name);
118
  auto& buf = impl_->outputs[it->second];
119
  if (bytes > buf.nSize) bytes = buf.nSize;
 
120
  std::memcpy(out, buf.pVirAddr, bytes);
121
  }
122
 
 
99
  auto& buf = impl_->inputs[it->second];
100
  if (bytes > buf.nSize) throw std::runtime_error("input too large " + name);
101
  std::memcpy(buf.pVirAddr, data, bytes);
102
+ AX_SYS_MflushCache(buf.phyAddr, buf.pVirAddr, buf.nSize);
103
  }
104
 
105
  void ModelSession::Run() {
 
118
  if (it == impl_->output_index.end()) throw std::runtime_error("no output named " + name);
119
  auto& buf = impl_->outputs[it->second];
120
  if (bytes > buf.nSize) bytes = buf.nSize;
121
+ AX_SYS_MinvalidateCache(buf.phyAddr, buf.pVirAddr, buf.nSize);
122
  std::memcpy(out, buf.pVirAddr, bytes);
123
  }
124