Skip to content

Commit

Permalink
[Support] Closes NVIDIA#532: change backtrace error message
Browse files Browse the repository at this point in the history
  • Loading branch information
boschmitt committed Aug 9, 2023
1 parent ec38d3e commit b527ea3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 2 deletions.
20 changes: 20 additions & 0 deletions include/cudaq/Support/Version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/****************************************************************-*- C++ -*-****
* Copyright (c) 2022 - 2023 NVIDIA Corporation & Affiliates. *
* All rights reserved. *
* *
* This source code and the accompanying materials are made available under *
* the terms of the Apache License 2.0 which accompanies this distribution. *
******************************************************************************/

#pragma once

namespace cudaq {

// TODO: const char *getVersion();

/// A generic bug report message.
constexpr const char *bugReportMsg =
"PLEASE submit a bug report to https://github.com/NVIDIA/cuda-quantum and "
"include the crash backtrace.\n";

} // namespace cudaq
5 changes: 5 additions & 0 deletions tools/cudaq-opt/cudaq-opt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "cudaq/Optimizer/Dialect/Quake/QuakeDialect.h"
#include "cudaq/Optimizer/Transforms/Passes.h"
#include "cudaq/Support/Plugin.h"
#include "cudaq/Support/Version.h"
#include "llvm/Option/Option.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
Expand Down Expand Up @@ -50,6 +51,10 @@ static cl::list<std::string>
cl::desc("Load passes from plugin library"));

int main(int argc, char **argv) {
// Set the bug report message to indicate users should file issues on
// nvidia/cuda-quantum
llvm::setBugReportMsg(cudaq::bugReportMsg);

mlir::registerAllPasses();
cudaq::opt::registerOptCodeGenPasses();
cudaq::opt::registerOptTransformsPasses();
Expand Down
8 changes: 6 additions & 2 deletions tools/cudaq-quake/cudaq-quake.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "cudaq/Optimizer/Dialect/CC/CCDialect.h"
#include "cudaq/Optimizer/Dialect/Quake/QuakeDialect.h"
#include "cudaq/Optimizer/Support/Verifier.h"
#include "cudaq/Support/Version.h"
#include "nvqpp_config.h"
#include "clang/CodeGen/BackendUtil.h"
#include "clang/CodeGen/CodeGenAction.h"
Expand Down Expand Up @@ -261,9 +262,12 @@ std::string getExecutablePath(const char *argv0, bool canonicalPrefixes) {
//===----------------------------------------------------------------------===//

int main(int argc, char **argv) {
// Set the bug report message to indicate users should file issues on
// nvidia/cuda-quantum
llvm::setBugReportMsg(cudaq::bugReportMsg);

// First we need the location of this cudaq-quake executable
// so that we can get the install path
// We need the location of this cudaq-quake executable so that we can get the
// install path
std::string executablePath = getExecutablePath(argv[0], true);
std::filesystem::path cudaqQuakePath{executablePath};
auto installBinPath = cudaqQuakePath.parent_path();
Expand Down
6 changes: 6 additions & 0 deletions tools/cudaq-translate/cudaq-translate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
#include "cudaq/Optimizer/Dialect/CC/CCDialect.h"
#include "cudaq/Optimizer/Dialect/Quake/QuakeDialect.h"
#include "cudaq/Optimizer/Transforms/Passes.h"
#include "cudaq/Support/Version.h"
#include "cudaq/Target/IQM/IQMJsonEmitter.h"
#include "cudaq/Target/OpenQASM/OpenQASMEmitter.h"
#include "cudaq/Todo.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/ErrorOr.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ToolOutputFile.h"
Expand Down Expand Up @@ -115,6 +117,10 @@ static void checkErrorCode(const std::error_code &ec) {
}

int main(int argc, char **argv) {
// Set the bug report message to indicate users should file issues on
// nvidia/cuda-quantum
llvm::setBugReportMsg(cudaq::bugReportMsg);

registerAsmPrinterCLOptions();
registerMLIRContextCLOptions();
registerPassManagerCLOptions();
Expand Down

0 comments on commit b527ea3

Please sign in to comment.