Unverified Commit e4bc095e authored by turneram's avatar turneram Committed by GitHub
Browse files

Half v2plus (#731)



* Added initial examples

* Added python example from wiki

* Edited readme

* Added cpp interface files

* Made changes to readmes

* Added jupyter notebook for tf2 ex, added readme for tf1 ex

* Added dockerfile

* Re-structured driver example

* Removed unnecessary files

* Changed include path

* Removed cpp_interface to rewrite

* Added example of parsing, loading, saving with C++ API

* Updated readme

* Small code change, altered docker invocation, formatiing

* Formatting

* Added newline to end of dockerfile

* Formatting

* Formatting

* Added C++ API inference example program

* Formatting

* Added README to cpp inference example

* DeepCode suggested changed

* DeepCode suggested change

* Redesign python inference example

* Address review comments

* Address review comments

* Address review comments

* Added check for half version; conditionally ignore struct specialized for deprecated type

* Moved new block after find_package(ROCM)

* Rename HAVE_EXPR to HAVE_HALF_EXPR; relocated definitions
Co-authored-by: default avatarPaul Fultz II <pfultz2@yahoo.com>
Co-authored-by: default avatarmvermeulen <5479696+mvermeulen@users.noreply.github.com>
parent 37dc0327
......@@ -19,6 +19,19 @@ endif()
project(migraphx)
find_package(ROCM REQUIRED)
find_path(HALF_INCLUDE_DIR half.hpp PATH_SUFFIXES half)
if (NOT HALF_INCLUDE_DIR)
message(FATAL_ERROR "Could not find half.hpp - Please check that the install path of half.hpp has been added to CMAKE_PREFIX_PATH")
endif()
include(CheckTypeSize)
set(CMAKE_REQUIRED_INCLUDES ${HALF_INCLUDE_DIR})
set(CMAKE_EXTRA_INCLUDE_FILES half.hpp)
check_type_size("half_float::detail::expr" HALF_EXPR LANGUAGE CXX)
set(CMAKE_REQUIRED_INCLUDES)
set(CMAKE_EXTRA_INCLUDE_FILES)
find_package(nlohmann_json 3.8.0 REQUIRED)
include(ROCMSetupVersion)
......
......@@ -163,9 +163,6 @@ if(HAS_LIB_STD_FILESYSTEM)
target_link_libraries(migraphx PRIVATE -lstdc++fs)
endif()
find_path(HALF_INCLUDE_DIR half.hpp)
# TODO: Fix the incorrect path
target_include_directories(migraphx SYSTEM PUBLIC $<BUILD_INTERFACE:${HALF_INCLUDE_DIR}>)
find_package(msgpack REQUIRED)
......@@ -197,6 +194,10 @@ target_link_libraries(migraphx_all_targets INTERFACE migraphx_gpu)
target_compile_definitions(migraphx_all_targets INTERFACE -DHAVE_GPU)
endif()
if(HAVE_HALF_EXPR)
target_compile_definitions(migraphx PUBLIC -DHAS_HALF_V1)
endif()
rocm_export_targets(
TARGETS migraphx::migraphx migraphx_all_targets
NAMESPACE migraphx::
......
......@@ -23,11 +23,13 @@ struct deduce
using type = T;
};
#ifdef HAS_HALF_V1
template <>
struct deduce<half_float::detail::expr>
{
using type = half;
};
#endif
} // namespace detail
template <class T>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment