/* Copyright (c) 2015 - present Advanced Micro Devices, Inc. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "ArgParse.h" cl::OptionCategory ToolTemplateCategory("CUDA to HIP source translator options"); cl::opt OutputFilename("o", cl::desc("Output filename"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); cl::opt OutputDir("o-dir", cl::desc("Output directory"), cl::value_desc("directory"), cl::cat(ToolTemplateCategory)); cl::opt GeneratePerl("perl", cl::desc("Generate hipify-perl"), cl::value_desc("perl"), cl::cat(ToolTemplateCategory)); cl::opt GeneratePython("python", cl::desc("Generate hipify-python"), cl::value_desc("python"), cl::cat(ToolTemplateCategory)); cl::opt OutputHipifyPerlDir("o-hipify-perl-dir", cl::desc("Output directory for hipify-perl script"), cl::value_desc("directory"), cl::cat(ToolTemplateCategory)); cl::opt OutputPythonMapDir("o-python-map-dir", cl::desc("Output directory for Python map"), cl::value_desc("directory"), cl::cat(ToolTemplateCategory)); cl::opt TemporaryDir("temp-dir", cl::desc("Temporary directory"), cl::value_desc("directory"), cl::cat(ToolTemplateCategory)); cl::opt CudaPath("cuda-path", cl::desc("CUDA installation path"), cl::value_desc("directory"), cl::cat(ToolTemplateCategory)); cl::opt SaveTemps("save-temps", cl::desc("Save temporary files"), cl::value_desc("save-temps"), cl::cat(ToolTemplateCategory)); cl::opt Verbose("v", cl::desc("Show commands to run and use verbose output"), cl::value_desc("v"), cl::cat(ToolTemplateCategory)); cl::opt TranslateToRoc("roc", cl::desc("Translate to roc instead of hip where it is possible"), cl::value_desc("roc"), cl::cat(ToolTemplateCategory)); cl::opt 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 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 NoOutput("no-output", cl::desc("Don't write any translated output to stdout"), cl::value_desc("no-output"), cl::cat(ToolTemplateCategory)); cl::opt PrintStats("print-stats", cl::desc("Print translation statistics"), cl::value_desc("print-stats"), cl::cat(ToolTemplateCategory)); cl::opt PrintStatsCSV("print-stats-csv", cl::desc("Print translation statistics in CSV file"), cl::value_desc("print-stats-csv"), cl::cat(ToolTemplateCategory)); cl::opt OutputStatsFilename("o-stats", cl::desc("Output filename for statistics"), cl::value_desc("filename"), cl::cat(ToolTemplateCategory)); cl::opt Examine("examine", cl::desc("Combines -no-output and -print-stats options"), cl::value_desc("examine"), cl::cat(ToolTemplateCategory)); cl::opt DashDash(" ", cl::desc("Separator between hipify-clang and clang options;\ndon't specify if there are no clang options"), cl::ValueDisallowed, cl::cat(ToolTemplateCategory)); cl::list IncludeDirs("I", cl::desc("Add directory to include search path"), cl::value_desc("directory"), cl::ZeroOrMore, cl::Prefix, cl::cat(ToolTemplateCategory)); cl::list MacroNames("D", cl::desc("Define to or 1 if omitted"), cl::value_desc("macro>= SkipExcludedPPConditionalBlocks("skip-excluded-preprocessor-conditional-blocks", cl::desc("Enable default preprocessor behaviour by skipping undefined conditional blocks"), cl::value_desc("skip-excluded-preprocessor-conditional-blocks"), cl::cat(ToolTemplateCategory)); cl::opt CudaGpuArch("cuda-gpu-arch", cl::desc("CUDA GPU architecture (e.g. sm_35);\nmay be specified more than once"), cl::value_desc("value"), cl::ZeroOrMore, cl::Prefix, cl::cat(ToolTemplateCategory)); cl::extrahelp CommonHelp(ct::CommonOptionsParser::HelpMessage);