[FRONTEND] Fix triton-translate default options

This PR fixes option behavior in triton-translate utility and
adds additional error reporting message for unsupported triple value.
This commit is contained in:
Alexander Efimov
2023-03-19 19:53:34 +00:00
parent c9a68bdca9
commit 254768fafb
2 changed files with 16 additions and 4 deletions

View File

@@ -92,7 +92,7 @@ LogicalResult tritonTranslateMain(int argc, char **argv,
llvm::cl::value_desc("architecture"), llvm::cl::init("90a"));
static llvm::cl::opt<std::string> GCNTriple(
"amdgcn", llvm::cl::desc("AMDGCN triple. e.g. '-amd-amdhsa'"),
"amdgcn", llvm::cl::desc("AMDGCN triple vendor and platfom. e.g. '-amd-amdhsa'"),
llvm::cl::value_desc("target triple"), llvm::cl::init("-amd-amdhsa"));
static llvm::cl::opt<std::string> GCNFeatures(
@@ -131,10 +131,11 @@ LogicalResult tritonTranslateMain(int argc, char **argv,
llvm::outs() << ::triton::translateLLVMIRToPTX(*llvmir, SMArch.getValue(),
ptxVersion.getValue());
else if (targetKind == "hsaco") {
const std::string arch = "gfx" + GCNArch.getValue();
const std::string triple = "amdgcn" + GCNTriple.getValue();
const std::string features = GCNFeatures.getValue();
auto [module, hsaco] =
::triton::translateLLVMIRToHSACO(*llvmir, GCNArch.getValue(),
GCNTriple.getValue(),
GCNFeatures.getValue());
::triton::translateLLVMIRToHSACO(*llvmir, arch, triple, features);
llvm::outs() << hsaco;
} else {
llvm::errs() << "Error: Unknown target specified: " << targetKind << "\n";