24cdc5e1d3
Most of what hipify does is really just replacing CUDA idenitifers with HIP ones. CUDA function calls, preprocessor macro calls, enum references, types, etc. This is problematic: calls/types/enum-refs require name resolution for the AST matcher to work. This fails in the presence of code deleted by the preprocessor, and in two-pass template compilation. Instead, we can simply hook the lexer and have it rewrite the identifiers for us. This approach means identifier transformations will work correctly regardless of where they appear (and we get to delete lots of code) - Fixes #260 - Helps a bit with #207 - it will still fail to translate kernel calls in preprocessor-ignored code, but everything except kerel launches should translate correctly now, even in preprocessor-deleted code.
41 lines
1.3 KiB
C++
41 lines
1.3 KiB
C++
#include "ArgParse.h"
|
|
|
|
cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options");
|
|
|
|
cl::opt<std::string> OutputFilename("o",
|
|
cl::desc("Output filename"),
|
|
cl::value_desc("filename"),
|
|
cl::cat(ToolTemplateCategory));
|
|
|
|
cl::opt<bool> Inplace("inplace",
|
|
cl::desc("Modify input file inplace, replacing input with hipified output, save backup in .prehip file"),
|
|
cl::value_desc("inplace"),
|
|
cl::cat(ToolTemplateCategory));
|
|
|
|
cl::opt<bool> NoBackup("no-backup",
|
|
cl::desc("Don't create a backup file for the hipified source"),
|
|
cl::value_desc("no-backup"),
|
|
cl::cat(ToolTemplateCategory));
|
|
|
|
cl::opt<bool> NoOutput("no-output",
|
|
cl::desc("Don't write any translated output to stdout"),
|
|
cl::value_desc("no-output"),
|
|
cl::cat(ToolTemplateCategory));
|
|
|
|
cl::opt<bool> PrintStats("print-stats",
|
|
cl::desc("Print translation statistics"),
|
|
cl::value_desc("print-stats"),
|
|
cl::cat(ToolTemplateCategory));
|
|
|
|
cl::opt<std::string> OutputStatsFilename("o-stats",
|
|
cl::desc("Output filename for statistics"),
|
|
cl::value_desc("filename"),
|
|
cl::cat(ToolTemplateCategory));
|
|
|
|
cl::opt<bool> Examine("examine",
|
|
cl::desc("Combines -no-output and -print-stats options"),
|
|
cl::value_desc("examine"),
|
|
cl::cat(ToolTemplateCategory));
|
|
|
|
cl::extrahelp CommonHelp(ct::CommonOptionsParser::HelpMessage);
|