Skip to content

Conversation

@swote-git
Copy link

Refactors iree_hal_hip_util_tree_lower_bound and iree_hal_hip_util_tree_upper_bound to use the standard O(log n) bound search algorithm.

This resolves two issues:

  1. Misbehavior: Ensures upper_bound adheres to the strict 'greater than' definition.
  2. Performance: Eliminates the previous O(n) post-traversal loop which relied on repeated, inefficient calls to iree_hal_hip_util_tree_node_next.

fixes : #22733

Refactors `iree_hal_hip_util_tree_lower_bound` and `iree_hal_hip_util_tree_upper_bound` to use the standard O(log n) bound search algorithm.

This resolves two issues:
1. **Misbehavior:** Ensures `upper_bound` adheres to the strict 'greater than' definition.
2. **Performance:** Eliminates the previous O(n) post-traversal loop which relied on repeated, inefficient calls to `iree_hal_hip_util_tree_node_next`.

fixes : iree-org#22733
@swote-git swote-git requested a review from AWoloszyn as a code owner November 23, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Runtime][Hip] Inefficient O(n) and Potentially Incorrect Implementation of lower_bound and upper_bound in runtime/src/iree/hal/drivers/hip/util/tree.c

1 participant