Changing IREE_ALLOCATOR_* macros to static inline functions.
diff --git a/bindings/python/pyiree/rt/function_abi.cc b/bindings/python/pyiree/rt/function_abi.cc
index 0f700a8..7326e6b 100644
--- a/bindings/python/pyiree/rt/function_abi.cc
+++ b/bindings/python/pyiree/rt/function_abi.cc
@@ -398,7 +398,7 @@
iree_hal_buffer_view_t* buffer_view;
CheckApiStatus(iree_hal_buffer_view_create(
raw_buffer, dims.data(), dims.size(), element_type,
- IREE_ALLOCATOR_SYSTEM, &buffer_view),
+ iree_allocator_system(), &buffer_view),
"Error allocating buffer_view");
iree_hal_buffer_release(raw_buffer);
iree_vm_ref_t buffer_view_ref =
@@ -486,7 +486,7 @@
iree_hal_buffer_view_t* buffer_view;
CheckApiStatus(iree_hal_buffer_view_create(
raw_buffer, dims.data(), dims.size(), element_type,
- IREE_ALLOCATOR_SYSTEM, &buffer_view),
+ iree_allocator_system(), &buffer_view),
"Error allocating buffer_view");
iree_hal_buffer_release(raw_buffer);
iree_vm_ref_t buffer_view_ref = iree_hal_buffer_view_move_ref(buffer_view);
diff --git a/bindings/python/pyiree/rt/hal.cc b/bindings/python/pyiree/rt/hal.cc
index f271071..5f6ad9a 100644
--- a/bindings/python/pyiree/rt/hal.cc
+++ b/bindings/python/pyiree/rt/hal.cc
@@ -95,7 +95,7 @@
iree_string_view_t* driver_names;
iree_host_size_t driver_count;
CheckApiStatus(iree_hal_driver_registry_query_available_drivers(
- IREE_ALLOCATOR_SYSTEM, &driver_names, &driver_count),
+ iree_allocator_system(), &driver_names, &driver_count),
"Error querying drivers");
std::vector<std::string> drivers;
@@ -111,7 +111,7 @@
iree_hal_driver_t* driver;
CheckApiStatus(iree_hal_driver_registry_create_driver(
{driver_name.data(), driver_name.size()},
- IREE_ALLOCATOR_SYSTEM, &driver),
+ iree_allocator_system(), &driver),
"Error creating driver");
return HalDriver::CreateRetained(driver);
}
@@ -119,7 +119,7 @@
HalDevice HalDriver::CreateDefaultDevice() {
iree_hal_device_t* device;
CheckApiStatus(iree_hal_driver_create_default_device(
- raw_ptr(), IREE_ALLOCATOR_SYSTEM, &device),
+ raw_ptr(), iree_allocator_system(), &device),
"Error creating default device");
return HalDevice::CreateRetained(device);
}
diff --git a/bindings/python/pyiree/rt/hal.h b/bindings/python/pyiree/rt/hal.h
index 8526b2f..7c25409 100644
--- a/bindings/python/pyiree/rt/hal.h
+++ b/bindings/python/pyiree/rt/hal.h
@@ -99,7 +99,7 @@
iree_hal_heap_buffer_allocate(
static_cast<iree_hal_memory_type_t>(memory_type),
static_cast<iree_hal_buffer_usage_t>(usage), allocation_size,
- IREE_ALLOCATOR_SYSTEM, IREE_ALLOCATOR_SYSTEM, &buffer),
+ iree_allocator_system(), iree_allocator_system(), &buffer),
"Error allocating heap buffer");
return HalBuffer::CreateRetained(buffer);
}
@@ -121,7 +121,7 @@
IREE_HAL_ELEMENT_TYPE_NONE, element_size * 8);
CheckApiStatus(
iree_hal_buffer_view_create(raw_ptr(), shape.s.data(), shape.s.size(),
- element_type, IREE_ALLOCATOR_SYSTEM, &bv),
+ element_type, iree_allocator_system(), &bv),
"Error creating buffer view");
return HalBufferView::CreateRetained(bv);
}
diff --git a/bindings/python/pyiree/rt/vm.cc b/bindings/python/pyiree/rt/vm.cc
index 9892814..5cd4cbd 100644
--- a/bindings/python/pyiree/rt/vm.cc
+++ b/bindings/python/pyiree/rt/vm.cc
@@ -34,23 +34,24 @@
VmModule CreateHalModule(HalDevice* device) {
iree_vm_module_t* module;
- CheckApiStatus(
- iree_hal_module_create(device->raw_ptr(), IREE_ALLOCATOR_SYSTEM, &module),
- "Error creating hal module");
+ CheckApiStatus(iree_hal_module_create(device->raw_ptr(),
+ iree_allocator_system(), &module),
+ "Error creating hal module");
return VmModule::CreateRetained(module);
}
VmModule CreateStringsModule() {
iree_vm_module_t* module;
- CheckApiStatus(iree_strings_module_create(IREE_ALLOCATOR_SYSTEM, &module),
+ CheckApiStatus(iree_strings_module_create(iree_allocator_system(), &module),
"Error creating trings module");
return VmModule::CreateRetained(module);
}
VmModule CreateTensorListModule() {
iree_vm_module_t* module;
- CheckApiStatus(iree_tensorlist_module_create(IREE_ALLOCATOR_SYSTEM, &module),
- "Error creating tensorlist module");
+ CheckApiStatus(
+ iree_tensorlist_module_create(iree_allocator_system(), &module),
+ "Error creating tensorlist module");
return VmModule::CreateRetained(module);
}
@@ -62,7 +63,7 @@
VmInstance VmInstance::Create() {
iree_vm_instance_t* instance;
- auto status = iree_vm_instance_create(IREE_ALLOCATOR_SYSTEM, &instance);
+ auto status = iree_vm_instance_create(iree_allocator_system(), &instance);
CheckApiStatus(status, "Error creating instance");
return VmInstance::CreateRetained(instance);
}
@@ -77,7 +78,7 @@
if (!modules) {
// Simple create with open allowed modules.
auto status = iree_vm_context_create(instance->raw_ptr(),
- IREE_ALLOCATOR_SYSTEM, &context);
+ iree_allocator_system(), &context);
CheckApiStatus(status, "Error creating vm context");
} else {
// Closed set of modules.
@@ -88,7 +89,7 @@
}
auto status = iree_vm_context_create_with_modules(
instance->raw_ptr(), module_handles.data(), module_handles.size(),
- IREE_ALLOCATOR_SYSTEM, &context);
+ iree_allocator_system(), &context);
CheckApiStatus(status, "Error creating vm context with modules");
}
@@ -140,7 +141,7 @@
void VmContext::Invoke(iree_vm_function_t f, VmVariantList& inputs,
VmVariantList& outputs) {
CheckApiStatus(iree_vm_invoke(raw_ptr(), f, nullptr, inputs.raw_ptr(),
- outputs.raw_ptr(), IREE_ALLOCATOR_SYSTEM),
+ outputs.raw_ptr(), iree_allocator_system()),
"Error invoking function");
}
@@ -165,7 +166,7 @@
auto status = iree_vm_bytecode_module_create(
{static_cast<const uint8_t*>(buffer_info.ptr),
static_cast<iree_host_size_t>(buffer_info.size)},
- deallocator, IREE_ALLOCATOR_SYSTEM, &module);
+ deallocator, iree_allocator_system(), &module);
if (!iree_status_is_ok(status)) {
deallocator.free(raw_ptr, nullptr);
}
diff --git a/bindings/python/pyiree/rt/vm.h b/bindings/python/pyiree/rt/vm.h
index 1e7f984..e65560c 100644
--- a/bindings/python/pyiree/rt/vm.h
+++ b/bindings/python/pyiree/rt/vm.h
@@ -82,7 +82,7 @@
static VmVariantList Create(iree_host_size_t capacity) {
iree_vm_list_t* list;
CheckApiStatus(iree_vm_list_create(/*element_type=*/nullptr, capacity,
- IREE_ALLOCATOR_SYSTEM, &list),
+ iree_allocator_system(), &list),
"Error allocating variant list");
return VmVariantList(list);
}