Skip to content

Commit

Permalink
Merge branch 'develop' into hipblaslt-compile
Browse files Browse the repository at this point in the history
  • Loading branch information
ahsan-ca authored Nov 14, 2024
2 parents 75ee1bc + b39a938 commit 250258e
Show file tree
Hide file tree
Showing 36 changed files with 2,295 additions and 292 deletions.
2 changes: 2 additions & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,5 @@ CheckOptions:
value: UPPER_CASE
- key: readability-identifier-naming.MacroDefinitionPrefix
value: MIGRAPHX_
- key: readability-identifier-naming.ConstexprMethodIgnoredRegexp
value: 'quiet_NaN|signaling_NaN'
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ rocm_enable_clang_tidy(
-bugprone-multi-level-implicit-pointer-conversion
-bugprone-signed-char-misuse
-bugprone-unchecked-optional-access
-bugprone-unused-local-non-trivial-variable
# Disable the aliased reserved identifiers
-cert-dcl37-c
-cert-dcl51-cpp
Expand Down
2 changes: 1 addition & 1 deletion docs/install/installing_with_package.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ ROCm must be installed before installing MIGraphX. See `ROCm installation for Li

Installing MIGraphX using the package installer is sufficient for users who want to use the MIGraphX API.

If you want to develop for MIGraphX and contribute to the source code, see `Building MIGraphX <https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/install/docs/install/building_migraphx.html>`_ and `Developing for MIGraphX <https://rocm.docs.amd.com/projects/AMDMIGraphX/en/latest/dev/contributing-to-migraphx.html>`_
If you want to develop for MIGraphX and contribute to the source code, see :doc:`Building MIGraphX </install/building_migraphx>` and :doc:`Developing for MIGraphX <../dev/contributing-to-migraphx>`.

The package installer will install all the prerequisites needed for MIGraphX.

Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ pybind/pybind11@3e9dfa2866941655c56877882565e7577de6fc7b --build
msgpack/[email protected] -DMSGPACK_BUILD_TESTS=Off
sqlite3@3.43.2 -DCMAKE_POSITION_INDEPENDENT_CODE=On
ROCm/composable_kernel@57cdd70b7cb14e5e3b60cd9a5f96ba8dc343763e -DCK_BUILD_JIT_LIB=On -DCMAKE_POSITION_INDEPENDENT_CODE=On
ROCm/rocMLIR@e454b5d06fc2f099f7de3ee43450e7a6b1efe015 -DBUILD_FAT_LIBROCKCOMPILER=On
ROCm/rocMLIR@99fc9d24714ee7eae75ef8e414df4f2dacd3af16 -DBUILD_FAT_LIBROCKCOMPILER=On
5 changes: 3 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ add_library(migraphx
insert_pad.cpp
instruction.cpp
json.cpp
layout_nhwc.cpp
layout_convolution.cpp
lexing.cpp
load_save.cpp
make_op.cpp
Expand All @@ -89,7 +89,6 @@ add_library(migraphx
propagate_constant.cpp
promote_literals.cpp
quantization.cpp
quantize_fp16.cpp
quantize_int4.cpp
quantize_8bits.cpp
reduce_dims.cpp
Expand All @@ -115,13 +114,15 @@ add_library(migraphx
split_single_dyn_dim.cpp
target.cpp
tmp_dir.cpp
truncate_float.cpp
value.cpp
verify_args.cpp
)

if(WIN32)
# Due to compilation crashing, we need to use type-erased matchers on Windows.
target_compile_definitions(migraphx PUBLIC MIGRAPHX_USE_TYPE_ERASED_MATCHERS=1)
target_compile_options(migraphx PUBLIC "-mno-ms-bitfields")
endif()

configure_file(version.h.in include/migraphx/version.h)
Expand Down
1 change: 1 addition & 0 deletions src/include/migraphx/bit_cast.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Wduplicated-branches"
#endif

#include <migraphx/requires.hpp>
Expand Down
108 changes: 65 additions & 43 deletions src/include/migraphx/float8.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <migraphx/config.hpp>
#include <migraphx/functional.hpp>
#include <migraphx/float8_impl.hpp>
#include <migraphx/generic_float.hpp>

namespace migraphx {
inline namespace MIGRAPHX_INLINE_NS {
Expand Down Expand Up @@ -379,52 +380,73 @@ class numeric_limits<fp8e5m2>

// =================================================================================================
// define numeric limits for the new data type
// NOLINTBEGIN
// NOLINTBEGIN(cert-dcl58-cpp)
namespace std {
#define MIGRAPHX_FP8_STD_OVERLOADS(T) \
inline bool isfinite(T x) { return not x.is_inf() and not x.is_nan(); } \
inline bool isnan(T x) { return x.is_nan(); } \
template <> \
class numeric_limits<T> : public migraphx::fp8::numeric_limits<T> \
{ \
}; \
template <class U> \
struct common_type<T, U> : std::common_type<float, U> \
{ \
}; \
template <class U> \
struct common_type<U, T> : std::common_type<U, float> \
{ \
}; \
template <> \
struct common_type<T, T> \
{ \
using type = T; \
};

MIGRAPHX_FP8_STD_OVERLOADS(migraphx::fp8::fp8e4m3fn)
MIGRAPHX_FP8_STD_OVERLOADS(migraphx::fp8::fp8e5m2)
MIGRAPHX_FP8_STD_OVERLOADS(migraphx::fp8::fp8e4m3fnuz)
MIGRAPHX_FP8_STD_OVERLOADS(migraphx::fp8::fp8e5m2fnuz)

// needed to resolve between multiple ambiguous definition from previous templates
#define MIGRAPHX_FP8_COMMON_TYPE_OVERLOAD_RESOLUTION(T, U) \
template <> \
struct common_type<T, U> : std::common_type<float, float> \
{ \
}; \
template <> \
struct common_type<U, T> : std::common_type<float, float> \
{ \
};
template <migraphx::fp8::f8_type T, bool FNUZ>
inline bool isfinite(migraphx::fp8::float8<T, FNUZ> x)
{
return not x.is_inf() and not x.is_nan();
}

template <migraphx::fp8::f8_type T, bool FNUZ>
inline bool isnan(migraphx::fp8::float8<T, FNUZ> x)
{
return x.is_nan();
}

template <migraphx::fp8::f8_type T, bool FNUZ>
class numeric_limits<migraphx::fp8::float8<T, FNUZ>>
: public migraphx::fp8::numeric_limits<migraphx::fp8::float8<T, FNUZ>>
{
};
template <migraphx::fp8::f8_type T, bool FNUZ, class U>
struct common_type<migraphx::fp8::float8<T, FNUZ>, U> : std::common_type<float, U>
{
};
template <migraphx::fp8::f8_type T, bool FNUZ, class U>
struct common_type<U, migraphx::fp8::float8<T, FNUZ>> : std::common_type<U, float>
{
};
template <migraphx::fp8::f8_type T, bool FNUZ>
struct common_type<migraphx::fp8::float8<T, FNUZ>, migraphx::fp8::float8<T, FNUZ>>
{
using type = migraphx::fp8::float8<T, FNUZ>;
};

template <migraphx::fp8::f8_type T1, bool FNUZ1, migraphx::fp8::f8_type T2, bool FNUZ2>
struct common_type<migraphx::fp8::float8<T1, FNUZ1>, migraphx::fp8::float8<T2, FNUZ2>>
{
using type = float;
};

template <unsigned int E, unsigned int M, unsigned int F, bool FNUZ>
struct common_type<migraphx::generic_float<E, M, F>,
migraphx::fp8::float8<migraphx::fp8::f8_type::fp8, FNUZ>>
{
using type = float;
};

template <unsigned int E, unsigned int M, unsigned int F, bool FNUZ>
struct common_type<migraphx::fp8::float8<migraphx::fp8::f8_type::fp8, FNUZ>,
migraphx::generic_float<E, M, F>>
{
using type = float;
};

template <unsigned int E, unsigned int M, unsigned int F, migraphx::fp8::f8_type T, bool FNUZ>
struct common_type<migraphx::generic_float<E, M, F>, migraphx::fp8::float8<T, FNUZ>>
: std::common_type<float, float>
{
};

template <unsigned int E, unsigned int M, unsigned int F, migraphx::fp8::f8_type T, bool FNUZ>
struct common_type<migraphx::fp8::float8<T, FNUZ>, migraphx::generic_float<E, M, F>>
: std::common_type<float, float>
{
};

MIGRAPHX_FP8_COMMON_TYPE_OVERLOAD_RESOLUTION(migraphx::fp8::fp8e4m3fn, migraphx::fp8::fp8e5m2)
MIGRAPHX_FP8_COMMON_TYPE_OVERLOAD_RESOLUTION(migraphx::fp8::fp8e4m3fn, migraphx::fp8::fp8e4m3fnuz)
MIGRAPHX_FP8_COMMON_TYPE_OVERLOAD_RESOLUTION(migraphx::fp8::fp8e4m3fn, migraphx::fp8::fp8e5m2fnuz)
MIGRAPHX_FP8_COMMON_TYPE_OVERLOAD_RESOLUTION(migraphx::fp8::fp8e5m2, migraphx::fp8::fp8e4m3fnuz)
MIGRAPHX_FP8_COMMON_TYPE_OVERLOAD_RESOLUTION(migraphx::fp8::fp8e5m2, migraphx::fp8::fp8e5m2fnuz)
MIGRAPHX_FP8_COMMON_TYPE_OVERLOAD_RESOLUTION(migraphx::fp8::fp8e4m3fnuz, migraphx::fp8::fp8e5m2fnuz)
} // namespace std
// NOLINTEND
// NOLINTEND(cert-dcl58-cpp)
// =================================================================================================
#endif // MIGRAPHX_GUARD_RTGLIB_FLOAT8_HPP
Loading

0 comments on commit 250258e

Please sign in to comment.