check TVM target for CPU (#10926)

Co-authored-by: Valery Chernov <valery.chernov@deelvin.com>
This commit is contained in:
Valery Chernov 2022-03-18 01:51:24 +03:00 committed by GitHub
parent a46b00499a
commit 766e6ac4fd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View file

@ -11,7 +11,7 @@ constexpr const char* default_executor_type = "vm";
constexpr const char* vm_executor_type = "vm";
constexpr const char* graph_executor_type = "graph";
constexpr const char* default_target_str = "cpu";
constexpr const char* default_target_str = "llvm";
constexpr const char* llvm_target_str = "llvm";
constexpr const char* cpu_target_str = "cpu";

View file

@ -134,6 +134,11 @@ void TvmEPOptionsHelper::optionsPostprocess(TvmEPOptions& options) {
optLevelPostprocess(options.opt_level);
}
bool TvmEPOptionsHelper::checkCPUTarget(const std::string& target) {
bool check = target.find("llvm") != std::string::npos;
return check;
}
bool TvmEPOptionsHelper::checkGPUTarget(const std::string& target) {
bool check = (
target.find("cuda") != std::string::npos ||

View file

@ -54,6 +54,7 @@ public:
static TvmEPOptions FromProviderOptions(const ProviderOptions& options);
static std::string whitespace_trimming(const std::string& str);
static bool checkCPUTarget(const std::string& target);
static bool checkGPUTarget(const std::string& target);
private:

View file

@ -152,7 +152,7 @@ std::unique_ptr<IDataTransfer> TvmExecutionProvider::GetDataTransfer() const {
//TODO(vvchernov): target or target host?
if (TvmEPOptionsHelper::checkGPUTarget(options_.target)) {
return std::make_unique<XPUDataTransfer>();
} else if (options_.target.find("llvm") != std::string::npos) {
} else if (TvmEPOptionsHelper::checkCPUTarget(options_.target)) {
return std::make_unique<TvmCPUDataTransfer>();
} else {
ORT_NOT_IMPLEMENTED("TVM GetDataTransfer is not implemented for target ", options_.target);