[all-commits] [llvm/llvm-project] 0248d2: Reland [HIP] fix host min/max in header (#133590)

Yaxun (Sam) Liu via All-commits all-commits at lists.llvm.org
Mon Mar 31 17:28:52 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0248d277cabab370b48114cc62aff393b273971b
      https://github.com/llvm/llvm-project/commit/0248d277cabab370b48114cc62aff393b273971b
  Author: Yaxun (Sam) Liu <yaxun.liu at amd.com>
  Date:   2025-03-31 (Mon, 31 Mar 2025)

  Changed paths:
    M clang/lib/Headers/__clang_hip_math.h

  Log Message:
  -----------
  Reland [HIP] fix host min/max in header (#133590)

CUDA defines min/max functions for host in global namespace. HIP header
needs to define them too to be compatible. Currently only min/max(int,
int) is defined. This causes wrong result for arguments that are out of
range for int. This patch defines host min/max functions to be
compatible with CUDA.

Since some HIP apps defined min/max functions by themselves, newly added
min/max function are under the control of macro
`__HIP_DEFINE_EXTENDED_HOST_MIN_MAX__`, which is 0 by default. In the
future, this will change to 1 by
default after most existing HIP apps adopt this change.

Also allows users to define
`__HIP_NO_HOST_MIN_MAX_IN_GLOBAL_NAMESPACE__` to disable host max/min in
global namespace.

min/max functions with mixed signed/unsigned integer parameters are not
defined unless
`__HIP_DEFINE_MIXED_HOST_MIN_MAX__` is defined.

Fixes: SWDEV-446564



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list