[Triton-MLIR][BACKEND] Refine dot conversion (#710)
This PR does 1. Refine the dot conversion 2. some other tiny code refinement
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "triton/Conversion/TritonGPUToLLVM/PtxAsmFormat.h"
|
||||
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
|
||||
#include "mlir/Transforms/DialectConversion.h"
|
||||
#include "llvm/Support/raw_ostream.h"
|
||||
#include <sstream> // unify to llvm::raw_string_ostream ?
|
||||
|
||||
@@ -10,7 +12,7 @@ std::string strJoin(llvm::ArrayRef<std::string> strs,
|
||||
llvm::StringRef delimiter) {
|
||||
std::string osStr;
|
||||
llvm::raw_string_ostream os(osStr);
|
||||
for (size_t i = 0; !strs.empty() && i < strs.size() - 1; i++)
|
||||
for (size_t i = 0; !strs.empty() && i < strs.size() - 1; ++i)
|
||||
os << strs[i] << delimiter;
|
||||
if (!strs.empty())
|
||||
os << strs.back();
|
||||
@@ -74,6 +76,25 @@ SmallVector<PTXBuilder::Operand *, 4> PTXBuilder::getAllArgs() const {
|
||||
return res;
|
||||
}
|
||||
|
||||
mlir::Value PTXBuilder::launch(ConversionPatternRewriter &rewriter,
|
||||
Location loc, Type resTy, bool hasSideEffect,
|
||||
bool isAlignStack,
|
||||
ArrayRef<Attribute> attrs) const {
|
||||
auto *ctx = rewriter.getContext();
|
||||
auto inlineAsm = rewriter.create<LLVM::InlineAsmOp>(
|
||||
loc, resTy, getAllMLIRArgs(), // operands
|
||||
dump(), // asm_string
|
||||
getConstraints(), // constraints
|
||||
hasSideEffect, // has_side_effects
|
||||
isAlignStack, // is_align_stack
|
||||
LLVM::AsmDialectAttr::get(ctx,
|
||||
LLVM::AsmDialect::AD_ATT), // asm_dialect
|
||||
ArrayAttr::get(ctx, attrs) // operand_attrs
|
||||
);
|
||||
|
||||
return inlineAsm.getRes();
|
||||
}
|
||||
|
||||
std::string PTXInstr::Operand::dump() const {
|
||||
if (repr)
|
||||
return repr(idx);
|
||||
@@ -151,5 +172,6 @@ PTXInstrExecution::getArgList() const {
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
} // namespace triton
|
||||
} // namespace mlir
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user