Skip to content

Commit

Permalink
Improve errors and fix the semantic version tags in Prelude
Browse files Browse the repository at this point in the history
  • Loading branch information
jroesch committed Jul 30, 2020
1 parent 233bb33 commit 581970a
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 12 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,3 @@ conda/pkg
# nix files
.envrc
*.nix

# antlr files
*.tokens
*.interp
2 changes: 1 addition & 1 deletion include/tvm/parser/parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion python/tvm/relay/std/core.rly
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
v0.0.4

#[version = "0.0.5"]

extern type Storage
2 changes: 1 addition & 1 deletion python/tvm/relay/std/prelude.rly
Original file line number Diff line number Diff line change
Expand Up @@ -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]`)?

Expand Down
6 changes: 2 additions & 4 deletions src/ir/module.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
// Rationale: We calls into relay's analysis module to verify correctness.
#include <tvm/relay/analysis.h>
#include <tvm/relay/transform.h>
#include <tvm/parser/parser.h>

#include <fstream>
#include <sstream>
Expand Down Expand Up @@ -371,10 +372,7 @@ void IRModuleNode::ImportFromStd(const String& path) {
std::unordered_set<String> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/parser/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/parser/source_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 581970a

Please sign in to comment.