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.0.0 Documentation

Installation

  • roPRIM prerequisites
  • Installing rocPRIM on Linux
  • Building and installing rocAL from source

Conceptual

  • Block and stripe configurations
  • Types of rocPRIM operations
  • rocPRIM operation scope
  • rocPRIM Performance tuning
  • Implementing traits for custom types in rocPRIM

How to

  • Use the SPIR-V target

Reference

  • Glossary of rocPRIM terms
  • Data type support
  • Iterators
  • rocPRIM Utility types
  • Device-Wide Operations
    • Configuring the Kernels
    • Transform
    • Unique
    • Sort
    • Partial Sort
    • Nth Element
    • Merge
    • Partition
    • Run Length Encode
    • Scan
    • Search N
    • Select
    • Reduce
    • Adjacent Difference
    • Adjacent Find
    • Binary Search
    • Histogram
    • DeviceCopy
    • Memcpy
    • Find first of
    • Find end
    • Search
  • Block-Wide Operations
    • Operation classes
      • Load
      • Store
      • Adjacent difference
      • Discontinuity
      • Scan
      • Reduce
      • Run-length decode
      • Shuffle
      • Exchange
      • Sort
      • Histogram
    • Data movement functions
  • Warp-Level Operations
    • Load
    • Store
    • Reduce
    • Scan
    • Sort
    • Shuffle
    • Exchange
  • Thread-Level Operations
    • Radix Key Encoder/Decoder
    • Operators
    • Load
    • Reduce
    • Scan
    • Search
    • Store
  • rocPRIM Developer guidelines
  • License
  • Thread-Level Operations
  • 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

previous

Scan

next

Store

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