Skip to content

Commit

Permalink
Changing iree_hal_allocator_pool_id_t to iree_hal_allocator_pool_t.
Browse files Browse the repository at this point in the history
I originally intended this to be a bitfield but forgot when plumbing.
  • Loading branch information
benvanik committed Aug 19, 2022
1 parent 4c84f4a commit 65a9beb
Show file tree
Hide file tree
Showing 9 changed files with 19 additions and 13 deletions.
2 changes: 1 addition & 1 deletion experimental/rocm/rocm_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion runtime/src/iree/hal/allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
//
Expand Down
6 changes: 3 additions & 3 deletions runtime/src/iree/hal/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/iree/hal/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/iree/hal/drivers/cuda/cuda_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/iree/hal/drivers/local_sync/sync_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/iree/hal/drivers/local_task/task_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/iree/hal/drivers/vulkan/vulkan_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions runtime/src/iree/modules/hal/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 65a9beb

Please sign in to comment.