Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 <hip/hip_runtime_api.h>
#include <catch2/catch_all.hpp>

Expand Down
2 changes: 1 addition & 1 deletion projects/hip/docs/doxygen/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -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)=" \
Expand Down
4 changes: 2 additions & 2 deletions projects/hip/include/hip/hip_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment thread
mikeqinamd marked this conversation as resolved.
Resolved

#endif
20 changes: 10 additions & 10 deletions projects/hip/include/hip/hip_runtime_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
#include <hip/hip_common.h>
#include <hip/linker_types.h>

#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 {
Expand Down Expand Up @@ -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 <hip/hip_deprecated.h>
// Legacy version, HIP_ABI_IMPL is on the latest version, so it must not see this.
Expand All @@ -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.

/**
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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);

/**
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion projects/hrr/playback/hip_playback_generated.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const hrr_args_hipMemAdvise*>(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;
Expand Down
8 changes: 4 additions & 4 deletions projects/hrr/tools/gen_hrr_api_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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}{{}};',
Expand Down Expand Up @@ -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
Expand All @@ -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


Expand Down
Loading