Making runtime APIs with sized arrays consistently (count, array). (#9416)
I think I'd originally been using (array, count) to match things like
the std::string constructor, but I think it makes it harder to read
when not actually constructing a span.
diff --git a/runtime/bindings/python/hal.cc b/runtime/bindings/python/hal.cc
index 234aa63..09a5c07 100644
--- a/runtime/bindings/python/hal.cc
+++ b/runtime/bindings/python/hal.cc
@@ -126,7 +126,7 @@
iree_hal_buffer_view_t* hal_buffer_view;
CheckApiStatus(
iree_hal_buffer_view_create(
- hal_buffer, dims.data(), dims.size(), *element_type, encoding_type,
+ hal_buffer, dims.size(), dims.data(), *element_type, encoding_type,
iree_hal_allocator_host_allocator(raw_ptr()), &hal_buffer_view),
"Error allocating buffer_view");
iree_hal_buffer_release(hal_buffer);
@@ -210,12 +210,12 @@
//------------------------------------------------------------------------------
std::vector<std::string> HalDriver::Query() {
- iree_hal_driver_info_t* driver_infos = NULL;
iree_host_size_t driver_info_count = 0;
+ iree_hal_driver_info_t* driver_infos = NULL;
CheckApiStatus(
iree_hal_driver_registry_enumerate(iree_hal_driver_registry_default(),
- iree_allocator_system(), &driver_infos,
- &driver_info_count),
+ iree_allocator_system(),
+ &driver_info_count, &driver_infos),
"Error enumerating HAL drivers");
std::vector<std::string> driver_names(driver_info_count);
for (iree_host_size_t i = 0; i < driver_info_count; ++i) {
diff --git a/runtime/bindings/python/hal.h b/runtime/bindings/python/hal.h
index 27c9351..1aac34c 100644
--- a/runtime/bindings/python/hal.h
+++ b/runtime/bindings/python/hal.h
@@ -142,7 +142,7 @@
iree_hal_encoding_type_t encoding_type =
IREE_HAL_ENCODING_TYPE_DENSE_ROW_MAJOR;
CheckApiStatus(iree_hal_buffer_view_create(
- raw_ptr(), shape.s.data(), shape.s.size(), element_type,
+ raw_ptr(), shape.s.size(), shape.s.data(), element_type,
encoding_type, iree_allocator_system(), &bv),
"Error creating buffer view");
return HalBufferView::StealFromRawPtr(bv);
diff --git a/runtime/bindings/python/vm.cc b/runtime/bindings/python/vm.cc
index f74e8aa..d6a78e5 100644
--- a/runtime/bindings/python/vm.cc
+++ b/runtime/bindings/python/vm.cc
@@ -93,8 +93,8 @@
module_handles[i] = (*modules)[i]->raw_ptr();
}
auto status = iree_vm_context_create_with_modules(
- instance->raw_ptr(), IREE_VM_CONTEXT_FLAG_NONE, module_handles.data(),
- module_handles.size(), iree_allocator_system(), &context);
+ instance->raw_ptr(), IREE_VM_CONTEXT_FLAG_NONE, module_handles.size(),
+ module_handles.data(), iree_allocator_system(), &context);
CheckApiStatus(status, "Error creating vm context with modules");
}
@@ -108,8 +108,8 @@
for (size_t i = 0, e = module_handles.size(); i < e; ++i) {
module_handles[i] = modules[i]->raw_ptr();
}
- auto status = iree_vm_context_register_modules(raw_ptr(), &module_handles[0],
- module_handles.size());
+ auto status = iree_vm_context_register_modules(
+ raw_ptr(), module_handles.size(), &module_handles[0]);
CheckApiStatus(status, "Error registering modules");
}