message: Fix: Report missing  'tf.gp' more cleanly.
  Summary: Adjust path to work with TF_POPLAR_SANDBOX
  Reviewers: #tensorflow, #framework_ip_review_-_any_oss_or_third-party_code_use_has_been_approved, georgep
  Subscribers: georgep, davidn
  Maniphest Tasks: T17825
diff: @@ -162,7 +162,7 @@ int64 SizeFunction(const BufferValue& buffer) {
  return ShapeUtil::ByteSizeOf(buffer.shape(), 1);
  }
  -std::string GetPathToGraphProgFile(std::string filename) {
  +StatusOr<std::string> GetPathToGraphProgFile(std::string filename) {
  Dl_info dlInfo;
  static const void* dummy;
  if (dladdr(&dummy, &dlInfo)) {
  @@ -178,7 +178,9 @@ std::string GetPathToGraphProgFile(std::string filename) {
  {
  char buf[256];
  if (!getcwd(buf, 255)) {
  - return "";
  + return xla::InternalErrorStrCat("Failed to retrieve current working ",
  + "directory when looking for '", filename,
  + "' codelets");
  }
  std::string path(buf);
  path = path + "/tensorflow/compiler/plugin/poplar/" + filename;
  @@ -187,8 +189,9 @@ std::string GetPathToGraphProgFile(std::string filename) {
  }
  }
  - return "";
  + return xla::InternalErrorStrCat("Failed to find '", filename, "' codelets");
  }
  +
  bool GetConstantSubOutput(const HloInstruction* root, const Shape& layout,
  std::vector<Literal>& sub_result) {
  if (root->opcode() == HloOpcode::kConstant) {
  @@ -548,7 +551,9 @@ Status CreatePoplarGraphs(CompilerResources& resources, const HloModule* module,
  VLOG(1) << " * Shard " << next_shard_id++ << " mapped to IPU " << hw_id;
  }
  }
  - main_graph.addCodelets(GetPathToGraphProgFile("tf.gp"));
  + TF_ASSIGN_OR_RETURN(const std::string codelets_path,
  + GetPathToGraphProgFile("tf.gp"));
  + main_graph.addCodelets(codelets_path);
  poplin::addCodelets(main_graph);
  popnn::addCodelets(main_graph);
  popops::addCodelets(main_graph);
  