Skip to main content
Ctrl+K
This page contains proposed changes for a future release of ROCm. Read the latest Linux release of ROCm documentation for your production environments.
AMD Logo
ROCm™ Software Future Release Version List
  • GitHub
  • Community
  • Blogs
  • ROCm Developer Hub
  • Instinct™ Docs
  • Infinity Hub
  • Support

ROCm documentation

rocPRIM 4.2.0 Documentation

Installation

  • Prerequisites
  • Installation overview
  • Installing on Linux
  • Building and installing from source

Conceptual

  • Block and stripe arrangements
  • rocPRIM operation scope
  • Types of rocPRIM operations
  • rocPRIM Performance tuning

How to

  • Use the SPIR-V target

Reference

  • Glossary
  • Data type support
  • API reference
    • Iterators
    • Intrinsics
    • Utility types
    • Custom type traits
    • Data movement functions
    • Device-level operations
    • Block-level operations
    • Warp-level operations
    • Thread-level operations

About

  • rocPRIM Developer guidelines
  • License
  • Search

Search

Contents

  • merge_path_search()
  • lower_bound()
  • upper_bound()
  • static_upper_bound()

Search#

group thread_search

Functions

template<class AIteratorT, class BIteratorT, class OffsetT, class CoordinateT, class BinaryFunction = rocprim::less<typename std::iterator_traits<AIteratorT>::value_type>>
__host__ __device__ inline void merge_path_search(OffsetT diagonal, AIteratorT a, BIteratorT b, OffsetT a_len, OffsetT b_len, CoordinateT &path_coordinate, BinaryFunction compare_function = BinaryFunction())#

Computes the begin offsets into A and B for the specific diagonal. If the diagonal is larger than the sum of the two lengths the first component of the result will be clamped to be no larger than a_len and the sum of the two components will be equal to diagonal.

template<typename InputIteratorT, typename OffsetT, typename T>
__device__ inline OffsetT lower_bound(InputIteratorT input, OffsetT num_items, T val)#

Returns the offset of the first value within input which does not compare less than val.

Template Parameters:
  • InputIteratorT – [inferred] Type of iterator for the input data to be searched

  • OffsetT – [inferred] The data type of num_items

  • T – [inferred] The data type of the input sequence elements

Parameters:
  • input – [in] Input sequence

  • num_items – [in] Input sequence length

  • val – [in] Search Key

Returns:

Offset at which val was found

template<typename InputIteratorT, typename OffsetT, typename T>
__device__ inline OffsetT upper_bound(InputIteratorT input, OffsetT num_items, T val)#

Returns the offset of the first value within input which compares greater than val.

Template Parameters:
  • InputIteratorT – [inferred] Type of iterator for the input data to be searched

  • OffsetT – [inferred] The data type of num_items

  • T – [inferred] The data type of the input sequence elements

Parameters:
  • input – [in] Input sequence

  • num_items – [in] Input sequence length

  • val – [in] Search Key

Returns:

Offset at which val was found

template<int MaxNumItems, typename InputIteratorT, typename OffsetT, typename T>
__device__ inline OffsetT static_upper_bound(InputIteratorT input, OffsetT num_items, T val)#

Returns the offset of the first value within input which compares greater than val computed as a statically unrolled loop.

Template Parameters:
  • MaxNumItems – The maximum number of items.

  • InputIteratorT – [inferred] Type of iterator for the input data to be searched

  • OffsetT – [inferred] The data type of num_items

  • T – [inferred] The data type of the input sequence elements

Parameters:
  • input – [in] Input sequence

  • num_items – [in] Input sequence length

  • val – [in] Search Key

Returns:

Offset at which val was found

Contents
  • merge_path_search()
  • lower_bound()
  • upper_bound()
  • static_upper_bound()

  • Terms and Conditions
  • ROCm Licenses and Disclaimers
  • Privacy
  • Trademarks
  • Supply Chain Transparency
  • Fair and Open Competition
  • UK Tax Strategy
  • Cookie Policy
  • Cookie Settings
© 2025 Advanced Micro Devices, Inc