[nnc] Updated generic error message with info about turning off the fuser (#64316)
authorRaghavan Raman <raghavanr@fb.com>
Wed, 1 Sep 2021 17:28:02 +0000 (10:28 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Wed, 1 Sep 2021 17:31:50 +0000 (10:31 -0700)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64316

Test Plan: Imported from OSS

Reviewed By: bertmaher

Differential Revision: D30683942

Pulled By: navahgar

fbshipit-source-id: d86607563672213f99a1436dcf4f5dc28053b713

torch/csrc/jit/tensorexpr/kernel.cpp

index 78cbb82..f9653ae 100644 (file)
@@ -67,10 +67,16 @@ namespace jit {
 namespace tensorexpr {
 
 std::string buildErrorMessage(const std::string& s) {
-  // TODO: Update this generic error message to include details regarding
-  // turning off the fuser.
-  static const std::string generic_error_message = "";
-  return s + " " + generic_error_message;
+  static const std::string generic_error_message =
+      "This error occured in the fuser. You can turn off the fuser with "
+      "torch._C._jit_override_can_fuse_on_cpu(False)";
+  if (s.empty()) {
+    return generic_error_message;
+  }
+  if (s.back() == '.') {
+    return s + " " + generic_error_message;
+  }
+  return s + ". " + generic_error_message;
 }
 
 static int te_cuda_pointwise_loop_levels = -1;