Skip to content

Commit

Permalink
Add TargetModel column and row shift to python bindings (#1560)
Browse files Browse the repository at this point in the history
  • Loading branch information
fifield authored Jun 14, 2024
1 parent 413a021 commit c5fc35d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
6 changes: 6 additions & 0 deletions include/aie-c/TargetModel.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ aieTargetModelGetMemTileSize(AieTargetModel targetModel);
/// Returns true if this is an NPU target model.
MLIR_CAPI_EXPORTED bool aieTargetModelIsNPU(AieTargetModel targetModel);

MLIR_CAPI_EXPORTED uint32_t
aieTargetModelGetColumnShift(AieTargetModel targetModel);

MLIR_CAPI_EXPORTED uint32_t
aieTargetModelGetRowShift(AieTargetModel targetModel);

#ifdef __cplusplus
}
#endif
Expand Down
8 changes: 8 additions & 0 deletions lib/CAPI/TargetModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,4 +151,12 @@ uint32_t aieTargetModelGetMemTileSize(AieTargetModel targetModel) {

bool aieTargetModelIsNPU(AieTargetModel targetModel) {
return unwrap(targetModel).isNPU();
}

uint32_t aieTargetModelGetColumnShift(AieTargetModel targetModel) {
return unwrap(targetModel).getColumnShift();
}

uint32_t aieTargetModelGetRowShift(AieTargetModel targetModel) {
return unwrap(targetModel).getRowShift();
}
12 changes: 10 additions & 2 deletions python/AIEMLIRModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,15 @@ PYBIND11_MODULE(_aie, m) {
// .def("get_num_dest_shim_mux_connections", int col, int row)
// .def("get_num_source_shim_mux_connections", int col, int row)
// .def("is_legal_memtile_connection")
.def("is_npu", [](PyAieTargetModel &self) {
return aieTargetModelIsNPU(self.get());
.def("is_npu",
[](PyAieTargetModel &self) {
return aieTargetModelIsNPU(self.get());
})
.def("get_column_shift",
[](PyAieTargetModel &self) {
return aieTargetModelGetColumnShift(self.get());
})
.def("get_row_shift", [](PyAieTargetModel &self) {
return aieTargetModelGetRowShift(self.get());
});
}

0 comments on commit c5fc35d

Please sign in to comment.