diff --git a/experimental/rocm/rocm_device.c b/experimental/rocm/rocm_device.c index a79438359a2a..e0074f131cf4 100644 --- a/experimental/rocm/rocm_device.c +++ b/experimental/rocm/rocm_device.c @@ -258,7 +258,7 @@ static iree_status_t iree_hal_rocm_device_queue_alloca( iree_hal_device_t* base_device, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, - iree_hal_allocator_pool_id_t pool_id, iree_hal_buffer_params_t params, + iree_hal_allocator_pool_t pool, iree_hal_buffer_params_t params, iree_device_size_t allocation_size, iree_hal_buffer_t** IREE_RESTRICT out_buffer) { // TODO: queue-ordered allocations. diff --git a/runtime/src/iree/hal/allocator.h b/runtime/src/iree/hal/allocator.h index c8883e2736fb..4c58fc10f0bc 100644 --- a/runtime/src/iree/hal/allocator.h +++ b/runtime/src/iree/hal/allocator.h @@ -39,7 +39,13 @@ typedef uint64_t iree_hal_queue_affinity_t; #define IREE_HAL_QUEUE_AFFINITY_ANY ((iree_hal_queue_affinity_t)(-1)) // TBD: placeholder for reserving unique pools. -typedef uint32_t iree_hal_allocator_pool_id_t; +// The intent is that semantically meaningful pools can be defined like +// "transient" "variable" "constant" "external" (matching what we use in the +// compiler) such that allocators don't need to infer based on usage flags. +enum iree_hal_allocator_pool_bits_t { + IREE_HAL_ALLOCATOR_POOL_DEFAULT = 0u, +}; +typedef uint32_t iree_hal_allocator_pool_t; // Parameters defining how a buffer should be allocated. // diff --git a/runtime/src/iree/hal/device.c b/runtime/src/iree/hal/device.c index 1aa24cbbe07a..27330102a2a4 100644 --- a/runtime/src/iree/hal/device.c +++ b/runtime/src/iree/hal/device.c @@ -156,7 +156,7 @@ IREE_API_EXPORT iree_status_t iree_hal_device_queue_alloca( iree_hal_device_t* device, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, - iree_hal_allocator_pool_id_t pool_id, iree_hal_buffer_params_t params, + iree_hal_allocator_pool_t pool, iree_hal_buffer_params_t params, iree_device_size_t allocation_size, iree_hal_buffer_t** IREE_RESTRICT out_buffer) { IREE_ASSERT_ARGUMENT(device); @@ -170,8 +170,8 @@ IREE_API_EXPORT iree_status_t iree_hal_device_queue_alloca( *out_buffer = NULL; IREE_TRACE_ZONE_BEGIN(z0); iree_status_t status = _VTABLE_DISPATCH(device, queue_alloca)( - device, queue_affinity, wait_semaphore_list, signal_semaphore_list, - pool_id, params, allocation_size, out_buffer); + device, queue_affinity, wait_semaphore_list, signal_semaphore_list, pool, + params, allocation_size, out_buffer); IREE_TRACE_ZONE_END(z0); return status; } diff --git a/runtime/src/iree/hal/device.h b/runtime/src/iree/hal/device.h index b9ff9304f30e..6c2d581d5ca0 100644 --- a/runtime/src/iree/hal/device.h +++ b/runtime/src/iree/hal/device.h @@ -308,7 +308,7 @@ IREE_API_EXPORT iree_status_t iree_hal_device_queue_alloca( iree_hal_device_t* device, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, - iree_hal_allocator_pool_id_t pool_id, iree_hal_buffer_params_t params, + iree_hal_allocator_pool_t pool, iree_hal_buffer_params_t params, iree_device_size_t allocation_size, iree_hal_buffer_t** IREE_RESTRICT out_buffer); @@ -453,7 +453,7 @@ typedef struct iree_hal_device_vtable_t { iree_hal_device_t* device, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, - iree_hal_allocator_pool_id_t pool_id, iree_hal_buffer_params_t params, + iree_hal_allocator_pool_t pool, iree_hal_buffer_params_t params, iree_device_size_t allocation_size, iree_hal_buffer_t** IREE_RESTRICT out_buffer); diff --git a/runtime/src/iree/hal/drivers/cuda/cuda_device.c b/runtime/src/iree/hal/drivers/cuda/cuda_device.c index 68c0ed635dea..4ffd897cc8b5 100644 --- a/runtime/src/iree/hal/drivers/cuda/cuda_device.c +++ b/runtime/src/iree/hal/drivers/cuda/cuda_device.c @@ -333,7 +333,7 @@ static iree_status_t iree_hal_cuda_device_queue_alloca( iree_hal_device_t* base_device, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, - iree_hal_allocator_pool_id_t pool_id, iree_hal_buffer_params_t params, + iree_hal_allocator_pool_t pool, iree_hal_buffer_params_t params, iree_device_size_t allocation_size, iree_hal_buffer_t** IREE_RESTRICT out_buffer) { // TODO(benvanik): queue-ordered allocations. diff --git a/runtime/src/iree/hal/drivers/local_sync/sync_device.c b/runtime/src/iree/hal/drivers/local_sync/sync_device.c index d5cc8c4121c2..1a222fd6084b 100644 --- a/runtime/src/iree/hal/drivers/local_sync/sync_device.c +++ b/runtime/src/iree/hal/drivers/local_sync/sync_device.c @@ -273,7 +273,7 @@ static iree_status_t iree_hal_sync_device_queue_alloca( iree_hal_device_t* base_device, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, - iree_hal_allocator_pool_id_t pool_id, iree_hal_buffer_params_t params, + iree_hal_allocator_pool_t pool, iree_hal_buffer_params_t params, iree_device_size_t allocation_size, iree_hal_buffer_t** IREE_RESTRICT out_buffer) { // TODO(benvanik): queue-ordered allocations. diff --git a/runtime/src/iree/hal/drivers/local_task/task_device.c b/runtime/src/iree/hal/drivers/local_task/task_device.c index 5e9d94eadda9..c30645770cb4 100644 --- a/runtime/src/iree/hal/drivers/local_task/task_device.c +++ b/runtime/src/iree/hal/drivers/local_task/task_device.c @@ -323,7 +323,7 @@ static iree_status_t iree_hal_task_device_queue_alloca( iree_hal_device_t* base_device, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, - iree_hal_allocator_pool_id_t pool_id, iree_hal_buffer_params_t params, + iree_hal_allocator_pool_t pool, iree_hal_buffer_params_t params, iree_device_size_t allocation_size, iree_hal_buffer_t** IREE_RESTRICT out_buffer) { // TODO(benvanik): queue-ordered allocations. diff --git a/runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc b/runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc index e614a42ee3b0..118ebac1533a 100644 --- a/runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc +++ b/runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc @@ -1080,7 +1080,7 @@ static iree_status_t iree_hal_vulkan_device_queue_alloca( iree_hal_device_t* base_device, iree_hal_queue_affinity_t queue_affinity, const iree_hal_semaphore_list_t wait_semaphore_list, const iree_hal_semaphore_list_t signal_semaphore_list, - iree_hal_allocator_pool_id_t pool_id, iree_hal_buffer_params_t params, + iree_hal_allocator_pool_t pool, iree_hal_buffer_params_t params, iree_device_size_t allocation_size, iree_hal_buffer_t** IREE_RESTRICT out_buffer) { // TODO(benvanik): queue-ordered allocations. diff --git a/runtime/src/iree/modules/hal/module.c b/runtime/src/iree/modules/hal/module.c index 395d0566d611..8871249be761 100644 --- a/runtime/src/iree/modules/hal/module.c +++ b/runtime/src/iree/modules/hal/module.c @@ -854,7 +854,7 @@ IREE_VM_ABI_EXPORT(iree_hal_module_device_queue_alloca, // (iree_hal_queue_affinity_t)args->i1; iree_hal_fence_t* wait_fence = iree_hal_fence_deref(args->r2); iree_hal_fence_t* signal_fence = iree_hal_fence_deref(args->r3); - iree_hal_allocator_pool_id_t pool_id = (iree_hal_allocator_pool_id_t)args->i4; + iree_hal_allocator_pool_t pool = (iree_hal_allocator_pool_t)args->i4; iree_hal_memory_type_t memory_types = (iree_hal_memory_type_t)args->i5; iree_hal_buffer_usage_t buffer_usage = (iree_hal_buffer_usage_t)args->i6; iree_device_size_t allocation_size = iree_hal_cast_device_size(args->i7); @@ -866,7 +866,7 @@ IREE_VM_ABI_EXPORT(iree_hal_module_device_queue_alloca, // iree_hal_buffer_t* buffer = NULL; IREE_RETURN_IF_ERROR(iree_hal_device_queue_alloca( device, queue_affinity, iree_hal_fence_semaphore_list(wait_fence), - iree_hal_fence_semaphore_list(signal_fence), pool_id, params, + iree_hal_fence_semaphore_list(signal_fence), pool, params, allocation_size, &buffer)); rets->r0 = iree_hal_buffer_move_ref(buffer);