Skip to content

Commit

Permalink
Squashed 'fin/' changes from 53d2563fe..49e3e3a62
Browse files Browse the repository at this point in the history
49e3e3a62 clang format
db80b1777 update to using TestPerfCfgParams for pdb validity checks
e48a4fd3a format
a4f85842c exception for non-tunable solvers in params check
d58c42bbd Check params at end of perf tuning (#70)
1a3b47c7b Return status for failed compile commands (#69)
d59962752 out_layout -> in_layout
6ba7a8f3f Rename conv_mode to mode (#64)
513a3da1b [bg/LWPTUNA-173] (#65)
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: 49e3e3a62a7cc54adacbeea95680d35f9a4685de
  • Loading branch information
cderb committed Nov 21, 2022
1 parent 8e0a630 commit 4042531
Show file tree
Hide file tree
Showing 40 changed files with 5,639 additions and 1,290 deletions.
31 changes: 10 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,6 @@ else()
endif()

project ( fin C CXX )
option( BUILD_SHARED_LIBS "Build as a shared library" ON )
enable_testing()

find_package(ROCM REQUIRED PATHS /opt/rocm)

Expand All @@ -53,12 +51,6 @@ include(CheckCXXCompilerFlag)

option( BUILD_DEV "Build for development only" OFF)

# Strip symbols for release
if(NOT WIN32 AND NOT APPLE)
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -s")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -s")
endif()

rocm_setup_version(VERSION 1.0.0)

list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
Expand Down Expand Up @@ -100,15 +92,6 @@ set_property( CACHE FIN_BACKEND PROPERTY STRINGS

# HIP is always required
find_package(hip REQUIRED PATHS /opt/rocm)
find_package(rocblas REQUIRED PATHS /opt/rocm)
# probably not required
target_flags(HIP_COMPILER_FLAGS hip::device)
# Remove cuda arch flags
string(REGEX REPLACE --cuda-gpu-arch=[a-z0-9]+ "" HIP_COMPILER_FLAGS "${HIP_COMPILER_FLAGS}")

message(STATUS "Hip compiler flags: ${HIP_COMPILER_FLAGS}")

add_definitions("-DHIP_COMPILER_FLAGS=${HIP_COMPILER_FLAGS}")

# OpenCL 1.2
if( FIN_BACKEND STREQUAL "OpenCL")
Expand Down Expand Up @@ -194,7 +177,7 @@ set(CPACK_RPM_PACKAGE_REQUIRES "${MIOPEN_PACKAGE_REQS}, rocm-opencl-devel")
rocm_create_package(
NAME fin-${FIN_BACKEND}
DESCRIPTION "Fin MIOpen Driver"
MAINTAINER "Jehandad Khan <jehandad.khan@amd.com>"
MAINTAINER "Tuna Devs <dl.MITunaX@amd.com>"
LDCONFIG
# DEPENDS rocm-opencl rocm-utils hip-hcc tinygemm
)
Expand All @@ -208,6 +191,8 @@ elseif(FIN_BACKEND STREQUAL "HIP")
set(MIOPEN_TIDY_ERRORS ALL)
endif()

if(NOT MIOPEN_ENABLE_FIN)
message("MIOPEN_ENABLE_FIN is NOT SET")
include(ClangTidy)
enable_clang_tidy(
CHECKS
Expand Down Expand Up @@ -329,9 +314,13 @@ enable_cppcheck(
MIOPEN_USE_MIOPENGEMM=1
__linux__=1
)
else()
message("MIOPEN_ENABLE_FIN is SET")
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
find_package(miopen)
find_package(rocblas) #MIOpen depends on rocBlas
find_package(Threads REQUIRED)

add_subdirectory(src)
add_subdirectory(tests)
78 changes: 55 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,37 @@
FROM ubuntu:18.04
FROM ubuntu:20.04

ARG PREFIX=/usr/local
ARG PREFIX=/opt/rocm

# Support multiarch
RUN dpkg --add-architecture i386


#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 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
RUN apt-get install -y wget gnupg
RUN wget -qO - http://repo.radeon.com/rocm/rocm.gpg.key | apt-key add -
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 @@ -36,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 All @@ -69,21 +81,41 @@ RUN pip install https://github.com/pfultz2/cget/archive/57b3289000fcdb3b7e424c60
# Install rclone
RUN pip install https://github.com/pfultz2/rclone/archive/master.tar.gz

# Install hcc from ROCm 3.0
RUN rclone -b roc-3.0.x -c 286651a04d9c3a8e3052dd84b1822985498cd27d https://github.com/RadeonOpenCompute/hcc.git /hcc
RUN LDFLAGS=-fuse-ld=gold cget -p $PREFIX install hcc,/hcc && rm -rf /hcc

# Make sure /opt/rcom is in the paths
ENV PATH="/opt/rocm:${PATH}"
# Install MIOpen
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

# Install dependencies
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

# Build using hcc
RUN cget -p $PREFIX init --cxx $PREFIX/bin/hcc --std=c++14
ARG TUNA_USER=miopenpdb
ARG BACKEND=HIP
# Build MIOpen
WORKDIR $MIOPEN_DIR/build
ARG MIOPEN_CACHE_DIR=/tmp/${TUNA_USER}/cache
ARG MIOPEN_USER_DB_PATH=/tmp/$TUNA_USER/config/miopen
ARG MIOPEN_USE_MLIR=On
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_HIP_COMPILER=/opt/rocm/llvm/bin/clang++ ${MIOPEN_CMAKE_ARGS} $MIOPEN_DIR ; \
else \
CXX=/opt/rocm/llvm/bin/clang++ cmake ${MIOPEN_CMAKE_ARGS} $MIOPEN_DIR ; \
fi

RUN make -j $(nproc)
RUN make install

# Install dependencies
ADD requirements.txt /requirements.txt
RUN CXXFLAGS='-isystem $PREFIX/include' cget -p $PREFIX install -f /requirements.txt

# Install doc requirements
#ADD doc/requirements.txt /doc-requirements.txt
#RUN pip install -r /doc-requirements.txt

57 changes: 34 additions & 23 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ def rocmnode(name) {

def cmake_build(compiler, flags, prefixpath="/opt/rocm"){
def workspace_dir = pwd()
def vcache = "/var/jenkins/.cache/miopen/vcache"
def archive = (flags == '-DCMAKE_BUILD_TYPE=release')
def config_targets = "all" // "check doc MIOpenDriver"
def config_targets = "all"
def test_flags = "--disable-verification-cache"
def debug_flags = "-g -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined"
def compilerpath = ""
Expand All @@ -46,8 +45,8 @@ def cmake_build(compiler, flags, prefixpath="/opt/rocm"){
rm -rf build
mkdir build
cd build
CXX=${compilerpath} CXXFLAGS='-Werror' cmake ${configargs} -DMIOPEN_GPU_SYNC=On -DMIOPEN_TEST_FLAGS='${test_flags}' -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}' ${flags} ..
MIOPEN_DEBUG_CONV_IMPLICIT_GEMM_XDLOPS=1 CTEST_PARALLEL_LEVEL=4 MIOPEN_VERIFY_CACHE_PATH=${vcache} MIOPEN_CONV_PRECISE_ROCBLAS_TIMING=0 dumb-init make -j\$(nproc) ${config_targets}
CXX=${compilerpath} cmake ${configargs} ${flags} ..
dumb-init make -j\$(nproc) ${config_targets}
"""
echo cmd
sh cmd
Expand Down Expand Up @@ -110,26 +109,12 @@ pipeline {
parallelsAlwaysFailFast()
}
environment{
image = "miopen"
image = "fin"
}
stages{
// Run all static analysis tests
stage("Static checks"){
parallel{
stage('Clang Tidy') {
agent{ label rocmnode("rocmtest") }
environment{
cmd = "rm -rf build; \
mkdir build; \
cd build; \
CXX='clang++-3.9' cmake -DBUILD_DEV=On ..; \
make -j\$(nproc) -k analyze;"
}
steps{
buildJob('clang++-3.9', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
}
}

stage('Clang Format') {
agent{ label rocmnode("rocmtest") }
environment{
Expand All @@ -142,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 All @@ -155,11 +140,37 @@ pipeline {
cmd = "rm -rf build; \
mkdir build; \
cd build; \
CXX=/usr/local/bin/hcc cmake -DBUILD_DEV=On ..; \
CXX=/opt/rocm/llvm/bin/clang++ cmake -DBUILD_DEV=On ..; \
make -j\$(nproc) -k analyze;"
}
steps{
buildJob('hcc', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
buildJob('clang++', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
}
}
stage('Build Fin') {
agent{ label rocmnode("rocmtest") }
environment{
cmd = "rm -rf build; \
mkdir build; \
cd build; \
CXX=/opt/rocm/llvm/bin/clang++ cmake -DBUILD_DEV=On -DCMAKE_PREFIX_PATH=/root/dMIOpen/cget ..; \
make -j\$(nproc) all;"
}
steps{
buildJob('clang++', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
}
}
stage('Fin Tests') {
agent{ label rocmnode("rocmtest") }
environment{
cmd = "rm -rf build; \
mkdir build; \
cd build; \
CXX=/opt/rocm/llvm/bin/clang++ cmake -DBUILD_DEV=On -DCMAKE_PREFIX_PATH=/root/dMIOpen/cget ..; \
make -j\$(nproc) fin_check;"
}
steps{
buildJob('clang++', '-DCMAKE_BUILD_TYPE=release', image, "", cmd)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2020 ROCm Software Platform
Copyright (c) 2020 - 2022 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
Expand Down
5 changes: 2 additions & 3 deletions cmake/EnableCompilerWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#
################################################################################
# - Enable warning all for gcc/clang or use /W4 for visual studio

## Strict warning level
if (MSVC)
# Use the highest warning level for visual studio.
Expand Down Expand Up @@ -65,9 +64,8 @@ else()
-Wuninitialized
-Wunreachable-code
-Wunused

-Wno-ignored-qualifiers
-Wno-sign-compare
-Wno-extra-semi-stmt
)
if (CMAKE_${COMPILER}_COMPILER_ID MATCHES "Clang")
list(APPEND CMAKE_COMPILER_WARNINGS
Expand All @@ -78,6 +76,7 @@ else()
-Wno-double-promotion
-Wno-exit-time-destructors
-Wno-extra-semi
-Wno-extra-semi-stmt
-Wno-float-conversion
-Wno-gnu-anonymous-struct
-Wno-gnu-zero-variadic-macro-arguments
Expand Down
39 changes: 39 additions & 0 deletions cmake/googletest.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
include(FetchContent)

set(GOOGLETEST_DIR "" CACHE STRING "Location of local GoogleTest repo to build against")

if(GOOGLETEST_DIR)
set(FETCHCONTENT_SOURCE_DIR_GOOGLETEST ${GOOGLETEST_DIR} CACHE STRING "GoogleTest source directory override")
endif()

message(STATUS "Fetching GoogleTest")

list(APPEND GTEST_CMAKE_CXX_FLAGS
-Wno-undef
-Wno-reserved-identifier
-Wno-global-constructors
-Wno-missing-noreturn
-Wno-disabled-macro-expansion
-Wno-used-but-marked-unused
-Wno-switch-enum
-Wno-zero-as-null-pointer-constant
-Wno-unused-member-function
-Wno-comma
-Wno-old-style-cast
)
message(STATUS "Suppressing googltest warnings with flags: ${GTEST_CMAKE_CXX_FLAGS}")

FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG e2239ee6043f73722e7aa812a459f54a28552929
)

# Will be necessary for windows build
# set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)

target_compile_options(gtest PRIVATE ${GTEST_CMAKE_CXX_FLAGS})
target_compile_options(gtest_main PRIVATE ${GTEST_CMAKE_CXX_FLAGS})
target_compile_options(gmock PRIVATE ${GTEST_CMAKE_CXX_FLAGS})
target_compile_options(gmock_main PRIVATE ${GTEST_CMAKE_CXX_FLAGS})
6 changes: 2 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
RadeonOpenCompute/rocm-cmake@cdd0f632b3a65bd4411593bb827eb664e25c80bc --build
# ROCmSoftwarePlatform/MIOpen@9b2d37f9f1e4b5492ef8256cf8168363ca5fd2da
nlohmann/json
#ROCmSoftwarePlatform/rocBLAS@9790a8658341bc665c11c311129ad0dfc533d5c4
# RadeonOpenCompute/rocm-cmake@cdd0f632b3a65bd4411593bb827eb664e25c80bc --build
nlohmann/[email protected]

Loading

0 comments on commit 4042531

Please sign in to comment.