From 106b673a3403043b2e19da37fa52faa08db46826 Mon Sep 17 00:00:00 2001 From: Mike Qin Date: Tue, 20 Oct 2026 13:46:47 -0400 Subject: [PATCH] chore(clr): rename HIP_FORCE_API_VERSION to HIP_TARGET_API_VERSION --- .../device/hipGetDeviceProperties_R0000.cc | 4 ++-- projects/hip/docs/doxygen/Doxyfile | 2 +- projects/hip/include/hip/hip_common.h | 4 ++-- projects/hip/include/hip/hip_runtime_api.h | 20 +++++++++---------- .../hrr/playback/hip_playback_generated.cpp | 2 +- projects/hrr/tools/gen_hrr_api_args.py | 8 ++++---- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/projects/hip-tests/catch/unit/device/hipGetDeviceProperties_R0000.cc b/projects/hip-tests/catch/unit/device/hipGetDeviceProperties_R0000.cc index 1eacc1a423b2..f40c3ac65520 100644 --- a/projects/hip-tests/catch/unit/device/hipGetDeviceProperties_R0000.cc +++ b/projects/hip-tests/catch/unit/device/hipGetDeviceProperties_R0000.cc @@ -4,13 +4,13 @@ * SPDX-License-Identifier: MIT */ -// This test doesn't test the ABI, it tests if the API is alias to the R0000 when HIP_FORCE_API_VERSION is set. +// This test doesn't test the ABI, it tests if the API is alias to the R0000 when HIP_TARGET_API_VERSION is set. // HIP Nvidia doesn't support this mechanism, so we can't test this. #if HT_AMD #undef HIP_ABI_IMPL -#define HIP_FORCE_API_VERSION 500 +#define HIP_TARGET_API_VERSION 500 #include #include diff --git a/projects/hip/docs/doxygen/Doxyfile b/projects/hip/docs/doxygen/Doxyfile index 1ec48cb6c1ce..fcf8fac9a91d 100644 --- a/projects/hip/docs/doxygen/Doxyfile +++ b/projects/hip/docs/doxygen/Doxyfile @@ -2198,7 +2198,7 @@ INCLUDE_FILE_PATTERNS = # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. PREDEFINED = "__HIP_PLATFORM_AMD__" \ - "HIP_FORCE_API_VERSION=99999" \ + "HIP_TARGET_API_VERSION=99999" \ "DOXYGEN_SHOULD_INCLUDE_THIS=1" \ "DOXYGEN_SHOULD_SKIP_THIS=1" \ "__dparm(x)=" \ diff --git a/projects/hip/include/hip/hip_common.h b/projects/hip/include/hip/hip_common.h index 6e1da834167f..d0d0cfe4d2e9 100644 --- a/projects/hip/include/hip/hip_common.h +++ b/projects/hip/include/hip/hip_common.h @@ -75,8 +75,8 @@ #define HIP_API_VERSION (HIP_VERSION_MAJOR * 100 + HIP_VERSION_MINOR) -#ifndef HIP_FORCE_API_VERSION -# define HIP_FORCE_API_VERSION HIP_API_VERSION +#ifndef HIP_TARGET_API_VERSION +# define HIP_TARGET_API_VERSION HIP_API_VERSION #endif #endif diff --git a/projects/hip/include/hip/hip_runtime_api.h b/projects/hip/include/hip/hip_runtime_api.h index bf4ed8c1d7a2..9da389d6a6cc 100644 --- a/projects/hip/include/hip/hip_runtime_api.h +++ b/projects/hip/include/hip/hip_runtime_api.h @@ -30,8 +30,8 @@ #include #include -#if HIP_FORCE_API_VERSION > HIP_API_VERSION -# error "HIP_FORCE_API_VERSION is newer than the installed HIP headers" +#if HIP_TARGET_API_VERSION > HIP_API_VERSION +# error "HIP_TARGET_API_VERSION is newer than the installed HIP headers" #endif enum { @@ -243,7 +243,7 @@ typedef enum __HIP_NODISCARD hipError_t UINT32_BASE { ensure ABI compatibility, we must typedef the actual struct name here. */ -#if HIP_FORCE_API_VERSION < 600 +#if HIP_TARGET_API_VERSION < 600 #include // Legacy version, HIP_ABI_IMPL is on the latest version, so it must not see this. @@ -253,7 +253,7 @@ typedef struct hipDeviceProp_tR0600 {} hipDeviceProp_tR0600; #endif -#if HIP_FORCE_API_VERSION >= 600 +#if HIP_TARGET_API_VERSION >= 600 // Latest version. /** @@ -2616,9 +2616,9 @@ hipError_t hipDeviceSetMemPool(int device, hipMemPool_t mem_pool); hipError_t hipDeviceGetMemPool(hipMemPool_t* mem_pool, int device); // hipDeviceProp_t and hipGetDeviceProperties/hipChooseDevice are versioned. -// See HIP_FORCE_API_VERSION in hip_common.h. +// See HIP_TARGET_API_VERSION in hip_common.h. -#if HIP_FORCE_API_VERSION >= 600 +#if HIP_TARGET_API_VERSION >= 600 hipError_t hipGetDevicePropertiesR0600(hipDeviceProp_tR0600* prop, int deviceId); @@ -2782,7 +2782,7 @@ hipError_t hipDeviceSetSharedMemConfig(hipSharedMemConfig config); */ hipError_t hipSetDeviceFlags(unsigned flags); -#if HIP_FORCE_API_VERSION >= 600 +#if HIP_TARGET_API_VERSION >= 600 hipError_t hipChooseDeviceR0600(int* device, const hipDeviceProp_tR0600* prop); /** @@ -4437,7 +4437,7 @@ hipError_t hipDrvMemDiscardAndPrefetchBatchAsync(hipDeviceptr_t* dptrs, size_t* unsigned long long flags, hipStream_t stream); // Deprecated since 800. Introduced in 700. -#if (HIP_FORCE_API_VERSION >= 700 && HIP_FORCE_API_VERSION < 800) || defined(HIP_ABI_IMPL) +#if (HIP_TARGET_API_VERSION >= 700 && HIP_TARGET_API_VERSION < 800) || defined(HIP_ABI_IMPL) /** * @brief Advise about the usage of a given memory range to HIP. @@ -4464,7 +4464,7 @@ hipError_t hipMemAdvise_v2(const void* dev_ptr, size_t count, hipMemoryAdvise ad #endif // Deprecated since 800. -#if HIP_FORCE_API_VERSION < 800 || defined(HIP_ABI_IMPL) +#if HIP_TARGET_API_VERSION < 800 || defined(HIP_ABI_IMPL) /** * @brief Advise about the usage of a given memory range to HIP. @@ -4490,7 +4490,7 @@ hipError_t hipMemAdvise(const void* dev_ptr, size_t count, hipMemoryAdvise advic #endif // Latest -#if HIP_FORCE_API_VERSION >= 800 && !defined(HIP_ABI_IMPL) +#if HIP_TARGET_API_VERSION >= 800 && !defined(HIP_ABI_IMPL) hipError_t hipMemAdvise_v2(const void* dev_ptr, size_t count, hipMemoryAdvise advice, hipMemLocation location); diff --git a/projects/hrr/playback/hip_playback_generated.cpp b/projects/hrr/playback/hip_playback_generated.cpp index 299a330d4400..34147f32567b 100644 --- a/projects/hrr/playback/hip_playback_generated.cpp +++ b/projects/hrr/playback/hip_playback_generated.cpp @@ -2483,7 +2483,7 @@ extern hipError_t playback_hipMemAddressReserve(PlaybackContext& ctx, const uint static hipError_t playback_hipMemAdvise(PlaybackContext& ctx, const uint8_t* payload) { const auto* a = reinterpret_cast(payload); -#if HIP_FORCE_API_VERSION >= 800 && !defined(HIP_ABI_IMPL) +#if HIP_TARGET_API_VERSION >= 800 && !defined(HIP_ABI_IMPL) hipMemLocation _loc_device{}; _loc_device.type = hipMemLocationTypeDevice; _loc_device.id = (int)a->device; diff --git a/projects/hrr/tools/gen_hrr_api_args.py b/projects/hrr/tools/gen_hrr_api_args.py index 2dbbd07189bc..79a273ca670c 100644 --- a/projects/hrr/tools/gen_hrr_api_args.py +++ b/projects/hrr/tools/gen_hrr_api_args.py @@ -3144,7 +3144,7 @@ def _graph_param(entry: ApiEntry) -> str: # Playback calls the PUBLIC HIP API by name; capture goes through the dispatch # table. Those are two different declarations, and they are allowed to diverge: # hip_api_trace.hpp is append-only ABI, while hip_runtime_api.h re-declares an -# API with a new signature under a HIP_FORCE_API_VERSION guard. +# API with a new signature under a HIP_TARGET_API_VERSION guard. # # validate_playback_signatures() refuses to generate when the two disagree, so # a divergence cannot silently produce a wrong cast. An entry here is the @@ -3173,7 +3173,7 @@ def _graph_param(entry: ApiEntry) -> str: # bridge rebuilds a hipMemLocation from it rather than passing a zeroed # struct — the recorded device is preserved on both sides of the guard. 'hipMemAdvise': { - 'guard': 'HIP_FORCE_API_VERSION >= 800 && !defined(HIP_ABI_IMPL)', + 'guard': 'HIP_TARGET_API_VERSION >= 800 && !defined(HIP_ABI_IMPL)', 'param': 'device', 'pre': [ ' hipMemLocation _loc_{name}{{}};', @@ -3934,7 +3934,7 @@ def generate_playback_cpp(entries: List[ApiEntry]) -> str: # public API by name. Deriving playback casts from the table is therefore only # sound while the two declarations agree, and they are not required to: the # table is append-only ABI, while hip_runtime_api.h may re-declare an API with -# a different signature under a HIP_FORCE_API_VERSION guard (hipMemAdvise gained +# a different signature under a HIP_TARGET_API_VERSION guard (hipMemAdvise gained # a hipMemLocation parameter in HIP 8.0 this way). # # This pass parses the public header and refuses to generate when a playback @@ -3945,7 +3945,7 @@ def generate_playback_cpp(entries: List[ApiEntry]) -> str: class PublicDecl: """One non-template declaration of a public HIP API.""" types: Tuple[str, ...] - guarded: bool # inside a HIP_FORCE_API_VERSION / HIP_ABI_IMPL #if + guarded: bool # inside a HIP_TARGET_API_VERSION / HIP_ABI_IMPL #if line: int