Allow multiple_of and max_contiguous to accept n-d values (#617)

This commit is contained in:
Da Yan
2022-08-10 09:59:32 -07:00
committed by GitHub
parent cc79376222
commit 3e2953f357
8 changed files with 47 additions and 27 deletions

View File

@@ -625,13 +625,13 @@ void init_triton_ir(py::module &&m) {
.def(py::init<>());
py::class_<ir::value>(m, "value")
.def("multiple_of", [](ir::value *self, int val) {
.def("multiple_of", [](ir::value *self, std::vector<unsigned> val) {
if (auto *instr = dynamic_cast<ir::instruction*>(self)) {
instr->set_metadata(ir::metadata::multiple_of, val);
} else
throw std::runtime_error("multiple_of");
})
.def("max_contiguous", [](ir::value *self, int val) {
.def("max_contiguous", [](ir::value *self, std::vector<unsigned> val) {
if (auto *instr = dynamic_cast<ir::instruction*>(self)) {
instr->set_metadata(ir::metadata::max_contiguous, val);
} else