Making iree_hal_dim_t track iree_device_size_t, and making that size_t.
This is the least surprising behavior while still allowing overriding
of the sizes via custom configuration. dim is tied to size because they
both come from index in MLIR.
diff --git a/runtime/bindings/python/hal.h b/runtime/bindings/python/hal.h
index c8484cd..27c9351 100644
--- a/runtime/bindings/python/hal.h
+++ b/runtime/bindings/python/hal.h
@@ -106,13 +106,13 @@
struct HalShape {
public:
- static HalShape FromIntVector(std::vector<int32_t> indices) {
+ static HalShape FromIntVector(std::vector<iree_hal_dim_t> indices) {
HalShape s;
s.s = {indices.begin(), indices.end()};
return s;
}
- std::vector<int32_t> s;
+ std::vector<iree_hal_dim_t> s;
};
class HalBufferView
@@ -184,7 +184,7 @@
}
py::buffer_info ToBufferInfo() {
- std::vector<int32_t> shape(iree_hal_buffer_view_shape_rank(bv_));
+ std::vector<iree_hal_dim_t> shape(iree_hal_buffer_view_shape_rank(bv_));
CheckApiStatus(
iree_hal_buffer_view_shape(bv_, shape.size(), shape.data(), nullptr),
"Error getting buffer view shape");
diff --git a/runtime/bindings/python/vm.cc b/runtime/bindings/python/vm.cc
index d5b7cc6..9a268c1 100644
--- a/runtime/bindings/python/vm.cc
+++ b/runtime/bindings/python/vm.cc
@@ -318,7 +318,7 @@
// Extract dims from the buffer view.
size_t rank = 0;
- std::vector<int32_t> dims(6);
+ std::vector<iree_hal_dim_t> dims(6);
iree_status_t status = iree_hal_buffer_view_shape(
buffer_view, dims.capacity(), dims.data(), &rank);
if (iree_status_is_out_of_range(status)) {
@@ -436,7 +436,8 @@
} else if (iree_hal_buffer_view_isa(variant.ref)) {
auto hal_bv = iree_hal_buffer_view_deref(variant.ref);
out += "HalBufferView(";
- std::vector<int32_t> shape(iree_hal_buffer_view_shape_rank(hal_bv));
+ std::vector<iree_hal_dim_t> shape(
+ iree_hal_buffer_view_shape_rank(hal_bv));
iree_hal_buffer_view_shape(hal_bv, shape.size(), shape.data(), nullptr);
for (size_t i = 0; i < shape.size(); ++i) {
if (i > 0) out += 'x';