Skip to content

Commit

Permalink
Perf DB cleanup + Fin pdb verification fix (#1810)
Browse files Browse the repository at this point in the history
* remove datatype 0,1 from perf_db

* rm invalid fp16 entries from pdb

* Squashed 'fin/' changes from 53d2563fe..e05dcb421

e05dcb421 perf db validation fix (#68)
260d9465d Add INT8 as a data_type v2 (#67)
b6a5b2a77 sync with fin folder in miopen (#62)
0e03399ec prep for Palamida scan (#63)
e6bd05c33 Performance db testing (#61)
30d699b9e Perf Eval Update (#60)
3535b948c PerfCompile and PerfEval changes (#59)
de79468d2 remove unneccessary solution check, add check for previously modified kernel names (#56)
6924286a2 miopen hash update (#55)
530399575 Refactor googletest infra to align with MIOpen (#53)
71c50d146 Datatype fix for BN (#57)
8abe2f5c6 Perf Eval updates, Add find info (#51)
e1c1ef0f5 filter find compile by solver input (#54)
722feea66 sp/chk precomp kernel 264 (#41)
b9aba2034 Batch norm find compile (#50)
359f3da80 Fix missing link directives in fin binary (#48)
a4020c1ba Cache Miss Fixes (#46)
2ec7ef44d Enable google test and compiling fin in the CI (#47)
8b6b453bc Applicability support for batch norm (#45)
44323aae9 Perf compile/eval for fin (#42)
ebd9aa6bd update member name (#43)
d6d798efe add cu count (#39)
8e1989a9f Add find option for selecting only dynamic solvers (#38)
0e164bf66 setting json version (#37)
f3f7fed18 Remove function redefinition (#36)
e1de51a58 Performance DB de-serialize test (#34)
043cdcdaa Layout support in Fin (#33)
3a1d58236 Hotfix (#32)
ee3f0d543 4.4 Tuning Bugfixes (#31)
832dbe234 Tunability Reporting (#27)
a564a229f include gfx90a_110 (#28)

git-subtree-dir: fin
git-subtree-split: e05dcb42187f05fe0d0d1b05b822dc4b750f199e

* fix clang-format issue

Co-authored-by: Jun Liu <[email protected]>
  • Loading branch information
cderb and junliume authored Oct 6, 2022
1 parent 585c960 commit e7d3c60
Show file tree
Hide file tree
Showing 20 changed files with 307 additions and 117 deletions.
58 changes: 32 additions & 26 deletions fin/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

ARG PREFIX=/opt/rocm

# Support multiarch
RUN dpkg --add-architecture i386

# Add rocm repository
RUN apt-get update
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl apt-utils wget gnupg2

#RUN curl https://raw.githubusercontent.com/RadeonOpenCompute/ROCm-docker/master/add-rocm.sh | bash
ARG ROCMVERSION=4.5
#install rocm
ARG ROCMVERSION=5.1
ARG OSDB_BKC_VERSION
ARG DEB_ROCM_REPO=http://repo.radeon.com/rocm/apt/.apt_$ROCMVERSION/
# Add rocm repository
RUN apt-get update
RUN apt-get install -y wget gnupg
RUN wget -qO - http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add -
RUN sh -c "echo deb [arch=amd64] $DEB_ROCM_REPO ubuntu main > /etc/apt/sources.list.d/rocm.list"
RUN if ! [ -z $OSDB_BKC_VERSION ]; then \
echo "Using BKC VERISION: $OSDB_BKC_VERSION";\
sh -c "echo deb [arch=amd64 trusted=yes] http://compute-artifactory.amd.com/artifactory/list/rocm-osdb-20.04-deb/ compute-rocm-dkms-no-npi-hipclang ${OSDB_BKC_VERSION} > /etc/apt/sources.list.d/rocm.list" ;\
cat /etc/apt/sources.list.d/rocm.list;\
else \
sh -c "echo deb [arch=amd64] $DEB_ROCM_REPO ubuntu main > /etc/apt/sources.list.d/rocm.list" ;\
fi


# Install dependencies required to build hcc
# Ubuntu csomic contains llvm-7 required to build Tensile
RUN sh -c "echo deb http://mirrors.kernel.org/ubuntu xenial main universe | tee -a /etc/apt/sources.list"
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -f -y --allow-unauthenticated \
apt-utils \
build-essential \
clang-3.9 \
clang-format-3.9 \
clang-tidy-3.9 \
clang \
clang-format \
clang-tidy \
cmake \
comgr \
curl \
Expand All @@ -41,17 +49,16 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-
libnuma-dev \
libunwind-dev \
nsis \
python \
python-dev \
python-pip \
software-properties-common \
libboost-all-dev \
llvm-7 \
pkg-config \
python3 \
python3-distutils \
python3-venv \
python-yaml \
python3-dev \
python3-pip \
python3-yaml \
cppcheck \
rocm-dev \
rocm-opencl \
Expand Down Expand Up @@ -81,30 +88,29 @@ ARG MIOPEN_DIR=/root/dMIOpen
#Clone MIOpen
RUN git clone https://github.com/ROCmSoftwarePlatform/MIOpen.git $MIOPEN_DIR
WORKDIR $MIOPEN_DIR
ARG MIOPEN_BRANCH=develop
RUN git pull && git checkout $MIOPEN_BRANCH

ARG MIOPEN_DEPS=$MIOPEN_DIR/cget
# Install dependencies
RUN wget --no-check-certificate -qO - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -
RUN sh -c "echo deb https://apt.kitware.com/ubuntu/ bionic main | tee -a /etc/apt/sources.list"
RUN apt-get update && apt-get install -y --allow-unauthenticated cmake-data=3.15.1-0kitware1 cmake=3.15.1-0kitware1
RUN cget install pfultz2/rocm-recipes
RUN cget install -f min-requirements.txt
RUN CXXFLAGS='-isystem $PREFIX/include' cget install -f ./mlir-requirements.txt
ARG MIOPEN_DEPS=$MIOPEN_DIR/cget
#issue with upstream for composable kernel install
RUN sed -i "s#[^\n]*composable_kernel[^\n]*##g" requirements.txt
RUN cmake -P install_deps.cmake --minimum

ARG TUNA_USER=miopenpdb
ARG BACKEND=HIP
# Build MIOpen
WORKDIR $MIOPEN_DIR/build
ARG MIOPEN_BRANCH=05169b091cf3d0b752c94ba51d63f7af6463d731
ARG MIOPEN_CACHE_DIR=/tmp/${TUNA_USER}/cache
ARG MIOPEN_USER_DB_PATH=/tmp/$TUNA_USER/config/miopen
ARG MIOPEN_USE_MLIR=On
RUN git pull && git checkout $MIOPEN_BRANCH
ARG MIOPEN_CMAKE_ARGS="-DMIOPEN_USE_COMGR=Off -DMIOPEN_USE_MLIR=${MIOPEN_USE_MLIR} -DMIOPEN_INSTALL_CXX_HEADERS=On -DMIOPEN_CACHE_DIR=${MIOPEN_CACHE_DIR} -DMIOPEN_USER_DB_PATH=${MIOPEN_USER_DB_PATH} -DMIOPEN_BACKEND=${BACKEND} -DCMAKE_PREFIX_PATH=${MIOPEN_DEPS} -DMIOPEN_USE_COMPOSABLEKERNEL=Off -DUSE_FIN=Off"

RUN echo "MIOPEN: Selected $BACKEND backend."
RUN if [ $BACKEND = "OpenCL" ]; then \
cmake -DMIOPEN_INSTALL_CXX_HEADERS=On -DMIOPEN_INSTALL_CXX_HEADERS=On -DMIOPEN_USE_COMGR=Off -DMIOPEN_USE_MLIR=${MIOPEN_USE_MLIR} -DMIOPEN_CACHE_DIR=${MIOPEN_CACHE_DIR} -DMIOPEN_USER_DB_PATH={MIOPEN_USER_DB_PATH} -DMIOPEN_BACKEND=OpenCL -DMIOPEN_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ -DCMAKE_PREFIX_PATH="$MIOPEN_DEPS" $MIOPEN_DIR ; \
cmake -DMIOPEN_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ ${MIOPEN_CMAKE_ARGS} $MIOPEN_DIR ; \
else \
CXX=/opt/rocm/llvm/bin/clang++ cmake -DMIOPEN_INSTALL_CXX_HEADERS=On -DMIOPEN_USE_COMGR=Off -DMIOPEN_USE_MLIR=${MIOPEN_USE_MLIR} -DMIOPEN_INSTALL_CXX_HEADERS=On -DMIOPEN_CACHE_DIR=${MIOPEN_CACHE_DIR} -DMIOPEN_USER_DB_PATH=${MIOPEN_USER_DB_PATH} -DMIOPEN_BACKEND=$BACKEND -DCMAKE_PREFIX_PATH=$MIOPEN_DEPS $MIOPEN_DIR ; \
CXX=/opt/rocm/llvm/bin/clang++ cmake ${MIOPEN_CMAKE_ARGS} $MIOPEN_DIR ; \
fi

RUN make -j $(nproc)
Expand Down
6 changes: 3 additions & 3 deletions fin/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,10 @@ pipeline {
-o -iname \'*.cl\' \
| grep -v 'build/' \
| grep -v 'base64' \
| xargs -n 1 -P 1 -I{} -t sh -c \'clang-format-3.9 -style=file {} | diff - {}\'"
| xargs -n 1 -P 1 -I{} -t sh -c \'clang-format -style=file {} | diff - {}\'"
}
steps{
buildJob('clang++-3.9', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
buildJob('clang++', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
}
}

Expand Down Expand Up @@ -167,7 +167,7 @@ pipeline {
mkdir build; \
cd build; \
CXX=/opt/rocm/llvm/bin/clang++ cmake -DBUILD_DEV=On -DCMAKE_PREFIX_PATH=/root/dMIOpen/cget ..; \
make -j\$(nproc) check;"
make -j\$(nproc) fin_check;"
}
steps{
buildJob('clang++', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
Expand Down
27 changes: 27 additions & 0 deletions fin/src/fin.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
/*******************************************************************************
*
* MIT License
*
* Copyright (c) 2022 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 "fin.hpp"

namespace fin {
Expand Down Expand Up @@ -57,6 +83,7 @@ std::string BaseFin::ParseBaseArg(const int argc, const char* argv[])
else
return arg;
}
// cppcheck-suppress constParameter
void BaseFin::InitNoGpuHandle(miopen::Handle& handle,
const std::string& arch,
const unsigned long num_cu)
Expand Down
10 changes: 5 additions & 5 deletions fin/src/include/bn_fin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ int BNFin<Tgpu, Tref>::TestApplicability()
#endif

auto& handle = GetHandle();
auto ctx = miopen::ExecutionContext(&handle);
// cppcheck-suppress unreadVariable
auto ctx = miopen::ExecutionContext(&handle);
#if MIOPEN_MODE_NOGPU
BaseFin::InitNoGpuHandle(handle, job["arch"], job["num_cu"]);
#else
Expand Down Expand Up @@ -390,7 +391,8 @@ int BNFin<Tgpu, Tref>::MIOpenFindCompile()
"Unable to perform MIOpenFindCompile MIOpen was not compiled using HIPNOGPU backend");
#endif
auto& handle = GetHandle();
auto ctx = miopen::ExecutionContext(&handle);
// cppcheck-suppress unreadVariable
auto ctx = miopen::ExecutionContext(&handle);
GetHandle().EnableProfiling(true);
#if MIOPEN_MODE_NOGPU
BaseFin::InitNoGpuHandle(handle, job["arch"], job["num_cu"]);
Expand Down Expand Up @@ -423,10 +425,8 @@ int BNFin<Tgpu, Tref>::MIOpenFindCompile()

res_item["workspace"] = sln.workspace_sz;
std::vector<miopen::solver::KernelInfo> kernels;
for(auto&& kernel : sln.construction_params)
{
for(auto&& kernel : sln.construction_params) // cppcheck-suppress useStlAlgorithm
kernels.push_back(kernel);
}
std::ignore = miopen::solver::PrecompileKernels(handle, kernels);
json kernel_list = json::array();
for(const auto& k : kernels)
Expand Down
Loading

0 comments on commit e7d3c60

Please sign in to comment.