onnxruntime/onnxruntime/core/codegen/common/settings.h
KeDengMS c9240f4e93
Implementation of Nuphar execution provider (#881)
* Implement Nuphar execution provider

Nuphar execution provider is a TVM-based compilation provider. It has shown great speedups for RNN models using Scan.
This PR is mainly for a preview of the shared codegen library for other TVM-based providers.

* Fix submodules

* Fix TVM submodule

* Update Nuphar to latest and resolve confliction

* Remove stale files caused by merge -X theirs

* Revert heap buffer change to not introduce onnxruntime_framework into onnxruntime_perf_test

* Fix bad merge

* Merge from Nuphar

* Fix warning treated as error, revert some unnecessary changes

* Revert some more test changes

* Some more test revert or comments to make review easier
New tests could be added later

* One more revert of unnecessary changes

* More change revert. Test could be added back later.
2019-09-01 23:01:47 -07:00

39 lines
1.4 KiB
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#pragma once
#include <map>
namespace onnxruntime {
namespace codegen {
// use log level warning as default to make sure logs are outputted
#define CODEGEN_SETTINGS_LOG_LEVEL WARNING
// This stores codegen settings to control dumps, execution preference, etc.
// CodeGenSettings could come from command line options or environment variables
// Or could come from a static variables in source code
class CodeGenSettings {
public:
// generic built-in options
constexpr static const char* kDumpAllOptions = "dump_all_options";
constexpr static const char* kCodeGenDumpModule = "codegen_dump_module"; // dump tvm module
constexpr static const char* kCodeGenDumpLower = "codegen_dump_lower"; // dump lowered func
constexpr static const char* kCodeGenDumpSchedule = "codegen_dump_schedule"; // dump scheduler
void InsertOptions(const std::map<std::string, std::string>& options);
void DumpOptions() const;
std::string GetOptionValue(const std::string& key) const;
bool HasOption(const std::string& key) const;
bool OptionMatches(const std::string& key, const std::string& value) const;
void Clear();
static CodeGenSettings& Instance();
private:
CodeGenSettings();
std::map<std::string, std::string> options_;
};
} // namespace codegen
} // namespace onnxruntime