[ROCM] Core Functionality for AMD (#1983)

* this pr adds a third party backend for triton that works on AMD
* this expose a lot of the work that has been done in our
[fork](https://github.com/ROCmSoftwarePlatform/triton)
* most unit tests on `test_core.py` pass
* it skips some unit tests for various reasons
* we plan to follow up with more prs improving Functionality and
Performance in the future

---------

Co-authored-by: Philippe Tillet <phil@openai.com>
This commit is contained in:
Michael Melesse
2023-10-16 15:06:07 -05:00
parent 833c9b985f
commit 09ba348f87
17 changed files with 264 additions and 377 deletions

View File

@@ -53,7 +53,6 @@ llvm_update_compile_flags(triton-translate)
TritonNvidiaGPUTransforms
TritonLLVMIR
TritonPTX
TritonHSACO
${dialect_libs}
${conversion_libs}
# tests

View File

@@ -15,7 +15,6 @@
#include "triton/Dialect/Triton/IR/Dialect.h"
#include "triton/Dialect/TritonGPU/IR/Dialect.h"
#include "triton/Dialect/TritonNvidiaGPU/IR/Dialect.h"
#include "triton/Target/HSACO/HSACOTranslation.h"
#include "triton/Target/LLVMIR/LLVMIRTranslation.h"
#include "triton/Target/PTX/PTXTranslation.h"
#include "llvm/IR/LLVMContext.h"
@@ -138,16 +137,11 @@ LogicalResult tritonTranslateMain(int argc, char **argv,
llvm::errs() << "Translate to LLVM IR failed";
}
if (targetKind == "llvmir")
if (targetKind == "llvmir") {
llvm::outs() << *llvmir << '\n';
else if (targetKind == "ptx")
} else if (targetKind == "ptx") {
llvm::outs() << ::triton::translateLLVMIRToPTX(*llvmir, SMArch.getValue(),
ptxVersion.getValue());
else if (targetKind == "hsaco") {
auto [module, hsaco] = ::triton::translateLLVMIRToHSACO(
*llvmir, GCNArch.getValue(), GCNTriple.getValue(),
GCNFeatures.getValue());
llvm::outs() << hsaco;
} else {
llvm::errs() << "Error: Unknown target specified: " << targetKind << "\n";
return failure();