mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-29 23:06:41 +00:00
Not using predefined marco to check EP (#22654)
### Description We'll build CUDA EP and DML EP in one package. As a result, USE_DML and USE_CUDA will coexist. We can't use predefined macros to check EP any more ### Motivation and Context Other changes are in test code, so I make this change of core runtime into one PR.
This commit is contained in:
parent
03ea5dc495
commit
5200e098aa
1 changed files with 7 additions and 5 deletions
|
|
@ -62,15 +62,16 @@ namespace {
|
|||
struct DataTransfer {
|
||||
std::unique_ptr<IExecutionProvider> ep;
|
||||
std::unique_ptr<IDataTransfer> data_transfer;
|
||||
bool is_dml = false;
|
||||
Status CopyTensor(const Tensor& src, Tensor& dst) const {
|
||||
return data_transfer->CopyTensor(src, dst);
|
||||
}
|
||||
Status Sync() const {
|
||||
#if USE_DML
|
||||
return ep->Sync();
|
||||
#else
|
||||
return Status::OK();
|
||||
#endif
|
||||
if (is_dml) {
|
||||
return ep->Sync();
|
||||
} else {
|
||||
return Status::OK();
|
||||
}
|
||||
}
|
||||
};
|
||||
} // namespace
|
||||
|
|
@ -94,6 +95,7 @@ static Status GetDataTransfer(const OrtMemoryInfo& mem_info, [[maybe_unused]] Da
|
|||
#ifdef USE_DML
|
||||
auto ep_factory = onnxruntime::DMLProviderFactoryCreator::Create(ConfigOptions{}, 0, false, false, false);
|
||||
dt.ep = ep_factory->CreateProvider();
|
||||
dt.is_dml = true;
|
||||
dt.data_transfer = dt.ep->GetDataTransfer();
|
||||
#else
|
||||
status = ORT_MAKE_STATUS(ONNXRUNTIME, FAIL, "DML provider is not enabled in this build");
|
||||
|
|
|
|||
Loading…
Reference in a new issue