[FRONTEND][BACKEND] Small fixes to multiple_of, num_programs, axisinfo; enable block-sparse tests (#927)

This commit is contained in:
Philippe Tillet
2022-11-29 20:00:34 +01:00
committed by GitHub
parent 66c36c4378
commit 9bb54402b3
8 changed files with 229 additions and 17 deletions

View File

@@ -187,6 +187,7 @@ void init_triton_ir(py::module &&m) {
/* issue a warning */
}
})
.def("get_context", &mlir::Value::getContext)
.def("replace_all_uses_with",
[](mlir::Value &self, mlir::Value &newValue) {
self.replaceAllUsesWith(newValue);
@@ -335,6 +336,16 @@ void init_triton_ir(py::module &&m) {
return funcs[0];
});
m.def("make_attr",
[](const std::vector<int> &values, mlir::MLIRContext &context) {
return mlir::DenseIntElementsAttr::get(
mlir::RankedTensorType::get(
{static_cast<int64_t>(values.size())},
mlir::IntegerType::get(&context, 32)),
values)
.cast<mlir::Attribute>();
});
m.def(
"parse_mlir_module",
[](const std::string &inputFilename, mlir::MLIRContext &context) {