[SDK] Support HIP 7.0 API changes (#432)
* [Do not merge] Make changes to api_args
* Support HIP 7.0 API changes
- Provide ROCPROFILER_SDK_ variants of ROCPROFILER_ version defines
- Provide ROCPROFILER_SDK_COMPUTE_VERSION
- hipCtxGetApiVersion changes parameter from int* to unsigned int*
- hipMemcpyHtoD and hipMemcpyHtoDAsync changed void* to const void*
* Fix comment
---------
Co-authored-by: Jatin Chaudhary <jatchaud@amd.com>
Co-authored-by: Jonathan R. Madsen <jonathanrmadsen@gmail.com>
[ROCm/rocprofiler-sdk commit: caf1a2174e]
Bu işleme şunda yer alıyor:
işlemeyi yapan:
GitHub
ebeveyn
bb80373649
işleme
adc4e6995d
@@ -33,6 +33,7 @@
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
#define HIP_API_CALL(CALL) \
|
||||
{ \
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
#define HIP_API_CALL(CALL) \
|
||||
{ \
|
||||
|
||||
@@ -22,13 +22,16 @@
|
||||
|
||||
#include "hip/hip_runtime.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <iomanip>
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
#include <vector>
|
||||
#include "transpose_kernels.hpp"
|
||||
|
||||
#define PRINT_ALIGN 36
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
#define HIP_API_CALL(CALL) \
|
||||
{ \
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <shared_mutex>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include <shared_mutex>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <unistd.h>
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <mutex>
|
||||
#include <optional>
|
||||
#include <shared_mutex>
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
#define HIP_API_CALL(CALL) \
|
||||
{ \
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <mutex>
|
||||
#include <random>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
#define HIP_API_CALL(CALL) \
|
||||
{ \
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
#include <stdexcept>
|
||||
#include <thread>
|
||||
|
||||
#define HIP_API_CALL(CALL) \
|
||||
{ \
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <rocprofiler-sdk/fwd.h>
|
||||
#include <rocprofiler-sdk/rocprofiler.h>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace client
|
||||
|
||||
@@ -80,6 +80,23 @@
|
||||
* @brief When this attribute is added to a type, object, expression, etc., the developer should be
|
||||
* aware that the API and/or ABI is subject to change in subsequent releases.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SDK_COMPUTE_VERSION_VALUE
|
||||
* @param[in] MAX_VERSION_VALUE set to +1 of the maximum value for a given version, e.g. a value of
|
||||
* 100 means that the max value of the major/minor/patch version is 99
|
||||
* @param[in] MAJOR_VERSION major version of library (integral)
|
||||
* @param[in] MINOR_VERSION minor version of library (integral)
|
||||
* @param[in] PATCH_VERSION patch version of library (integral)
|
||||
* @brief Helper macro calculating a generate versioning integer for a library
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SDK_COMPUTE_VERSION
|
||||
* @param[in] MAJOR_VERSION major version of library (integral)
|
||||
* @param[in] MINOR_VERSION minor version of library (integral)
|
||||
* @param[in] PATCH_VERSION patch version of library (integral)
|
||||
* @brief Helper macro for users to generate versioning int expected by
|
||||
* rocprofiler-sdk when the library maintains a major, minor, and patch version numbers
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*/
|
||||
|
||||
#if !defined(ROCPROFILER_ATTRIBUTE)
|
||||
@@ -219,3 +236,9 @@
|
||||
#if defined(ROCPROFILER_SDK_BETA_COMPAT) && ROCPROFILER_SDK_BETA_COMPAT > 0
|
||||
# define ROCPROFILER_SDK_BETA_COMPAT_SUPPORTED 1
|
||||
#endif
|
||||
|
||||
#define ROCPROFILER_SDK_COMPUTE_VERSION_VALUE(MAX_VERSION_VALUE, MAJOR, MINOR, PATCH) \
|
||||
(((MAX_VERSION_VALUE * MAX_VERSION_VALUE) * MAJOR) + (MAX_VERSION_VALUE * MINOR) + (PATCH))
|
||||
|
||||
#define ROCPROFILER_SDK_COMPUTE_VERSION(MAJOR, MINOR, PATCH) \
|
||||
ROCPROFILER_SDK_COMPUTE_VERSION_VALUE(100, MAJOR, MINOR, PATCH)
|
||||
|
||||
@@ -261,8 +261,17 @@ typedef union rocprofiler_hip_api_args_t
|
||||
} hipCtxEnablePeerAccess;
|
||||
struct
|
||||
{
|
||||
// In HIP v7.0, apiVersion was changed from int* to unsigned int* to match CUDA signature.
|
||||
// If rocprofiler-sdk is compiled with HIP >= 7.0 and HIP is < 7.0 at runtime, there is
|
||||
// expectation that this will NOT cause issues: apiVersion should never be negative and
|
||||
// should never be >= INT_MAX
|
||||
hipCtx_t ctx;
|
||||
int* apiVersion;
|
||||
#if ROCPROFILER_SDK_COMPUTE_VERSION(HIP_VERSION_MAJOR, HIP_VERSION_MINOR, 0) >= \
|
||||
ROCPROFILER_SDK_COMPUTE_VERSION(7, 0, 0)
|
||||
unsigned int* apiVersion;
|
||||
#else
|
||||
int* apiVersion; // HIP version < 7.0
|
||||
#endif
|
||||
} hipCtxGetApiVersion;
|
||||
struct
|
||||
{
|
||||
@@ -1787,13 +1796,13 @@ typedef union rocprofiler_hip_api_args_t
|
||||
struct
|
||||
{
|
||||
hipDeviceptr_t dst;
|
||||
void* src;
|
||||
const void* src;
|
||||
size_t sizeBytes;
|
||||
} hipMemcpyHtoD;
|
||||
struct
|
||||
{
|
||||
hipDeviceptr_t dst;
|
||||
void* src;
|
||||
const void* src;
|
||||
size_t sizeBytes;
|
||||
hipStream_t stream;
|
||||
} hipMemcpyHtoDAsync;
|
||||
|
||||
@@ -22,74 +22,172 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <rocprofiler-sdk/defines.h>
|
||||
|
||||
/**
|
||||
* @def ROCPROFILER_IS_ROCPROFILER_SDK
|
||||
* @brief Preprocessor define indicating the rocprofiler header is a rocprofiler-sdk project
|
||||
* @brief Preprocessor define indicating the header is from rocprofiler-sdk project (i.e. not
|
||||
* rocprofiler v1 or v2).
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION_MAJOR
|
||||
* @def ROCPROFILER_SDK_VERSION_MAJOR
|
||||
* @brief The major version of the interface as a macro so it can be used
|
||||
* by the preprocessor.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION_MINOR
|
||||
* @def ROCPROFILER_SDK_VERSION_MINOR
|
||||
* @brief The minor version of the interface as a macro so it can be used
|
||||
* by the preprocessor.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION_PATCH
|
||||
* @def ROCPROFILER_SDK_VERSION_PATCH
|
||||
* @brief The patch version of the interface as a macro so it can be used
|
||||
* by the preprocessor.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION
|
||||
* @def ROCPROFILER_SDK_VERSION
|
||||
* @brief Numerically increasing version number encoding major, minor, and patch via
|
||||
computing `((10000 * <MAJOR>) + (100 * <MINOR>) + <PATCH>)`.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SOVERSION
|
||||
* @def ROCPROFILER_SDK_SOVERSION
|
||||
* @brief Shared object versioning value whose value is at least `(10000 * <MAJOR>)`.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION_STRING
|
||||
* @def ROCPROFILER_SDK_VERSION_STRING
|
||||
* @brief Version string in form: `<MAJOR>.<MINOR>.<PATCH>`.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_GIT_DESCRIBE
|
||||
* @brief String encoding of `git describe --tags` when rocprofiler was built.
|
||||
* @def ROCPROFILER_SDK_GIT_DESCRIBE
|
||||
* @brief String encoding of `git describe --tags` when rocprofiler-sdk was built.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_GIT_REVISION
|
||||
* @brief String encoding of `git rev-parse HEAD` when rocprofiler was built.
|
||||
* @def ROCPROFILER_SDK_GIT_REVISION
|
||||
* @brief String encoding of `git rev-parse HEAD` when rocprofiler-sdk was built.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_LIBRARY_ARCH
|
||||
* @brief Architecture triplet of rocprofiler build.
|
||||
* @def ROCPROFILER_SDK_LIBRARY_ARCH
|
||||
* @brief Architecture triplet of rocprofiler-sdk build.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SYSTEM_NAME
|
||||
* @brief Target operating system for rocprofiler build, e.g. Linux.
|
||||
* @def ROCPROFILER_SDK_SYSTEM_NAME
|
||||
* @brief Target operating system for rocprofiler-sdk build, e.g. Linux.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SYSTEM_PROCESSOR
|
||||
* @brief Target architecture for rocprofiler build.
|
||||
* @def ROCPROFILER_SDK_SYSTEM_PROCESSOR
|
||||
* @brief Target architecture for rocprofiler-sdk build.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SYSTEM_VERSION
|
||||
* @def ROCPROFILER_SDK_SYSTEM_VERSION
|
||||
* @brief Version of the operating system which built rocprofiler
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_COMPILER_ID
|
||||
* @def ROCPROFILER_SDK_COMPILER_ID
|
||||
* @brief C++ compiler identifier which built rocprofiler, e.g., GNU
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_COMPILER_VERSION
|
||||
* @def ROCPROFILER_SDK_COMPILER_VERSION
|
||||
* @brief C++ compiler version which built rocprofiler
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION_MAJOR
|
||||
* @brief The major version of the interface as a macro so it can be used
|
||||
* by the preprocessor. Deprecated in favor of `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION_MINOR
|
||||
* @brief The minor version of the interface as a macro so it can be used
|
||||
* by the preprocessor. Deprecated in favor of `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION_PATCH
|
||||
* @brief The patch version of the interface as a macro so it can be used
|
||||
* by the preprocessor. Deprecated in favor of `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION
|
||||
* @brief Numerically increasing version number encoding major, minor, and patch via
|
||||
* computing `((10000 * <MAJOR>) + (100 * <MINOR>) + <PATCH>)`. Deprecated in favor
|
||||
* of `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SOVERSION
|
||||
* @brief Shared object versioning value whose value is at least `(10000 * <MAJOR>)`.
|
||||
* Deprecated in favor of `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_VERSION_STRING
|
||||
* @brief Version string in form: `<MAJOR>.<MINOR>.<PATCH>`. Deprecated in favor of
|
||||
* `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_GIT_DESCRIBE
|
||||
* @brief String encoding of `git describe --tags` when rocprofiler-sdk was built. Deprecated in
|
||||
* favor of `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_GIT_REVISION
|
||||
* @brief String encoding of `git rev-parse HEAD` when rocprofiler-sdk was built. Deprecated in
|
||||
* favor of `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_LIBRARY_ARCH
|
||||
* @brief Architecture triplet of rocprofiler-sdk build. Deprecated in favor of `ROCPROFILER_SDK_`
|
||||
* variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SYSTEM_NAME
|
||||
* @brief Target operating system for rocprofiler-sdk build, e.g. Linux. Deprecated in favor of
|
||||
* `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SYSTEM_PROCESSOR
|
||||
* @brief Target architecture for rocprofiler-sdk build. Deprecated in favor of `ROCPROFILER_SDK_`
|
||||
* variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_SYSTEM_VERSION
|
||||
* @brief Version of the operating system which built rocprofiler. Deprecated in favor of
|
||||
* `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_COMPILER_ID
|
||||
* @brief C++ compiler identifier which built rocprofiler, e.g., GNU. Deprecated in favor of
|
||||
* `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*
|
||||
* @def ROCPROFILER_COMPILER_VERSION
|
||||
* @brief C++ compiler version which built rocprofiler-sdk. Deprecated in favor of
|
||||
* `ROCPROFILER_SDK_` variant.
|
||||
* @addtogroup VERSIONING_GROUP
|
||||
*/
|
||||
|
||||
#define ROCPROFILER_IS_ROCPROFILER_SDK 1
|
||||
|
||||
// clang-format off
|
||||
#define ROCPROFILER_SDK_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define ROCPROFILER_SDK_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
#define ROCPROFILER_SDK_VERSION_PATCH @PROJECT_VERSION_PATCH@
|
||||
#define ROCPROFILER_SDK_SOVERSION @PROJECT_VERSION_MAJOR@
|
||||
#define ROCPROFILER_SDK_VERSION_STRING "@FULL_VERSION_STRING@"
|
||||
#define ROCPROFILER_SDK_GIT_DESCRIBE "@ROCPROFILER_SDK_GIT_DESCRIBE@"
|
||||
#define ROCPROFILER_SDK_GIT_REVISION "@ROCPROFILER_SDK_GIT_REVISION@"
|
||||
|
||||
// system info during compilation
|
||||
#define ROCPROFILER_SDK_LIBRARY_ARCH "@CMAKE_LIBRARY_ARCHITECTURE@"
|
||||
#define ROCPROFILER_SDK_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@"
|
||||
#define ROCPROFILER_SDK_SYSTEM_PROCESSOR "@CMAKE_SYSTEM_PROCESSOR@"
|
||||
#define ROCPROFILER_SDK_SYSTEM_VERSION "@CMAKE_SYSTEM_VERSION@"
|
||||
|
||||
// compiler information
|
||||
#define ROCPROFILER_SDK_COMPILER_ID "@CMAKE_CXX_COMPILER_ID@"
|
||||
#define ROCPROFILER_SDK_COMPILER_VERSION "@CMAKE_CXX_COMPILER_VERSION@"
|
||||
// clang-format on
|
||||
|
||||
#define ROCPROFILER_SDK_VERSION \
|
||||
ROCPROFILER_SDK_COMPUTE_VERSION( \
|
||||
ROCPROFILER_VERSION_MAJOR, ROCPROFILER_VERSION_MINOR, ROCPROFILER_VERSION_PATCH)
|
||||
|
||||
// clang-format off
|
||||
#define ROCPROFILER_VERSION_MAJOR @PROJECT_VERSION_MAJOR@
|
||||
#define ROCPROFILER_VERSION_MINOR @PROJECT_VERSION_MINOR@
|
||||
@@ -111,5 +209,5 @@
|
||||
// clang-format on
|
||||
|
||||
#define ROCPROFILER_VERSION \
|
||||
((10000 * ROCPROFILER_VERSION_MAJOR) + (100 * ROCPROFILER_VERSION_MINOR) + \
|
||||
ROCPROFILER_VERSION_PATCH)
|
||||
ROCPROFILER_SDK_COMPUTE_VERSION( \
|
||||
ROCPROFILER_VERSION_MAJOR, ROCPROFILER_VERSION_MINOR, ROCPROFILER_VERSION_PATCH)
|
||||
|
||||
@@ -65,7 +65,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#define ROCPROFILER_COMPUTE_VERSION(MAJOR, MINOR, PATCH) ((10000 * MAJOR) + (100 * MINOR) + (PATCH))
|
||||
#define ROCPROFILER_COMPUTE_VERSION(MAJOR, MINOR, PATCH) \
|
||||
ROCPROFILER_SDK_COMPUTE_VERSION(MAJOR, MINOR, PATCH)
|
||||
|
||||
// Below are used in HSA, HIP, and Marker API tracing
|
||||
#define IMPL_DETAIL_EXPAND(X) X
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace hsa
|
||||
#define HSA_AMD_INTERFACE_VERSION \
|
||||
ROCPROFILER_COMPUTE_VERSION(HSA_AMD_INTERFACE_VERSION_MAJOR, HSA_AMD_INTERFACE_VERSION_MINOR, 0)
|
||||
|
||||
#if HSA_AMD_INTERFACE_VERSION >= 10700
|
||||
#if HSA_AMD_INTERFACE_VERSION >= ROCPROFILER_COMPUTE_VERSION(1, 7, 0)
|
||||
constexpr auto hsa_amd_memory_pool_executable_flag = HSA_AMD_MEMORY_POOL_EXECUTABLE_FLAG;
|
||||
#else
|
||||
constexpr auto hsa_amd_memory_pool_executable_flag = (1 << 2);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
# undef NDEBUG
|
||||
#endif
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdint>
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
|
||||
Yeni konuda referans
Bir kullanıcı engelle