From 28fe756bb3858eb817540048edbe002c1c43c8f6 Mon Sep 17 00:00:00 2001 From: Bence Parajdi Date: Tue, 12 Dec 2023 12:44:25 +0100 Subject: [PATCH 1/4] fix build warnings removed double std namespaces fix underlines --- .gitignore | 1 + docs/Contributors_Guide.rst | 2 +- docs/Programmers_Guide.rst | 24 +++---- .../internal/hiptensor-version.hpp.in | 9 +++ .../hiptensor/internal/type_traits.hpp | 63 +++++++++++++++++++ .../contraction/contraction_solution_impl.hpp | 6 +- .../contraction_solution_params_impl.hpp | 4 +- 7 files changed, 91 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index ad44a303..674c60bc 100644 --- a/.gitignore +++ b/.gitignore @@ -60,3 +60,4 @@ _templates/ _toc.yml docBin/ _doxygen/ +.venv diff --git a/docs/Contributors_Guide.rst b/docs/Contributors_Guide.rst index d75a884b..212248be 100644 --- a/docs/Contributors_Guide.rst +++ b/docs/Contributors_Guide.rst @@ -30,7 +30,7 @@ The hipTensor repository follows a workflow which dictates a /master branch wher the compute bound limit or memory bound limit. Style Guide -========== +=========== This project follows the `CPP Core guidelines `__, diff --git a/docs/Programmers_Guide.rst b/docs/Programmers_Guide.rst index 1eaf9adf..047c1f5a 100644 --- a/docs/Programmers_Guide.rst +++ b/docs/Programmers_Guide.rst @@ -17,13 +17,13 @@ The `library` directory ^^^^^^^^^^^^^^^^^^^^^^^ `library/include/hiptensor/` -''''''''''''''''''''''''''' +'''''''''''''''''''''''''''' Contains C++ include files for the hipTensor API. These files also contain Doxygen comments that document the API. `library/include/hiptensor/internal` -'''''''''''''''''''''''''''''''''' +'''''''''''''''''''''''''''''''''''' Internal include files for: @@ -31,30 +31,30 @@ Internal include files for: - Generate Tensor Utility `library/src/` -'''''''''''' +'''''''''''''' Contains logger, device and performance functions. `library/src/contraction/` -'''''''''''''''''''''''' +'''''''''''''''''''''''''' Contains hipTensor core composable kernel header functions and contraction initialization functions. `library/src/contraction/device` -'''''''''''''''''''''''''''''' +'''''''''''''''''''''''''''''''' Contains hipTensor Bilinear and Scale instance functions The `samples` directory ^^^^^^^^^^^^^^^^^^^^^^^ `01_contraction/simple_bilinear_contraction_f32.cpp` -'''''''''''''''''''''''''''''''''''''''''''''''''' +'''''''''''''''''''''''''''''''''''''''''''''''''''' sample code for calling bilinear contraction for :code:`fp32` input, output and compute types `01_contraction/simple_scale_contraction_f32.cpp` -''''''''''''''''''''''''''''''''''''''''''''''' +''''''''''''''''''''''''''''''''''''''''''''''''' sample code for calling scale contraction for :code:`fp32` input, output and compute types @@ -62,27 +62,27 @@ The `test` directory ^^^^^^^^^^^^^^^^^^^^^^^ `00_unit/logger` -'''''''''''''' +'''''''''''''''' Test code for testing logger API Functions of hipTensor `01_contraction/bilinear_contraction_f32` -''''''''''''''''''''''''''''''''''''''' +''''''''''''''''''''''''''''''''''''''''' Test code for testing the bilinear contraction functionality and log metrics for F32 types. `01_contraction/bilinear_contraction_f64` -''''''''''''''''''''''''''''''''''''''' +''''''''''''''''''''''''''''''''''''''''' Test code for testing the bilinear contraction functionality and log metrics for F64 types. `01_contraction/scale_contraction_f32` -'''''''''''''''''''''''''''''''''''' +'''''''''''''''''''''''''''''''''''''' Test code for testing the scale contraction functionality and log metrics for F32 types. `01_contraction/scale_contraction_f64` -'''''''''''''''''''''''''''''''''''' +'''''''''''''''''''''''''''''''''''''' Test code for testing the scale contraction functionality and log metrics for F64 types. diff --git a/library/include/hiptensor/internal/hiptensor-version.hpp.in b/library/include/hiptensor/internal/hiptensor-version.hpp.in index e1942a2b..89247375 100644 --- a/library/include/hiptensor/internal/hiptensor-version.hpp.in +++ b/library/include/hiptensor/internal/hiptensor-version.hpp.in @@ -38,6 +38,15 @@ #define HIPTENSOR_PATCH_VERSION @hiptensor_VERSION_PATCH@ // clang-format on +/** + * \brief Returns the version number of hipTensor + * + * \details Return the version with three least significant digits for patch version, + * the next three digits for minor version, and the most significant digits for major version. + * + * \returns The version number. + */ + inline size_t hiptensorGetVersion() { return HIPTENSOR_MAJOR_VERSION * 1e6 + HIPTENSOR_MINOR_VERSION * 1e3 + HIPTENSOR_PATCH_VERSION; diff --git a/library/include/hiptensor/internal/type_traits.hpp b/library/include/hiptensor/internal/type_traits.hpp index 48566051..7735a5c4 100644 --- a/library/include/hiptensor/internal/type_traits.hpp +++ b/library/include/hiptensor/internal/type_traits.hpp @@ -93,6 +93,7 @@ namespace std /////////// std::numeric_limits ////////////// /////////////////////////////////////////////////////////// +#ifndef DOXYGEN_SHOULD_SKIP_THIS template <> HIPTENSOR_HOST_DEVICE constexpr hiptensor::float16_t numeric_limits::epsilon() noexcept @@ -270,6 +271,68 @@ namespace std hiptensor::detail::Fp16Bits eps(static_cast(0x7FC0)); return eps.b16; } + + /////////////////////////////////////////////////////////// + /////////// std::numeric_limits ////////////// + /////////////////////////////////////////////////////////// + + template <> + HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t + numeric_limits::epsilon() noexcept + { + hiptensor::detail::Fp32Bits eps(static_cast(FLT_EPSILON)); + return eps.xf32; + } + + template <> + HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t + numeric_limits::infinity() noexcept + { + hiptensor::detail::Fp32Bits eps(static_cast(HUGE_VALF)); + return eps.xf32; + } + + template <> + HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t + numeric_limits::lowest() noexcept + { + hiptensor::detail::Fp32Bits eps(static_cast(-FLT_MAX)); + return eps.xf32; + } + + template <> + HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t + numeric_limits::max() noexcept + { + hiptensor::detail::Fp32Bits eps(static_cast(FLT_MAX)); + return eps.xf32; + } + + template <> + HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t + numeric_limits::min() noexcept + { + hiptensor::detail::Fp32Bits eps(static_cast(FLT_MIN)); + return eps.xf32; + } + + template <> + HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t + numeric_limits::quiet_NaN() noexcept + { + hiptensor::detail::Fp32Bits eps(static_cast(0x7FF80000)); + return eps.xf32; + } + + template <> + HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t + numeric_limits::signaling_NaN() noexcept + { + hiptensor::detail::Fp32Bits eps(static_cast(0x7FF00000)); + return eps.xf32; + } +#endif // DOXYGEN_SHOULD_SKIP_THIS + // @endcond } // namespace std namespace hiptensor diff --git a/library/src/contraction/contraction_solution_impl.hpp b/library/src/contraction/contraction_solution_impl.hpp index 3b672fbb..263937c3 100644 --- a/library/src/contraction/contraction_solution_impl.hpp +++ b/library/src/contraction/contraction_solution_impl.hpp @@ -35,11 +35,11 @@ namespace std { template <> - struct std::hash + struct hash { - std::size_t operator()(hiptensor::ContractionSolution const& s) const noexcept + size_t operator()(hiptensor::ContractionSolution const& s) const noexcept { - return std::hash{}(*s.params()); + return hash{}(*s.params()); } }; } diff --git a/library/src/contraction/contraction_solution_params_impl.hpp b/library/src/contraction/contraction_solution_params_impl.hpp index b84f9c2b..3abcaede 100644 --- a/library/src/contraction/contraction_solution_params_impl.hpp +++ b/library/src/contraction/contraction_solution_params_impl.hpp @@ -35,9 +35,9 @@ namespace std { template <> - struct std::hash + struct hash { - std::size_t operator()(hiptensor::ContractionSolutionParams const& s) const noexcept + size_t operator()(hiptensor::ContractionSolutionParams const& s) const noexcept { return hiptensor::Hash{}(s.dimsM(), s.dimsN(), From c18335a1e81d0829f873d89c1a9b03544aed3c22 Mon Sep 17 00:00:00 2001 From: Bence Parajdi Date: Tue, 12 Dec 2023 16:44:55 +0100 Subject: [PATCH 2/4] update doxyfile --- docs/.doxygen/Doxyfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/.doxygen/Doxyfile b/docs/.doxygen/Doxyfile index 59a973b7..136d3b8c 100644 --- a/docs/.doxygen/Doxyfile +++ b/docs/.doxygen/Doxyfile @@ -2074,7 +2074,8 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = __device__ +PREDEFINED = __device__ \ + DOXYGEN_SHOULD_SKIP_THIS # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The From b03e4f3bdfd595f5341d9da8226d9ac0b8e64b1c Mon Sep 17 00:00:00 2001 From: Bence Parajdi Date: Wed, 13 Dec 2023 09:57:07 +0100 Subject: [PATCH 3/4] remove type traits, that sneaked back during rebase --- .../hiptensor/internal/type_traits.hpp | 60 ------------------- 1 file changed, 60 deletions(-) diff --git a/library/include/hiptensor/internal/type_traits.hpp b/library/include/hiptensor/internal/type_traits.hpp index 7735a5c4..d1329498 100644 --- a/library/include/hiptensor/internal/type_traits.hpp +++ b/library/include/hiptensor/internal/type_traits.hpp @@ -271,66 +271,6 @@ namespace std hiptensor::detail::Fp16Bits eps(static_cast(0x7FC0)); return eps.b16; } - - /////////////////////////////////////////////////////////// - /////////// std::numeric_limits ////////////// - /////////////////////////////////////////////////////////// - - template <> - HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t - numeric_limits::epsilon() noexcept - { - hiptensor::detail::Fp32Bits eps(static_cast(FLT_EPSILON)); - return eps.xf32; - } - - template <> - HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t - numeric_limits::infinity() noexcept - { - hiptensor::detail::Fp32Bits eps(static_cast(HUGE_VALF)); - return eps.xf32; - } - - template <> - HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t - numeric_limits::lowest() noexcept - { - hiptensor::detail::Fp32Bits eps(static_cast(-FLT_MAX)); - return eps.xf32; - } - - template <> - HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t - numeric_limits::max() noexcept - { - hiptensor::detail::Fp32Bits eps(static_cast(FLT_MAX)); - return eps.xf32; - } - - template <> - HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t - numeric_limits::min() noexcept - { - hiptensor::detail::Fp32Bits eps(static_cast(FLT_MIN)); - return eps.xf32; - } - - template <> - HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t - numeric_limits::quiet_NaN() noexcept - { - hiptensor::detail::Fp32Bits eps(static_cast(0x7FF80000)); - return eps.xf32; - } - - template <> - HIPTENSOR_HOST_DEVICE constexpr hiptensor::xfloat32_t - numeric_limits::signaling_NaN() noexcept - { - hiptensor::detail::Fp32Bits eps(static_cast(0x7FF00000)); - return eps.xf32; - } #endif // DOXYGEN_SHOULD_SKIP_THIS // @endcond } // namespace std From ded69b930ac83a2126061f71d7dcda6ae2c6d6a7 Mon Sep 17 00:00:00 2001 From: Bence Parajdi Date: Thu, 14 Dec 2023 09:30:28 +0100 Subject: [PATCH 4/4] remove unnecessary endcond --- library/include/hiptensor/internal/type_traits.hpp | 1 - 1 file changed, 1 deletion(-) diff --git a/library/include/hiptensor/internal/type_traits.hpp b/library/include/hiptensor/internal/type_traits.hpp index d1329498..81bafacd 100644 --- a/library/include/hiptensor/internal/type_traits.hpp +++ b/library/include/hiptensor/internal/type_traits.hpp @@ -272,7 +272,6 @@ namespace std return eps.b16; } #endif // DOXYGEN_SHOULD_SKIP_THIS - // @endcond } // namespace std namespace hiptensor