diff --git a/CMakeLists.txt b/CMakeLists.txt index ba7f05e30..70cdc18f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,15 @@ # Copyright (c) 2015 - 2020 Advanced Micro Devices, Inc. All rights reserved. -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -190,18 +190,6 @@ find_package(OpenCL REQUIRED) # OpenCL_INCLUDE_DIRS, OpenCL_LIBRARIES set( MODULES_LIST modules) -# look for and register extractkernel -find_program(EXTRACTKERNEL_BIN extractkernel - PATH_SUFFIXES bin - PATHS ${ROCM_PATH} -) -if(EXTRACTKERNEL_BIN) - message(STATUS "${Green}extractkernel found: ${EXTRACTKERNEL_BIN}${ColourReset}") - set(EXTRACTKERNEL_BIN "${EXTRACTKERNEL_BIN}") -else() - message(FATAL_ERROR "${Red}extractkernel not found${ColourReset}") -endif() - foreach (MOD_NAME ${MODULES_LIST}) add_subdirectory(${CMAKE_SOURCE_DIR}/src/${MOD_NAME}) endforeach(MOD_NAME) diff --git a/Readme.md b/Readme.md index f51cbeacd..d75ec1fda 100644 --- a/Readme.md +++ b/Readme.md @@ -21,16 +21,41 @@ RPP is developed for **Linux** operating system. - [ROCm](https://github.com/RadeonOpenCompute/ROCm#installing-from-amd-rocm-repositories) +- Clang Version `6.0` + + sudo apt-get install clang-6.0 + sudo ln -s /usr/bin/clang-6.0 /usr/bin/clang + sudo ln -s /usr/bin/clang++-6.0 /usr/bin/clang++ + - CMake Version `3.5` or higher -- Boost Version `1.72` or higher (install from source - ) + sudo apt-get install cmake + +- Boost Version `1.72` (install from source: Easy Build and Install - ) + + wget https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz + tar -xzvf boost_1_72_0.tar.gz + cd boost_1_72_0 + ./bootstrap.sh + ./b2 install - IEEE 754-based half-precision floating-point library - half.hpp - ``` + wget https://sourceforge.net/projects/half/files/half/1.12.0/half-1.12.0.zip unzip half-1.12.0.zip -d half-files sudo cp half-files/include/half.hpp /usr/local/include/ - ``` + +## Prerequisites for Test Suite +- OpenCV 3.4.0 + + wget https://github.com/opencv/opencv/archive/3.4.0.zip + unzip 3.4.0.zip + cd opencv-3.4.0/ + mkdir build + cd build + cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. + make -j + sudo make install ## Supported Functionalities and Variants diff --git a/src/modules/cl/hip_build_utils.cpp b/src/modules/cl/hip_build_utils.cpp index 95e1ea910..611332cca 100644 --- a/src/modules/cl/hip_build_utils.cpp +++ b/src/modules/cl/hip_build_utils.cpp @@ -66,8 +66,6 @@ boost::filesystem::path HipBuild(boost::optional& tmp_dir, params + filename + " -o " + bin_file.string()); if(!boost::filesystem::exists(bin_file)) RPP_THROW(filename + " failed to compile"); - // call extract kernel - tmp_dir->Execute("/opt/rocm/bin/extractkernel", " -i " + bin_file.string()); auto hsaco = std::find_if(boost::filesystem::directory_iterator{tmp_dir->path}, {}, [](auto entry) { return (entry.path().extension() == ".hsaco"); }); diff --git a/src/modules/hip/CMakeLists.txt b/src/modules/hip/CMakeLists.txt index 6def3fa97..c2099d774 100644 --- a/src/modules/hip/CMakeLists.txt +++ b/src/modules/hip/CMakeLists.txt @@ -25,8 +25,6 @@ endif() # add_definitions(-DRPP_BACKEND_HIP) add_definitions( -DHIP_OC_COMPILER=${HIP_OC_COMPILER}) - add_definitions(-DEXTRACTKERNEL_BIN=${EXTRACTKERNEL_BIN}) - set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries (${PROJECT_NAME} ${OpenCL_LIBRARIES} ) target_include_directories( ${PROJECT_NAME} diff --git "a/src/modules/hip/\\" "b/src/modules/hip/\\" deleted file mode 100644 index dd3ca3f62..000000000 --- "a/src/modules/hip/\\" +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* -* -* MIT License -* -* Copyright (c) 2019 Advanced Micro Devices, Inc. -* -* Permission is hereby granted, free of charge, to any person obtaining a copy -* of this software and associated documentation files (the "Software"), to deal -* in the Software without restriction, including without limitation the rights -* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -* copies of the Software, and to permit persons to whom the Software is -* furnished to do so, subject to the following conditions: -* -* The above copyright notice and this permission notice shall be included in all -* copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -* SOFTWARE. -* -*******************************************************************************/ - -#include -#include -#include -#include - -#define RPP_STRINGIZE_1(...) #__VA_ARGS__ -#define RPP_STRINGIZE(...) RPP_STRINGIZE_1(__VA_ARGS__) - -namespace rpp { - -boost::filesystem::path HipBuild(boost::optional& tmp_dir, - const std::string& filename, - std::string src, - std::string params, - const std::string& dev_name) -{ -#ifdef __linux__ - if(dev_name.find("gfx80") != std::string::npos) - RPP_THROW("HIP kernel are not supported on " + dev_name + " architecture"); - // write out the include files - auto inc_list = GetKernelIncList(); - auto inc_path = tmp_dir->path; - boost::filesystem::create_directories(inc_path); - for(auto inc_file : inc_list) - { - auto inc_src = GetKernelInc(inc_file); - WriteFile(inc_src, inc_path / inc_file); - } - src += "\nint main() {}\n"; - WriteFile(src, tmp_dir->path / filename); - params += " -amdgpu-target=" + dev_name; - // params += " -Wno-unused-command-line-argument -c -fno-gpu-rdc -I. "; - params += " -Wno-unused-command-line-argument -I. "; - params += RPP_STRINGIZE(HIP_COMPILER_FLAGS); - params += " "; - auto bin_file = tmp_dir->path / (filename + ".o"); - // compile with hcc - auto env = std::string("KMOPTLLC=-mattr=+enable-ds128"); - tmp_dir->Execute(env + std::string(" ") + HIP_COMPILER, - params + filename + " -o " + bin_file.string()); - if(!boost::filesystem::exists(bin_file)) - RPP_THROW(filename + " failed to compile"); - // call extract kernel - tmp_dir->Execute(EXTRACTKERNEL_BIN, " -i " + bin_file.string()); - auto hsaco = std::find_if(boost::filesystem::directory_iterator{tmp_dir->path}, - {}, - [](auto entry) { return (entry.path().extension() == ".hsaco"); }); - - if(hsaco == boost::filesystem::directory_iterator{}) - { - RPP_LOG_E("failed to find *.hsaco in " << hsaco->path().string()); - } - - return hsaco->path(); -#else - (void)filename; - (void)params; - RPP_THROW("HIP kernels are only supported in Linux"); -#endif -} - -void bin_file_to_str(const boost::filesystem::path& file, std::string& buf) -{ - std::ifstream bin_file_ptr(file.string().c_str(), std::ios::binary); - std::ostringstream bin_file_strm; - bin_file_strm << bin_file_ptr.rdbuf(); - buf = bin_file_strm.str(); -} -} // namespace rpp diff --git a/src/modules/hip/hip_build_utils.cpp b/src/modules/hip/hip_build_utils.cpp index 7324db80a..65f344839 100644 --- a/src/modules/hip/hip_build_utils.cpp +++ b/src/modules/hip/hip_build_utils.cpp @@ -66,8 +66,6 @@ boost::filesystem::path HipBuild(boost::optional& tmp_dir, params + filename + " -o " + bin_file.string()); if(!boost::filesystem::exists(bin_file)) RPP_THROW(filename + " failed to compile"); - // call extract kernel - tmp_dir->Execute("/opt/rocm/bin/extractkernel", " -i " + bin_file.string()); auto hsaco = std::find_if(boost::filesystem::directory_iterator{tmp_dir->path}, {}, [](auto entry) { return (entry.path().extension() == ".hsaco"); });