Skip to content

Commit

Permalink
merged develop
Browse files Browse the repository at this point in the history
  • Loading branch information
hieule88 committed Jul 29, 2024
2 parents 4d008c8 + bd993eb commit 600728c
Show file tree
Hide file tree
Showing 727 changed files with 64,652 additions and 17,716 deletions.
42 changes: 42 additions & 0 deletions .azuredevops/rocm-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
resources:
repositories:
- repository: pipelines_repo
type: github
endpoint: ROCm
name: ROCm/ROCm

variables:
- group: common
- template: /.azuredevops/variables-global.yml@pipelines_repo

trigger:
batch: true
branches:
include:
- develop
paths:
exclude:
- .githooks
- .github
- docs
- '.*.y*ml'
- '*.md'
- LICENSE.txt

pr:
autoCancel: true
branches:
include:
- develop
paths:
exclude:
- .githooks
- .github
- docs
- '.*.y*ml'
- '*.md'
- LICENSE.txt
drafts: false

jobs:
- template: ${{ variables.CI_COMPONENT_PATH }}/MIOpen.yml@pipelines_repo
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
*.kdb filter=lfs diff=lfs merge=lfs -text
*.db.bz2 binary
*.fdb.txt.bz2 binary
*.kdb.bz2 filter=lfs diff=lfs merge=lfs -text
*.ktn.model binary
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
* @JehandadKhan @junliume
# Documentation files
docs/* @ROCm/rocm-documentation
docs/ @ROCm/rocm-documentation
*.md @ROCm/rocm-documentation
*.rst @ROCm/rocm-documentation
.readthedocs.yaml @ROCm/rocm-documentation
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ python:
build:
os: ubuntu-22.04
tools:
python: "3.8"
python: "3.10"
20 changes: 19 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,25 @@

Full documentation for MIOpen is available [here](https://rocm.docs.amd.com/projects/MIOpen/en/latest/)

## (Unreleased) MIOpen-3.1.0 for ROCm 6.1.0
## MIOpen-3.2.0 for ROCm 6.2.0
### Added
- [Conv] bilinear (alpha beta) solvers
- [Conv] enable bf16 for ck-based solvers
- [Conv] Add split_k tuning to 2d wrw ck-based solver
- [MHA] graph API fp8 fwd
- [RNN] multi-stream as default solution.
- TunaNetv2.0 for MI300
- Added adam and amp adam optimizer

### Fixed
- Memory access fault caused by GemmBwdRest
- Context configuration in GetWorkSpaceSize
- Fixes to support huge tensors

### Performance
- Find: Improve precision of benchmarking

## MIOpen-3.1.0 for ROCm 6.1.0
### Added
- CK-based 2d/3d convolution solvers to support nchw/ncdhw layout
- Fused solver for Fwd Convolution with Residual, Bias and activation
Expand Down
110 changes: 79 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ macro(set_var_to_condition var)
endif()
endmacro()

macro(set_if_bools_are_different var in1 in2)
set(${var} FALSE)
if(${in1})
if(NOT ${in2})
set(${var} TRUE)
endif()
else()
if(${in2})
set(${var} TRUE)
endif()
endif()
endmacro()

get_property(MIOPEN_GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

# This has to be initialized before the project() command appears
Expand Down Expand Up @@ -103,15 +116,16 @@ set(MIOPEN_ENABLE_SQLITE_BACKOFF On CACHE BOOL "")

option( BUILD_DEV "Build for development only" OFF)
option(MIOPEN_ENABLE_FIN "Enable the fin driver for MIOpen" OFF)
option(MIOPEN_STRIP_SYMBOLS "Strip symbols in release mode" ON)


# Strip symbols for release
if(NOT WIN32 AND NOT APPLE)
if(MIOPEN_STRIP_SYMBOLS AND 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 3.1.0)
rocm_setup_version(VERSION 3.2.0)

list( APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
include(TargetFlags)
Expand Down Expand Up @@ -216,7 +230,7 @@ endif()

# HIP is always required
find_package(hip REQUIRED PATHS /opt/rocm)
message(STATUS "Build with HIP ${hip_VERSION}")
message(STATUS "Build with HIP ${hip_VERSION} ${hip_DIR}")

# Override HIP version in config.h, if necessary.
# The variables set by find_package() can't be overwritten,
Expand Down Expand Up @@ -251,9 +265,14 @@ set(MIOPEN_hip_VERSION ${MIOPEN_hip_VERSION_MAJOR}.${MIOPEN_hip_VERSION_MINOR}.$

# Do not enable HIPRTC by default for older ROCm versions in order to avoid
# build time errors, because HIPRTC is a relatively new component.
set_var_to_condition(MIOPEN_USE_HIPRTC_DEFAULT (MIOPEN_USE_COMGR AND (MIOPEN_hip_VERSION VERSION_GREATER_EQUAL 5)))
set_var_to_condition(MIOPEN_USE_HIPRTC_DEFAULT MIOPEN_USE_COMGR)
option(MIOPEN_USE_HIPRTC "Use HIPRTC to build HIP kernels instead of COMGR" ${MIOPEN_USE_HIPRTC_DEFAULT})

set_if_bools_are_different(MIOPEN_CONFIGURATION_ERROR_COMGR_HIPRTC MIOPEN_USE_COMGR MIOPEN_USE_HIPRTC)
if(MIOPEN_CONFIGURATION_ERROR_COMGR_HIPRTC)
message(FATAL_ERROR "MIOPEN_USE_COMGR (${MIOPEN_USE_COMGR}) and MIOPEN_USE_HIPRTC (${MIOPEN_USE_HIPRTC}) should be set to the same value")
endif()

# Do not append system include directories to HIP compiler flags when HIPRTC is used
set_var_to_condition(MIOPEN_HIP_COMPILER_USE_SYSTEM_INCLUDE_DIRECTORIES_DEFAULT
(NOT (MIOPEN_USE_HIPRTC AND (MIOPEN_hip_VERSION VERSION_GREATER_EQUAL 6.1.40091))))
Expand Down Expand Up @@ -282,7 +301,7 @@ if(HAS_HIP)
else()
# CXX compiler is not HIP compiler, let's analyze HIP version.
set(MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK Off)
if(${MIOPEN_hip_VERSION_FLAT} GREATER_EQUAL 500723302)
if(MIOPEN_hip_VERSION_FLAT GREATER_EQUAL 500723302)
set(MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK On)
endif()
message(STATUS "MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK: ${MIOPEN_HIP_COMPILER_HAS_OPTION_OFFLOAD_UNIFORM_BLOCK}")
Expand All @@ -302,18 +321,19 @@ add_compile_definitions($<$<COMPILE_LANGUAGE:CXX>:HIP_COMPILER_FLAGS=${HIP_COMPI
# HIP
if( MIOPEN_BACKEND STREQUAL "HIP" OR MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN_BACKEND STREQUAL "HIPNOGPU")
if(MIOPEN_USE_COMPOSABLEKERNEL)
find_package(composable_kernel 1.0.0 COMPONENTS device_other_operations device_gemm_operations device_conv_operations device_contraction_operations device_reduction_operations)
find_package(composable_kernel 1.0.0 COMPONENTS device_other_operations device_gemm_operations device_conv_operations device_reduction_operations)
endif()
if( MIOPEN_BACKEND STREQUAL "HIPNOGPU")
set(MIOPEN_MODE_NOGPU 1)
endif()
set(MIOPEN_BACKEND_HIP 1)

find_program(HIP_OC_COMPILER amdclang
find_program(HIP_OC_COMPILER NAMES amdclang clang
PATH_SUFFIXES bin
PATHS
/opt/rocm
${CMAKE_INSTALL_PREFIX}
ENV HIP_PATH
)
if(HIP_OC_COMPILER)
message(STATUS "OpenCL compiler: ${HIP_OC_COMPILER}")
Expand All @@ -331,10 +351,22 @@ if( MIOPEN_BACKEND STREQUAL "HIP" OR MIOPEN_BACKEND STREQUAL "HIPOC" OR MIOPEN_B
set(MIOPEN_USE_ROCBLAS ON CACHE BOOL "")
if(MIOPEN_USE_ROCBLAS)
find_package(rocblas REQUIRED PATHS /opt/rocm)
message(STATUS "Build with rocblas ${rocblas_VERSION}")
message(STATUS "Build with rocblas ${rocblas_VERSION} ${rocblas_DIR}")
else()
message(STATUS "Build without rocblas")
endif()

# hipblaslt
set_var_to_condition(MIOPEN_USE_HIPBLASLT_DEFAULT NOT WIN32)
option(MIOPEN_USE_HIPBLASLT "Use hipBlasLt" ${MIOPEN_USE_HIPBLASLT_DEFAULT})
if(MIOPEN_USE_HIPBLASLT)
find_package(hipblas REQUIRED PATHS /opt/rocm $ENV{HIP_PATH})
message(STATUS "Build with hipbBLAS ${hipblas_VERSION} ${hipblas_DIR}")
find_package(hipblaslt REQUIRED PATHS /opt/rocm $ENV{HIP_PATH})
message(STATUS "Build with hipbBLASLt ${hipblaslt_VERSION} ${hipblaslt_DIR}")
else()
message(STATUS "Build without hipbBLASLt")
endif()
else()
#CK is only enabled when HIP backend is selected
set(MIOPEN_USE_COMPOSABLEKERNEL Off)
Expand Down Expand Up @@ -367,27 +399,37 @@ if(MIOPEN_USE_MLIR)
if(NOT ${BUILD_SHARED_LIBS} AND ${MIOPEN_USE_COMGR})
message(FATAL_ERROR "Potential symbol conflict between mlir and comgr in static build")
endif()
# Try to find package rocMLIR
# REQUIRED is omitted since we do not want cmake to abort if the package is not found
find_package(rocMLIR 1.0.0 CONFIG)
if(NOT rocMLIR_FOUND)
message(STATUS "Falling back to find library libMLIRMIOpen")
# Backward compatibility with ROCm 5.3
# If the rocMLIR package is not found, try to find the library libMLIRMIOpen directly
find_library(LIBMLIRMIOPEN MLIRMIOpen REQUIRED)
if(NOT LIBMLIRMIOPEN)
message(FATAL_ERROR "library libMLIRMIOpen not found, please reinstall dependencies. \
Refer to https://github.com/ROCm/MIOpen#installing-the-dependencies")
else()
message(STATUS "Build with library libMLIRMIOpen: " ${LIBMLIRMIOPEN})
set(rocMLIR_VERSION 0.0.1)
endif()
if(WIN32)
# Windows does not support earlier ROCm versions hence no fallback to MLIRMIOpen.
find_package(rocMLIR 1.0.0 CONFIG REQUIRED)
else()
message(STATUS "Build with rocMLIR::rockCompiler ${rocMLIR_VERSION}")
# Try to find package rocMLIR
# REQUIRED is omitted since we do not want cmake to abort if the package is not found
find_package(rocMLIR 1.0.0 CONFIG)
if(NOT rocMLIR_FOUND)
message(STATUS "Falling back to find library libMLIRMIOpen")
# Backward compatibility with ROCm 5.3
# If the rocMLIR package is not found, try to find the library libMLIRMIOpen directly
find_library(LIBMLIRMIOPEN MLIRMIOpen REQUIRED)
if(NOT LIBMLIRMIOPEN)
message(FATAL_ERROR "library libMLIRMIOpen not found, please reinstall dependencies. \
Refer to https://github.com/ROCm/MIOpen#installing-the-dependencies")
else()
message(STATUS "Build with library libMLIRMIOpen: " ${LIBMLIRMIOPEN})
set(rocMLIR_VERSION 0.0.1)
endif()
endif()
endif()
message(STATUS "Build with rocMLIR::rockCompiler ${rocMLIR_VERSION} ${rocMLIR_DIR}")
endif()

set(MIOPEN_PACKAGE_REQS "hip-rocclr")
# Update HIP Runtime Package Dependency
if(ENABLE_ASAN_PACKAGING)
set(DEPENDS_HIP_RUNTIME "hip-runtime-amd-asan" )
else()
set(DEPENDS_HIP_RUNTIME "hip-runtime-amd" )
endif()
set(MIOPEN_PACKAGE_REQS "${DEPENDS_HIP_RUNTIME}")

# Online assembler
find_program(MIOPEN_AMDGCN_ASSEMBLER
Expand All @@ -407,7 +449,7 @@ message(STATUS "AMDGCN assembler: ${MIOPEN_AMDGCN_ASSEMBLER}")

if(MIOPEN_USE_COMGR)
find_package(amd_comgr REQUIRED CONFIG)
message(STATUS "Build with comgr ${amd_comgr_VERSION}")
message(STATUS "Build with amd_comgr ${amd_comgr_VERSION} ${amd_comgr_DIR}")
set(MIOPEN_PACKAGE_REQS "${MIOPEN_PACKAGE_REQS}, comgr")
endif()

Expand All @@ -416,7 +458,7 @@ if(MIOPEN_USE_HIPRTC)
message(FATAL_ERROR "HIPRTC can be used only together with COMGR")
endif()
find_package(hiprtc REQUIRED)
message(STATUS "Build with HIPRTC ${hiprtc_VERSION}")
message(STATUS "Build with hiprtc ${hiprtc_VERSION} ${hiprtc_DIR}")
endif()

option(Boost_USE_STATIC_LIBS "Use boost static libraries" ON)
Expand Down Expand Up @@ -447,7 +489,9 @@ endif()

if(MIOPEN_ENABLE_AI_KERNEL_TUNING OR MIOPEN_ENABLE_AI_IMMED_MODE_FALLBACK)
find_package(frugally-deep CONFIG REQUIRED)
message(STATUS "Build with frugally-deep ${frugally-deep_VERSION} ${frugally-deep_DIR}")
find_package(Eigen3 REQUIRED)
message(STATUS "Build with Eigen3 ${Eigen3_VERSION} ${Eigen3_DIR}")
endif()

if(WIN32)
Expand Down Expand Up @@ -498,14 +542,18 @@ if(MIOPEN_USE_ROCBLAS)
set(MIOPEN_PACKAGE_REQS "${MIOPEN_PACKAGE_REQS}, rocblas")
endif()

if(MIOPEN_USE_HIPBLASLT)
set(MIOPEN_PACKAGE_REQS "${MIOPEN_PACKAGE_REQS}, hipblaslt")
endif()

if(MIOPEN_OFFLINE_COMPILER_PATHS_V2)
set(MIOPEN_PACKAGE_REQS "${MIOPEN_PACKAGE_REQS}, rocm-core")
endif()

if(MIOPEN_BUILD_DRIVER)
# PR #2785 MIOpenDriver to use rocrand to init buffers
find_package(rocrand REQUIRED)
message(STATUS "rocrand_VERSION=${rocrand_VERSION}")
message(STATUS "Build with rocrand ${rocrand_VERSION} ${rocrand_DIR}")
set(MIOPEN_PACKAGE_REQS "${MIOPEN_PACKAGE_REQS}, rocrand")
endif()

Expand Down Expand Up @@ -596,8 +644,8 @@ function(install_kdb FILE_NAME COMPONENT_NAME)
endfunction()

# Both the lists below should be in sync always
set(KDB_BZ2_FILES gfx942.kdb.bz2 gfx90a.kdb.bz2 gfx1030.kdb.bz2 gfx908.kdb.bz2 gfx906.kdb.bz2 gfx900.kdb.bz2)
set(COMPONENT_LST gfx942kdb gfx90akdb gfx1030kdb gfx908kdb gfx906kdb gfx900kdb)
set(KDB_BZ2_FILES gfx90a.kdb.bz2 gfx1030.kdb.bz2 gfx908.kdb.bz2 gfx906.kdb.bz2 gfx900.kdb.bz2)
set(COMPONENT_LST gfx90akdb gfx1030kdb gfx908kdb gfx906kdb gfx900kdb)

if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.17)
foreach(__file __component IN ZIP_LISTS KDB_BZ2_FILES COMPONENT_LST)
Expand Down Expand Up @@ -630,7 +678,7 @@ endif()

rocm_create_package(
NAME MIOpen-${MIOPEN_BACKEND}
DESCRIPTION "AMD's DNN Library"
DESCRIPTION "AMD DNN Library"
MAINTAINER "MIOpen Maintainer <[email protected]>"
LDCONFIG
# DEPENDS rocm-opencl hip-rocclr tinygemm
Expand Down
12 changes: 7 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ RUN dpkg --add-architecture i386
# Install preliminary dependencies
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
"linux-headers-$(uname -r)" "linux-modules-extra-$(uname -r)" \
apt-utils \
ca-certificates \
curl \
Expand All @@ -18,16 +19,16 @@ DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
ENV APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=DontWarn
RUN curl -fsSL https://repo.radeon.com/rocm/rocm.gpg.key | gpg --dearmor -o /etc/apt/trusted.gpg.d/rocm-keyring.gpg

RUN wget https://repo.radeon.com/amdgpu-install/.6.1/ubuntu/jammy/amdgpu-install_6.1.60100-1_all.deb --no-check-certificate
RUN wget https://repo.radeon.com/amdgpu-install/6.1/ubuntu/jammy/amdgpu-install_6.1.60100-1_all.deb --no-check-certificate
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \
./amdgpu-install_6.1.60100-1_all.deb

# Add rocm repository
RUN export ROCM_APT_VER=6.1;\
echo $ROCM_APT_VER &&\
sh -c 'echo deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rocm-keyring.gpg] https://repo.radeon.com/amdgpu/.$ROCM_APT_VER/ubuntu jammy main > /etc/apt/sources.list.d/amdgpu.list' &&\
sh -c 'echo deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rocm-keyring.gpg] https://repo.radeon.com/rocm/apt/.apt_$ROCM_APT_VER jammy main > /etc/apt/sources.list.d/rocm.list'
sh -c 'echo deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rocm-keyring.gpg] https://repo.radeon.com/amdgpu/$ROCM_APT_VER/ubuntu jammy main > /etc/apt/sources.list.d/amdgpu.list' &&\
sh -c 'echo deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/rocm-keyring.gpg] https://repo.radeon.com/rocm/apt/$ROCM_APT_VER jammy main > /etc/apt/sources.list.d/rocm.list'
RUN sh -c "echo deb http://mirrors.kernel.org/ubuntu jammy main universe | tee -a /etc/apt/sources.list"

RUN amdgpu-install -y --usecase=rocm --no-dkms
Expand Down Expand Up @@ -104,10 +105,11 @@ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get purge -y --allow-unauthenticated \
composablekernel-dev
ARG COMPILER_LAUNCHER=""
# rbuild is used to trigger build of requirements.txt, dev-requirements.txt
RUN if [ "$USE_FIN" = "ON" ]; then \
rbuild prepare -s fin -d $PREFIX -DGPU_TARGETS=${GPU_ARCH} -DCMAKE_CXX_COMPILER_LAUNCHER="${COMPILER_LAUNCHER}"; \
rbuild prepare -s fin -d $PREFIX -DCMAKE_CXX_COMPILER_LAUNCHER="${COMPILER_LAUNCHER}"; \
else \
rbuild prepare -s develop -d $PREFIX -DGPU_TARGETS=${GPU_ARCH} -DCMAKE_CXX_COMPILER_LAUNCHER="${COMPILER_LAUNCHER}"; \
rbuild prepare -s develop -d $PREFIX -DCMAKE_CXX_COMPILER_LAUNCHER="${COMPILER_LAUNCHER}"; \
fi

RUN ccache -s
Expand Down
Loading

0 comments on commit 600728c

Please sign in to comment.