diff --git a/.gitignore b/.gitignore index 506e54d930671..66eb0cb4f8665 100644 --- a/.gitignore +++ b/.gitignore @@ -230,7 +230,3 @@ conda/pkg # nix files .envrc *.nix - -# antlr files -*.tokens -*.interp diff --git a/include/tvm/parser/parser.h b/include/tvm/parser/parser.h index 93803588383a0..5c1239b1f59e9 100644 --- a/include/tvm/parser/parser.h +++ b/include/tvm/parser/parser.h @@ -32,7 +32,7 @@ namespace tvm { namespace parser { -IRModule Parse(std::string file_name, std::string file_content); +IRModule ParseModule(std::string file_name, std::string file_content); } // namespace parser } // namespace tvm diff --git a/python/tvm/relay/std/core.rly b/python/tvm/relay/std/core.rly index 6a3facc3424c8..f469491a56f1b 100644 --- a/python/tvm/relay/std/core.rly +++ b/python/tvm/relay/std/core.rly @@ -16,6 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -v0.0.4 + +#[version = "0.0.5"] extern type Storage diff --git a/python/tvm/relay/std/prelude.rly b/python/tvm/relay/std/prelude.rly index fa05d1a7bd989..a22f46c6d18b9 100644 --- a/python/tvm/relay/std/prelude.rly +++ b/python/tvm/relay/std/prelude.rly @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -v0.0.4 +#[version = "0.0.4"] // TODO(weberlo): should we add sugar for scalar types (e.g., `int32` => `Tensor[(), int32]`)? diff --git a/src/ir/module.cc b/src/ir/module.cc index 25ecab2455cbf..1bcf7d928c51d 100644 --- a/src/ir/module.cc +++ b/src/ir/module.cc @@ -31,6 +31,7 @@ // Rationale: We calls into relay's analysis module to verify correctness. #include #include +#include #include #include @@ -371,10 +372,7 @@ void IRModuleNode::ImportFromStd(const String& path) { std::unordered_set IRModuleNode::Imports() const { return this->import_set_; } IRModule IRModule::FromText(const String& text, const String& source_path) { - auto* f = tvm::runtime::Registry::Get("relay.fromtext"); - CHECK(f != nullptr) << "The Relay std_path is not set, please register tvm.relay.std_path."; - IRModule mod = (*f)(text, source_path); - return mod; + return tvm::parser::ParseModule(source_path, text); } TVM_REGISTER_NODE_TYPE(IRModuleNode); diff --git a/src/parser/parser.cc b/src/parser/parser.cc index 470c2299b1cb8..375df1abc8186 100644 --- a/src/parser/parser.cc +++ b/src/parser/parser.cc @@ -593,7 +593,7 @@ class Parser { } } else if (required) { this->diag_ctx->Emit(DiagnosticBuilder(DiagnosticLevel::Error, Peek()->span) - << "expected text format semantic version " + << "expected text format semantic version, found a " << PrettyPrint(Peek()) << "you can annotate it as #[version = \"0.0.5\"]"); } return SemVer(0, 0, 5); diff --git a/src/parser/source_map.cc b/src/parser/source_map.cc index e77e53ecc1b4f..11789a5bf4d3b 100644 --- a/src/parser/source_map.cc +++ b/src/parser/source_map.cc @@ -60,6 +60,7 @@ Source::Source(const std::string& source) : source(source) { * \param msg The message to attach. */ void Source::ReportAt(std::ostream& out, const Span& span, const std::string& msg) const { + DLOG(INFO) << "Source::ReportAt" << "span = " << span << "msg = " << msg; int line = span->line; int column = span->column;