Supporting (and renaming) IREE_HAL_WHOLE_BUFFER in binding table resolve. (#19640)

diff --git a/runtime/bindings/tflite/tensor.c b/runtime/bindings/tflite/tensor.c
index b943093..cd0b130 100644
--- a/runtime/bindings/tflite/tensor.c
+++ b/runtime/bindings/tflite/tensor.c
@@ -152,10 +152,10 @@
   // on-demand mapping when the user calls TfLiteTensorData but this at least
   // puts potential errors in the same easy to find place.
   IREE_RETURN_AND_END_ZONE_IF_ERROR(
-      z0,
-      iree_hal_buffer_map_range(tensor->buffer, IREE_HAL_MAPPING_MODE_SCOPED,
-                                IREE_HAL_MEMORY_ACCESS_ALL, 0,
-                                IREE_WHOLE_BUFFER, &tensor->buffer_mapping));
+      z0, iree_hal_buffer_map_range(
+              tensor->buffer, IREE_HAL_MAPPING_MODE_SCOPED,
+              IREE_HAL_MEMORY_ACCESS_ALL, 0, IREE_HAL_WHOLE_BUFFER,
+              &tensor->buffer_mapping));
 
   IREE_TRACE_ZONE_END(z0);
   return iree_ok_status();
@@ -176,7 +176,7 @@
   // move this to an on-demand mapping when the user calls TfLiteTensorData but
   // this at least puts potential errors in the same easy to find place.
   iree_device_size_t byte_offset = 0;
-  iree_device_size_t byte_length = IREE_WHOLE_BUFFER;
+  iree_device_size_t byte_length = IREE_HAL_WHOLE_BUFFER;
   IREE_RETURN_AND_END_ZONE_IF_ERROR(
       z0, iree_hal_buffer_map_range(
               buffer, IREE_HAL_MAPPING_MODE_SCOPED,
diff --git a/runtime/src/iree/hal/allocator_heap.c b/runtime/src/iree/hal/allocator_heap.c
index e7ed9bb..11b42fa 100644
--- a/runtime/src/iree/hal/allocator_heap.c
+++ b/runtime/src/iree/hal/allocator_heap.c
@@ -277,9 +277,10 @@
 
   // Map the entire buffer persistently, if possible.
   iree_hal_buffer_mapping_t mapping;
-  IREE_RETURN_IF_ERROR(iree_hal_buffer_map_range(
-      buffer, IREE_HAL_MAPPING_MODE_PERSISTENT,
-      iree_hal_buffer_allowed_access(buffer), 0, IREE_WHOLE_BUFFER, &mapping));
+  IREE_RETURN_IF_ERROR(
+      iree_hal_buffer_map_range(buffer, IREE_HAL_MAPPING_MODE_PERSISTENT,
+                                iree_hal_buffer_allowed_access(buffer), 0,
+                                IREE_HAL_WHOLE_BUFFER, &mapping));
 
   // Note that the returned pointer is unowned.
   out_external_buffer->type = requested_type;
diff --git a/runtime/src/iree/hal/buffer.c b/runtime/src/iree/hal/buffer.c
index a55f248..b85bff3 100644
--- a/runtime/src/iree/hal/buffer.c
+++ b/runtime/src/iree/hal/buffer.c
@@ -401,19 +401,20 @@
         offset, length, max_length);
   }
 
-  // Handle length as IREE_WHOLE_BUFFER by adjusting it (if allowed).
-  if (IREE_UNLIKELY(length == IREE_WHOLE_BUFFER) &&
+  // Handle length as IREE_HAL_WHOLE_BUFFER by adjusting it (if allowed).
+  if (IREE_UNLIKELY(length == IREE_HAL_WHOLE_BUFFER) &&
       IREE_UNLIKELY(!out_adjusted_length)) {
     *out_adjusted_offset = 0;
-    return iree_make_status(IREE_STATUS_INVALID_ARGUMENT,
-                            "IREE_WHOLE_BUFFER may only be used with buffer "
-                            "ranges, not external pointer ranges");
+    return iree_make_status(
+        IREE_STATUS_INVALID_ARGUMENT,
+        "IREE_HAL_WHOLE_BUFFER may only be used with buffer "
+        "ranges, not external pointer ranges");
   }
 
   // Calculate the real ranges adjusted for our region within the allocation.
   iree_device_size_t adjusted_offset = base_offset + offset;
   iree_device_size_t adjusted_length =
-      length == IREE_WHOLE_BUFFER ? max_length - offset : length;
+      length == IREE_HAL_WHOLE_BUFFER ? max_length - offset : length;
   if (adjusted_length == 0) {
     // Fine to have a zero length.
     *out_adjusted_offset = adjusted_offset;
@@ -454,11 +455,11 @@
   iree_device_size_t rhs_alloc_offset =
       iree_hal_buffer_byte_offset(rhs_buffer) + rhs_offset;
   iree_device_size_t lhs_alloc_length =
-      lhs_length == IREE_WHOLE_BUFFER
+      lhs_length == IREE_HAL_WHOLE_BUFFER
           ? iree_hal_buffer_byte_length(lhs_buffer) - lhs_offset
           : lhs_length;
   iree_device_size_t rhs_alloc_length =
-      rhs_length == IREE_WHOLE_BUFFER
+      rhs_length == IREE_HAL_WHOLE_BUFFER
           ? iree_hal_buffer_byte_length(rhs_buffer) - rhs_offset
           : rhs_length;
   if (!lhs_alloc_length || !rhs_alloc_length) {
@@ -483,7 +484,7 @@
   *out_buffer = NULL;
 
   // Fast path: if we are requesting the whole buffer (usually via
-  // IREE_WHOLE_BUFFER) then we can just return the buffer itself.
+  // IREE_HAL_WHOLE_BUFFER) then we can just return the buffer itself.
   IREE_RETURN_IF_ERROR(iree_hal_buffer_calculate_range(
       iree_hal_buffer_byte_offset(buffer), iree_hal_buffer_byte_length(buffer),
       byte_offset, byte_length, &byte_offset, &byte_length));
@@ -597,7 +598,7 @@
       z0, iree_hal_buffer_map_range(buffer, IREE_HAL_MAPPING_MODE_SCOPED,
                                     IREE_HAL_MEMORY_ACCESS_DISCARD_WRITE,
                                     byte_offset, byte_length, &target_mapping));
-  if (byte_length == IREE_WHOLE_BUFFER) {
+  if (byte_length == IREE_HAL_WHOLE_BUFFER) {
     byte_length = target_mapping.contents.data_length;
   }
 
@@ -656,7 +657,7 @@
       !iree_all_bits_set(iree_hal_buffer_memory_type(buffer),
                          IREE_HAL_MEMORY_TYPE_HOST_COHERENT)) {
     status = iree_hal_buffer_mapping_flush_range(&target_mapping, 0,
-                                                 IREE_WHOLE_BUFFER);
+                                                 IREE_HAL_WHOLE_BUFFER);
   }
 
   status =
@@ -713,7 +714,7 @@
   if (!iree_all_bits_set(iree_hal_buffer_memory_type(target_buffer),
                          IREE_HAL_MEMORY_TYPE_HOST_COHERENT)) {
     status = iree_hal_buffer_mapping_flush_range(&target_mapping, 0,
-                                                 IREE_WHOLE_BUFFER);
+                                                 IREE_HAL_WHOLE_BUFFER);
   }
 
   iree_hal_buffer_unmap_range(&target_mapping);
@@ -744,14 +745,14 @@
   IREE_TRACE_ZONE_BEGIN(z0);
   IREE_TRACE_ZONE_APPEND_VALUE_I64(z0, data_length);
 
-  // Map source, which may have IREE_WHOLE_BUFFER length.
+  // Map source, which may have IREE_HAL_WHOLE_BUFFER length.
   iree_hal_buffer_mapping_t source_mapping;
   IREE_RETURN_AND_END_ZONE_IF_ERROR(
       z0, iree_hal_buffer_map_range(source_buffer, IREE_HAL_MAPPING_MODE_SCOPED,
                                     IREE_HAL_MEMORY_ACCESS_READ, source_offset,
                                     data_length, &source_mapping));
 
-  // Map target, which may also have IREE_WHOLE_BUFFER length.
+  // Map target, which may also have IREE_HAL_WHOLE_BUFFER length.
   iree_hal_buffer_mapping_t target_mapping;
   iree_status_t status =
       iree_hal_buffer_map_range(target_buffer, IREE_HAL_MAPPING_MODE_SCOPED,
@@ -765,7 +766,7 @@
 
   // Adjust the data length based on the min we have.
   iree_device_size_t adjusted_data_length = 0;
-  if (data_length == IREE_WHOLE_BUFFER) {
+  if (data_length == IREE_HAL_WHOLE_BUFFER) {
     // Whole buffer copy requested - that could mean either, so take the min.
     adjusted_data_length = iree_min(source_mapping.contents.data_length,
                                     target_mapping.contents.data_length);
@@ -777,7 +778,7 @@
   }
 
   // Elide zero length copies. It's been expensive to get to this point just to
-  // bail but we need to have mapped to resolve IREE_WHOLE_BUFFERs that may
+  // bail but we need to have mapped to resolve IREE_HAL_WHOLE_BUFFERs that may
   // result in zero lengths.
   if (IREE_UNLIKELY(adjusted_data_length == 0)) {
     IREE_TRACE_ZONE_END(z0);
diff --git a/runtime/src/iree/hal/buffer.h b/runtime/src/iree/hal/buffer.h
index 502a68b..400babd 100644
--- a/runtime/src/iree/hal/buffer.h
+++ b/runtime/src/iree/hal/buffer.h
@@ -26,7 +26,7 @@
 //===----------------------------------------------------------------------===//
 
 // Whole length of the underlying buffer.
-#define IREE_WHOLE_BUFFER ((iree_device_size_t)(-1))
+#define IREE_HAL_WHOLE_BUFFER ((iree_device_size_t)(-1))
 
 // A bitfield specifying properties for a memory type.
 enum iree_hal_memory_type_bits_t {
@@ -740,16 +740,16 @@
     iree_device_size_t* out_adjusted_length);
 
 // Tests whether the given buffers overlap, including support for subspans.
-// IREE_WHOLE_BUFFER may be used for |lhs_length| and/or |rhs_length| to use the
-// lengths of those buffers, respectively.
+// IREE_HAL_WHOLE_BUFFER may be used for |lhs_length| and/or |rhs_length| to use
+// the lengths of those buffers, respectively.
 IREE_API_EXPORT iree_hal_buffer_overlap_t iree_hal_buffer_test_overlap(
     iree_hal_buffer_t* lhs_buffer, iree_device_size_t lhs_offset,
     iree_device_size_t lhs_length, iree_hal_buffer_t* rhs_buffer,
     iree_device_size_t rhs_offset, iree_device_size_t rhs_length);
 
 // Returns a reference to a subspan of the |buffer|.
-// If |byte_length| is IREE_WHOLE_BUFFER the remaining bytes in the buffer after
-// |byte_offset| (possibly 0) will be selected.
+// If |byte_length| is IREE_HAL_WHOLE_BUFFER the remaining bytes in the buffer
+// after |byte_offset| (possibly 0) will be selected.
 //
 // The parent buffer will remain alive for the lifetime of the subspan
 // returned. If the subspan is a small portion this may cause additional
@@ -975,7 +975,7 @@
 
 // Calculates and returns a byte subspan range within a buffer mapping.
 // The byte range provided is local to the mapping. May return a 0-length span.
-// IREE_WHOLE_BUFFER can be used for |byte_length|.
+// IREE_HAL_WHOLE_BUFFER can be used for |byte_length|.
 //
 // Note that the access requirements of the mapping still hold: if the memory is
 // not host coherent and writeable then the caller must use the
diff --git a/runtime/src/iree/hal/buffer_transfer.c b/runtime/src/iree/hal/buffer_transfer.c
index d4f30bb..f8da84a 100644
--- a/runtime/src/iree/hal/buffer_transfer.c
+++ b/runtime/src/iree/hal/buffer_transfer.c
@@ -140,7 +140,7 @@
   iree_device_size_t adjusted_data_length = 0;
   if (iree_status_is_ok(status)) {
     // Adjust the data length based on the min we have.
-    if (data_length == IREE_WHOLE_BUFFER) {
+    if (data_length == IREE_HAL_WHOLE_BUFFER) {
       // Whole buffer copy requested - that could mean either, so take the min.
       adjusted_data_length = iree_min(source_mapping.contents.data_length,
                                       target_mapping.contents.data_length);
diff --git a/runtime/src/iree/hal/buffer_view_util.c b/runtime/src/iree/hal/buffer_view_util.c
index c7cfafc..1ba4818 100644
--- a/runtime/src/iree/hal/buffer_view_util.c
+++ b/runtime/src/iree/hal/buffer_view_util.c
@@ -234,7 +234,7 @@
   iree_hal_buffer_mapping_t buffer_mapping = {{0}};
   iree_status_t status = iree_hal_buffer_map_range(
       iree_hal_buffer_view_buffer(buffer_view), IREE_HAL_MAPPING_MODE_SCOPED,
-      IREE_HAL_MEMORY_ACCESS_DISCARD_WRITE, 0, IREE_WHOLE_BUFFER,
+      IREE_HAL_MEMORY_ACCESS_DISCARD_WRITE, 0, IREE_HAL_WHOLE_BUFFER,
       &buffer_mapping);
 
   // Generate using the callback directly into the buffer.
@@ -516,7 +516,7 @@
   iree_hal_buffer_mapping_t buffer_mapping = {{0}};
   IREE_RETURN_IF_ERROR(iree_hal_buffer_map_range(
       iree_hal_buffer_view_buffer(buffer_view), IREE_HAL_MAPPING_MODE_SCOPED,
-      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_WHOLE_BUFFER, &buffer_mapping));
+      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_HAL_WHOLE_BUFFER, &buffer_mapping));
   iree_host_size_t elements_length = 0;
   status = iree_hal_format_buffer_elements(
       iree_make_const_byte_span(buffer_mapping.contents.data,
diff --git a/runtime/src/iree/hal/command_buffer.h b/runtime/src/iree/hal/command_buffer.h
index 82fdd61..47dd0b9 100644
--- a/runtime/src/iree/hal/command_buffer.h
+++ b/runtime/src/iree/hal/command_buffer.h
@@ -106,7 +106,7 @@
   // the base offset of the bound buffer.
   iree_device_size_t offset;
   // Length, in bytes, of the buffer after the offset that is accessed.
-  // This can be IREE_WHOLE_BUFFER, however note that if the entire buffer
+  // This can be IREE_HAL_WHOLE_BUFFER, however note that if the entire buffer
   // contents are larger than supported by the device (~128MiB, usually) this
   // will fail.
   iree_device_size_t length;
@@ -495,7 +495,7 @@
   // This will be added to the offset specified on each usage of the slot.
   iree_device_size_t offset;
   // Length, in bytes, of the buffer that is available to the executable.
-  // This can be IREE_WHOLE_BUFFER, however note that if the entire buffer
+  // This can be IREE_HAL_WHOLE_BUFFER, however note that if the entire buffer
   // contents are larger than supported by the device (~128MiB, usually) this
   // will fail. If the descriptor type is dynamic this will be used for all
   // ranges regardless of offset.
@@ -550,8 +550,12 @@
     out_resolved_ref->reserved = buffer_ref.reserved;
     out_resolved_ref->buffer_slot = 0;
     out_resolved_ref->buffer = binding->buffer;
+    const iree_device_size_t max_length =
+        binding->length != IREE_HAL_WHOLE_BUFFER
+            ? binding->length
+            : iree_hal_buffer_byte_length(binding->buffer) - binding->offset;
     return iree_hal_buffer_calculate_range(
-        binding->offset, binding->length, buffer_ref.offset, buffer_ref.length,
+        binding->offset, max_length, buffer_ref.offset, buffer_ref.length,
         &out_resolved_ref->offset, &out_resolved_ref->length);
   }
 }
diff --git a/runtime/src/iree/hal/cts/buffer_mapping_test.h b/runtime/src/iree/hal/cts/buffer_mapping_test.h
index b78c8a8..3e63972 100644
--- a/runtime/src/iree/hal/cts/buffer_mapping_test.h
+++ b/runtime/src/iree/hal/cts/buffer_mapping_test.h
@@ -86,8 +86,8 @@
   AllocateUninitializedBuffer(kDefaultAllocationSize, &buffer);
 
   // Zero the entire buffer.
-  IREE_ASSERT_OK(
-      iree_hal_buffer_map_zero(buffer, /*byte_offset=*/0, IREE_WHOLE_BUFFER));
+  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, /*byte_offset=*/0,
+                                          IREE_HAL_WHOLE_BUFFER));
 
   // Check that the contents match what we expect.
   std::vector<uint8_t> actual_data(kDefaultAllocationSize);
@@ -108,7 +108,7 @@
   // Fill the entire buffer then zero only a segment of it.
   uint8_t fill_value = 0xFF;
   IREE_ASSERT_OK(iree_hal_buffer_map_fill(buffer, /*byte_offset=*/0,
-                                          IREE_WHOLE_BUFFER, &fill_value,
+                                          IREE_HAL_WHOLE_BUFFER, &fill_value,
                                           sizeof(fill_value)));
   IREE_ASSERT_OK(
       iree_hal_buffer_map_zero(buffer, /*byte_offset=*/4, /*byte_length=*/8));
@@ -134,7 +134,7 @@
   // Fill the entire buffer.
   uint8_t fill_value = 0xFF;
   IREE_ASSERT_OK(iree_hal_buffer_map_fill(buffer, /*byte_offset=*/0,
-                                          IREE_WHOLE_BUFFER, &fill_value,
+                                          IREE_HAL_WHOLE_BUFFER, &fill_value,
                                           sizeof(fill_value)));
 
   // Create a subspan.
@@ -175,7 +175,7 @@
   AllocateUninitializedBuffer(kDefaultAllocationSize, &buffer);
 
   // Zero the whole buffer then "fill" 0 bytes with a different pattern.
-  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_WHOLE_BUFFER));
+  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_HAL_WHOLE_BUFFER));
   uint8_t fill_value = 0xFF;
   IREE_ASSERT_OK(
       iree_hal_buffer_map_fill(buffer, /*byte_offset=*/0,
@@ -201,7 +201,7 @@
   uint8_t fill_value = 0xFF;
   IREE_ASSERT_OK(
       iree_hal_buffer_map_fill(buffer, /*byte_offset=*/0,
-                               /*byte_length=*/IREE_WHOLE_BUFFER,
+                               /*byte_length=*/IREE_HAL_WHOLE_BUFFER,
                                /*pattern=*/&fill_value,
                                /*pattern_length=*/sizeof(fill_value)));
 
@@ -222,7 +222,7 @@
   AllocateUninitializedBuffer(buffer_size, &buffer);
 
   // Zero the entire buffer then fill only a segment of it.
-  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_WHOLE_BUFFER));
+  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_HAL_WHOLE_BUFFER));
   uint8_t fill_value = 0xFF;
   IREE_ASSERT_OK(
       iree_hal_buffer_map_fill(buffer, /*byte_offset=*/4,
@@ -249,7 +249,7 @@
   AllocateUninitializedBuffer(buffer_size, &buffer);
 
   // Zero the entire buffer.
-  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_WHOLE_BUFFER));
+  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_HAL_WHOLE_BUFFER));
 
   // Create a subspan.
   iree_device_size_t subspan_length = 8;
@@ -397,7 +397,7 @@
   AllocateUninitializedBuffer(buffer_size, &buffer);
 
   // Zero the entire buffer.
-  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_WHOLE_BUFFER));
+  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_HAL_WHOLE_BUFFER));
 
   // Write over part of the buffer.
   std::vector<uint8_t> fill_buffer{0x11, 0x22, 0x33, 0x44,  //
@@ -424,7 +424,7 @@
   AllocateUninitializedBuffer(buffer_size, &buffer);
 
   // Zero the entire buffer.
-  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_WHOLE_BUFFER));
+  IREE_ASSERT_OK(iree_hal_buffer_map_zero(buffer, 0, IREE_HAL_WHOLE_BUFFER));
 
   // Create a subspan.
   iree_device_size_t subspan_length = 8;
@@ -499,7 +499,7 @@
 
   uint8_t fill_value = 0xEF;
   IREE_ASSERT_OK(iree_hal_buffer_map_fill(buffer, /*byte_offset=*/0,
-                                          IREE_WHOLE_BUFFER, &fill_value,
+                                          IREE_HAL_WHOLE_BUFFER, &fill_value,
                                           sizeof(fill_value)));
 
   iree_hal_buffer_mapping_t mapping;
diff --git a/runtime/src/iree/hal/cts/command_buffer_copy_buffer_test.h b/runtime/src/iree/hal/cts/command_buffer_copy_buffer_test.h
index 2cb1fef..222ff97 100644
--- a/runtime/src/iree/hal/cts/command_buffer_copy_buffer_test.h
+++ b/runtime/src/iree/hal/cts/command_buffer_copy_buffer_test.h
@@ -249,8 +249,8 @@
   IREE_ASSERT_OK(iree_hal_command_buffer_end(command_buffer));
 
   const iree_hal_buffer_binding_t bindings[] = {
-      /*kHostBufferSlot=*/{host_buffer, 0, IREE_WHOLE_BUFFER},
-      /*kDeviceBufferSlot=*/{device_buffer, 0, IREE_WHOLE_BUFFER},
+      /*kHostBufferSlot=*/{host_buffer, 0, IREE_HAL_WHOLE_BUFFER},
+      /*kDeviceBufferSlot=*/{device_buffer, 0, IREE_HAL_WHOLE_BUFFER},
   };
   IREE_ASSERT_OK(SubmitCommandBufferAndWait(command_buffer,
                                             iree_hal_buffer_binding_table_t{
diff --git a/runtime/src/iree/hal/cts/cts_test_base.h b/runtime/src/iree/hal/cts/cts_test_base.h
index c388e37..027e508 100644
--- a/runtime/src/iree/hal/cts/cts_test_base.h
+++ b/runtime/src/iree/hal/cts/cts_test_base.h
@@ -190,7 +190,7 @@
         iree_hal_device_allocator(device_), params, buffer_size,
         &device_buffer));
     IREE_ASSERT_OK(
-        iree_hal_buffer_map_zero(device_buffer, 0, IREE_WHOLE_BUFFER));
+        iree_hal_buffer_map_zero(device_buffer, 0, IREE_HAL_WHOLE_BUFFER));
     *out_buffer = device_buffer;
   }
 
@@ -208,8 +208,8 @@
     IREE_ASSERT_OK(iree_hal_allocator_allocate_buffer(
         iree_hal_device_allocator(device_), params, buffer_size,
         &device_buffer));
-    IREE_ASSERT_OK(iree_hal_buffer_map_fill(device_buffer, 0, IREE_WHOLE_BUFFER,
-                                            &pattern, sizeof(pattern)));
+    IREE_ASSERT_OK(iree_hal_buffer_map_fill(
+        device_buffer, 0, IREE_HAL_WHOLE_BUFFER, &pattern, sizeof(pattern)));
     *out_buffer = device_buffer;
   }
 
diff --git a/runtime/src/iree/hal/drivers/vulkan/builtin_executables.cc b/runtime/src/iree/hal/drivers/vulkan/builtin_executables.cc
index 72b2694..26a33e3 100644
--- a/runtime/src/iree/hal/drivers/vulkan/builtin_executables.cc
+++ b/runtime/src/iree/hal/drivers/vulkan/builtin_executables.cc
@@ -169,7 +169,7 @@
   binding.reserved = 0;
   binding.buffer = target_buffer;
   binding.offset = 0;
-  binding.length = IREE_WHOLE_BUFFER;
+  binding.length = IREE_HAL_WHOLE_BUFFER;
   IREE_RETURN_IF_ERROR(descriptor_set_arena->BindDescriptorSet(
       command_buffer, pipeline_layout_, IREE_HAL_VULKAN_BUILTIN_DESCRIPTOR_SET,
       /*binding_count=*/1, &binding));
diff --git a/runtime/src/iree/hal/drivers/vulkan/descriptor_set_arena.cc b/runtime/src/iree/hal/drivers/vulkan/descriptor_set_arena.cc
index 7f988ac..5ca0f62 100644
--- a/runtime/src/iree/hal/drivers/vulkan/descriptor_set_arena.cc
+++ b/runtime/src/iree/hal/drivers/vulkan/descriptor_set_arena.cc
@@ -40,7 +40,7 @@
                              : VK_NULL_HANDLE;
     buffer_info.offset =
         iree_hal_buffer_byte_offset(binding.buffer) + binding.offset;
-    if (binding.length == IREE_WHOLE_BUFFER) {
+    if (binding.length == IREE_HAL_WHOLE_BUFFER) {
       buffer_info.range = VK_WHOLE_SIZE;
     } else {
       // Round up to a multiple of 32-bit. 32-bit is the defacto native bitwidth
diff --git a/runtime/src/iree/hal/utils/debug_allocator.c b/runtime/src/iree/hal/utils/debug_allocator.c
index 6389d8b..0334acf 100644
--- a/runtime/src/iree/hal/utils/debug_allocator.c
+++ b/runtime/src/iree/hal/utils/debug_allocator.c
@@ -127,7 +127,7 @@
     iree_hal_buffer_t* buffer, uint8_t fill_pattern) {
   IREE_TRACE_ZONE_BEGIN(z0);
   iree_status_t status = iree_hal_buffer_map_fill(
-      buffer, 0, IREE_WHOLE_BUFFER, &fill_pattern, sizeof(fill_pattern));
+      buffer, 0, IREE_HAL_WHOLE_BUFFER, &fill_pattern, sizeof(fill_pattern));
   IREE_TRACE_ZONE_END(z0);
   return status;
 }
diff --git a/runtime/src/iree/modules/hal/inline/module.c b/runtime/src/iree/modules/hal/inline/module.c
index a892453..862f937 100644
--- a/runtime/src/iree/modules/hal/inline/module.c
+++ b/runtime/src/iree/modules/hal/inline/module.c
@@ -93,7 +93,7 @@
   // requires mapping.
   iree_status_t status = iree_hal_buffer_map_range(
       hal_buffer, IREE_HAL_MAPPING_MODE_SCOPED, IREE_HAL_MEMORY_ACCESS_ANY, 0,
-      IREE_WHOLE_BUFFER, &storage->mapping);
+      IREE_HAL_WHOLE_BUFFER, &storage->mapping);
 
   // Initializes the VM buffer to reference the mapped memory.
   // Since the VM buffer is what we pass back to the VM and gets reference
diff --git a/runtime/src/iree/tooling/buffer_view_matchers.c b/runtime/src/iree/tooling/buffer_view_matchers.c
index 5c30424..b42e765 100644
--- a/runtime/src/iree/tooling/buffer_view_matchers.c
+++ b/runtime/src/iree/tooling/buffer_view_matchers.c
@@ -379,7 +379,7 @@
   iree_hal_buffer_mapping_t actual_mapping;
   IREE_RETURN_IF_ERROR(iree_hal_buffer_map_range(
       iree_hal_buffer_view_buffer(matchee), IREE_HAL_MAPPING_MODE_SCOPED,
-      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_WHOLE_BUFFER, &actual_mapping));
+      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_HAL_WHOLE_BUFFER, &actual_mapping));
   iree_const_byte_span_t actual_contents = iree_make_const_byte_span(
       actual_mapping.contents.data, actual_mapping.contents.data_length);
 
@@ -501,7 +501,7 @@
   iree_hal_buffer_mapping_t actual_mapping;
   IREE_RETURN_IF_ERROR(iree_hal_buffer_map_range(
       iree_hal_buffer_view_buffer(matchee), IREE_HAL_MAPPING_MODE_SCOPED,
-      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_WHOLE_BUFFER, &actual_mapping));
+      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_HAL_WHOLE_BUFFER, &actual_mapping));
   iree_const_byte_span_t actual_contents = iree_make_const_byte_span(
       actual_mapping.contents.data, actual_mapping.contents.data_length);
 
@@ -605,12 +605,12 @@
   iree_hal_buffer_mapping_t actual_mapping;
   IREE_RETURN_IF_ERROR(iree_hal_buffer_map_range(
       iree_hal_buffer_view_buffer(matchee), IREE_HAL_MAPPING_MODE_SCOPED,
-      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_WHOLE_BUFFER, &actual_mapping));
+      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_HAL_WHOLE_BUFFER, &actual_mapping));
   iree_hal_buffer_mapping_t expected_mapping;
   iree_status_t status = iree_hal_buffer_map_range(
       iree_hal_buffer_view_buffer(matcher->expected),
       IREE_HAL_MAPPING_MODE_SCOPED, IREE_HAL_MEMORY_ACCESS_READ, 0,
-      IREE_WHOLE_BUFFER, &expected_mapping);
+      IREE_HAL_WHOLE_BUFFER, &expected_mapping);
   if (!iree_status_is_ok(status)) {
     iree_hal_buffer_unmap_range(&actual_mapping);
     return status;
diff --git a/runtime/src/iree/tooling/function_io.c b/runtime/src/iree/tooling/function_io.c
index c38a4cf..a1eb9e6 100644
--- a/runtime/src/iree/tooling/function_io.c
+++ b/runtime/src/iree/tooling/function_io.c
@@ -1082,7 +1082,7 @@
   iree_hal_buffer_mapping_t mapping;
   iree_status_t status = iree_hal_buffer_map_range(
       iree_hal_buffer_view_buffer(buffer_view), IREE_HAL_MAPPING_MODE_SCOPED,
-      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_WHOLE_BUFFER, &mapping);
+      IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_HAL_WHOLE_BUFFER, &mapping);
 
   // Write to the file from the mapped memory.
   if (iree_status_is_ok(status)) {
diff --git a/runtime/src/iree/tooling/instrument_util.c b/runtime/src/iree/tooling/instrument_util.c
index d1ac51a..b055880 100644
--- a/runtime/src/iree/tooling/instrument_util.c
+++ b/runtime/src/iree/tooling/instrument_util.c
@@ -39,7 +39,7 @@
         z0, iree_hal_buffer_map_range(iree_hal_buffer_view_buffer(buffer_view),
                                       IREE_HAL_MAPPING_MODE_SCOPED,
                                       IREE_HAL_MEMORY_ACCESS_READ, 0,
-                                      IREE_WHOLE_BUFFER, &mapping));
+                                      IREE_HAL_WHOLE_BUFFER, &mapping));
     write_ok = fwrite(mapping.contents.data, 1, mapping.contents.data_length,
                       file) == mapping.contents.data_length;
     IREE_IGNORE_ERROR(iree_hal_buffer_unmap_range(&mapping));
diff --git a/samples/custom_module/async/module.cc b/samples/custom_module/async/module.cc
index aec261a..688aebd 100644
--- a/samples/custom_module/async/module.cc
+++ b/samples/custom_module/async/module.cc
@@ -48,14 +48,14 @@
   if (status.ok()) {
     status = iree_hal_buffer_map_range(
         source_buffer, IREE_HAL_MAPPING_MODE_SCOPED,
-        IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_WHOLE_BUFFER, &source_mapping);
+        IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_HAL_WHOLE_BUFFER, &source_mapping);
   }
   iree_hal_buffer_mapping_t target_mapping = {{0}};
   if (status.ok()) {
     status =
         iree_hal_buffer_map_range(target_buffer, IREE_HAL_MAPPING_MODE_SCOPED,
                                   IREE_HAL_MEMORY_ACCESS_DISCARD_WRITE, 0,
-                                  IREE_WHOLE_BUFFER, &target_mapping);
+                                  IREE_HAL_WHOLE_BUFFER, &target_mapping);
   }
 
   // Sad slow host work. Whenever possible it's worth it to move these into the
diff --git a/samples/custom_module/sync/module.cc b/samples/custom_module/sync/module.cc
index 14dc256..eb10ddf 100644
--- a/samples/custom_module/sync/module.cc
+++ b/samples/custom_module/sync/module.cc
@@ -48,14 +48,14 @@
   if (status.ok()) {
     status = iree_hal_buffer_map_range(
         source_buffer, IREE_HAL_MAPPING_MODE_SCOPED,
-        IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_WHOLE_BUFFER, &source_mapping);
+        IREE_HAL_MEMORY_ACCESS_READ, 0, IREE_HAL_WHOLE_BUFFER, &source_mapping);
   }
   iree_hal_buffer_mapping_t target_mapping = {{0}};
   if (status.ok()) {
     status =
         iree_hal_buffer_map_range(target_buffer, IREE_HAL_MAPPING_MODE_SCOPED,
                                   IREE_HAL_MEMORY_ACCESS_DISCARD_WRITE, 0,
-                                  IREE_WHOLE_BUFFER, &target_mapping);
+                                  IREE_HAL_WHOLE_BUFFER, &target_mapping);
   }
 
   // Sad slow host work. Whenever possible it's worth it to move these into the
diff --git a/tools/iree-benchmark-executable-main.c b/tools/iree-benchmark-executable-main.c
index d769959..946fd6e 100644
--- a/tools/iree-benchmark-executable-main.c
+++ b/tools/iree-benchmark-executable-main.c
@@ -368,7 +368,7 @@
           " is not",
           i);
     }
-    bindings[i] = iree_hal_make_buffer_ref(buffer, 0, IREE_WHOLE_BUFFER);
+    bindings[i] = iree_hal_make_buffer_ref(buffer, 0, IREE_HAL_WHOLE_BUFFER);
   }
 
   // Setup the specification used to perform the executable load.