From 69d47bf04f337ed2fb49f47ec8281cecb37f8ffd Mon Sep 17 00:00:00 2001 From: JD Date: Fri, 18 Feb 2022 21:44:11 -0600 Subject: [PATCH] Initial Setup for CI (#86) * add docker file and make default target buildable * add Jenkinsfile * remove empty env block * fix package stage * remove render group from docker run * clean up Jenkins file * add cppcheck as dev dependency * update cmake file * Add profiler build stage * add hip_version config file for reduction operator * correct jenkins var name * Build release instead of debug * clean up Co-authored-by: Chao Liu [ROCm/composable_kernel commit: 2778e99758e149a6cb5309ca307bf7c1e61a562f] --- CMakeLists.txt | 109 +++++++-- Dockerfile | 101 ++++++++ Jenkinsfile | 225 ++++++++++++++++++ cmake/TargetFlags.cmake | 50 ++++ .../include/{utility => }/config.hpp | 2 +- composable_kernel/include/hip_version.hpp.in | 28 +++ dev-requirements.txt | 3 + host/CMakeLists.txt | 3 +- rbuild.ini | 8 + requirements.txt | 2 + 10 files changed, 513 insertions(+), 18 deletions(-) create mode 100644 Dockerfile create mode 100644 Jenkinsfile create mode 100644 cmake/TargetFlags.cmake rename composable_kernel/include/{utility => }/config.hpp (99%) create mode 100644 composable_kernel/include/hip_version.hpp.in create mode 100644 dev-requirements.txt create mode 100644 rbuild.ini create mode 100644 requirements.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index a2af6a812d..021f5caf06 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,25 @@ cmake_minimum_required(VERSION 3.5) + +# Check support for CUDA/HIP in Cmake project(composable_kernel) list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") +enable_testing() + +find_package(ROCM REQUIRED PATHS /opt/rocm) + +include(ROCMInstallTargets) +include(ROCMPackageConfigHelpers) +include(ROCMSetupVersion) +include(ROCMInstallSymlinks) +include(ROCMCreatePackage) include(CheckCXXCompilerFlag) +rocm_setup_version(VERSION 1.0.0) +include(TargetFlags) +list(APPEND CMAKE_PREFIX_PATH ${CMAKE_INSTALL_PREFIX} ${CMAKE_INSTALL_PREFIX}/llvm ${CMAKE_INSTALL_PREFIX}/hip /opt/rocm /opt/rocm/llvm /opt/rocm/hip) + ## C++ enable_language(CXX) set(CMAKE_CXX_STANDARD 17) @@ -30,36 +45,54 @@ message("OpenMP_gomp_LIBRARY: ${OpenMP_gomp_LIBRARY}") message("OpenMP_pthread_LIBRARY: ${OpenMP_pthread_LIBRARY}") message("OpenMP_CXX_FLAGS: ${OpenMP_CXX_FLAGS}") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") +# set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") link_libraries(${OpenMP_gomp_LIBRARY}) link_libraries(${OpenMP_pthread_LIBRARY}) ## HIP find_package(HIP REQUIRED) -message(STATUS "Build with HIP ${hip_VERSION}") +# Override HIP version in config.h, if necessary. +# The variables set by find_package() can't be overwritten, +# therefore let's use intermediate variables. +set(CK_HIP_VERSION_MAJOR "${HIP_VERSION_MAJOR}") +set(CK_HIP_VERSION_MINOR "${HIP_VERSION_MINOR}") +set(CK_HIP_VERSION_PATCH "${HIP_VERSION_PATCH}") +if( DEFINED CK_OVERRIDE_HIP_VERSION_MAJOR ) + set(CK_HIP_VERSION_MAJOR "${CK_OVERRIDE_HIP_VERSION_MAJOR}") + message(STATUS "CK_HIP_VERSION_MAJOR overriden with ${CK_OVERRIDE_HIP_VERSION_MAJOR}") +endif() +if( DEFINED CK_OVERRIDE_HIP_VERSION_MINOR ) + set(CK_HIP_VERSION_MINOR "${CK_OVERRIDE_HIP_VERSION_MINOR}") + message(STATUS "CK_HIP_VERSION_MINOR overriden with ${CK_OVERRIDE_HIP_VERSION_MINOR}") +endif() +if( DEFINED CK_OVERRIDE_HIP_VERSION_PATCH ) + set(CK_HIP_VERSION_PATCH "${CK_OVERRIDE_HIP_VERSION_PATCH}") + message(STATUS "CK_HIP_VERSION_PATCH overriden with ${CK_OVERRIDE_HIP_VERSION_PATCH}") +endif() +message(STATUS "Build with HIP ${HIP_VERSION}") ## half #find_path(HALF_INCLUDE_DIR half.hpp) set(HALF_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/external/half/include") message("HALF_INCLUDE_DIR: ${HALF_INCLUDE_DIR}") -# CMAKE_CXX_FLAGS -SET(BUILD_DEV ON CACHE BOOL "BUILD_DEV") -if(BUILD_DEV) - string(APPEND CMAKE_CXX_FLAGS " -Werror -Weverything") -endif() -message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") +rocm_create_package( + NAME CK-${CK_BACKEND} + DESCRIPTION "High Performance Composable Kernels for AMD GPUs" + LDCONFIG +) ## tidy include(EnableCompilerWarnings) -set(MIOPEN_TIDY_ERRORS ERRORS * -readability-inconsistent-declaration-parameter-name) +set(CK_TIDY_ERRORS ERRORS * -readability-inconsistent-declaration-parameter-name) if(CMAKE_CXX_COMPILER MATCHES ".*hcc" OR CMAKE_CXX_COMPILER MATCHES ".*clang\\+\\+") - set(MIOPEN_TIDY_CHECKS -modernize-use-override -readability-non-const-parameter) + set(CK_TIDY_CHECKS -modernize-use-override -readability-non-const-parameter) # Enable tidy on hip -elseif(MIOPEN_BACKEND STREQUAL "HIP" OR MIOPEN_BACKEND STREQUAL "HIPNOGPU") - set(MIOPEN_TIDY_ERRORS ALL) +elseif(CK_BACKEND STREQUAL "HIP" OR CK_BACKEND STREQUAL "HIPNOGPU") + set(CK_TIDY_ERRORS ALL) endif() + include(ClangTidy) enable_clang_tidy( CHECKS @@ -152,12 +185,12 @@ enable_clang_tidy( -altera-struct-pack-align -cppcoreguidelines-prefer-member-initializer - ${MIOPEN_TIDY_CHECKS} - ${MIOPEN_TIDY_ERRORS} + ${CK_TIDY_CHECKS} + ${CK_TIDY_ERRORS} HEADER_FILTER "\.hpp$" EXTRA_ARGS - -DMIOPEN_USE_CLANG_TIDY + -DCK_USE_CLANG_TIDY ) include(CppCheck) @@ -196,6 +229,52 @@ enable_cppcheck( CPPCHECK=1 __linux__=1 ) +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) + +file(GLOB_RECURSE COMPOSABLE_KERNEL_HEADERS "composable_kernel/include/*/*.hpp") +file(GLOB_RECURSE DEVICE_OPS_HEADERS "device_operation/include/*.hpp") + +file(GLOB_RECURSE DEVICE_OPS_SOURCE "device_operation/*.cpp") + +set(CK_HEADERS ${COMPOSABLE_KERNEL_HEADERS} ${DEVICE_OPS_HEADERS}) +set(CK_SOURCE ${DEVICE_OPS_SOURCE}) +add_library(composable_kernel + ${CK_SOURCE} +) + +target_include_directories(composable_kernel PUBLIC + $ +) +target_include_directories(composable_kernel PUBLIC + $ +) +target_include_directories(composable_kernel PUBLIC + $ +) +target_include_directories(composable_kernel PUBLIC + $ +) +# The following should eventually be removed +target_include_directories(composable_kernel PUBLIC + $ +) +target_include_directories(composable_kernel PUBLIC + $ +) +target_include_directories(composable_kernel PUBLIC + $ +) +# clang_tidy_check(composable_kernel) +SET(BUILD_DEV ON CACHE BOOL "BUILD_DEV") +if(BUILD_DEV) + target_compile_options(composable_kernel PRIVATE -Werror) + target_compile_options(composable_kernel PRIVATE -Weverything) +endif() +message("CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}") + +configure_file("${PROJECT_SOURCE_DIR}/composable_kernel/include/hip_version.hpp.in" "${PROJECT_BINARY_DIR}/composable_kernel/include/hip_version.hpp") add_subdirectory(host) add_subdirectory(device_operation) diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000..61aebd1cce --- /dev/null +++ b/Dockerfile @@ -0,0 +1,101 @@ +FROM ubuntu:18.04 + +ARG ROCMVERSION=4.5 +ARG OSDB_BKC_VERSION + +RUN set -xe + +ARG BUILD_THREADS=8 +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 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-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 +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" + +# ADD requirements.txt requirements.txt +# Install dependencies +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated \ + apt-utils \ + sshpass \ + build-essential \ + cmake-data=3.15.1-0kitware1 \ + cmake=3.15.1-0kitware1 \ + curl \ + doxygen \ + g++ \ + gdb \ + git \ + hip-rocclr \ + jq \ + lcov \ + libelf-dev \ + libncurses5-dev \ + libnuma-dev \ + libpthread-stubs0-dev \ + llvm-amdgpu \ + miopengemm \ + pkg-config \ + python \ + python3 \ + python-dev \ + python3-dev \ + python-pip \ + python3-pip \ + software-properties-common \ + sqlite3 \ + wget \ + rocm-dev \ + rocm-device-libs \ + rocm-opencl \ + rocm-opencl-dev \ + rocm-cmake \ + rocblas \ + vim \ + zlib1g-dev \ + openssh-server \ + kmod \ + mysql-client && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +# RUN pip3 install --default-timeout=100000 -r requirements.txt + +# Setup ubsan environment to printstacktrace +RUN ln -s /usr/bin/llvm-symbolizer-3.8 /usr/local/bin/llvm-symbolizer +ENV UBSAN_OPTIONS=print_stacktrace=1 + +# Install an init system +RUN wget https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb +RUN dpkg -i dumb-init_*.deb && rm dumb-init_*.deb + +# Install cget +RUN pip install cget + +# Install rclone +RUN pip install https://github.com/pfultz2/rclone/archive/master.tar.gz + +ARG PREFIX=/opt/rocm +# Install dependencies +RUN cget install pfultz2/rocm-recipes +# Install rbuild +RUN pip3 install https://github.com/RadeonOpenCompute/rbuild/archive/6d78a0553babdaea8d2da5de15cbda7e869594b8.tar.gz +# Setup ubsan environment to printstacktrace +ENV UBSAN_OPTIONS=print_stacktrace=1 + +ENV LC_ALL=C.UTF-8 +ENV LANG=C.UTF-8 +ADD rbuild.ini /rbuild.ini +ADD dev-requirements.txt dev-requirements.txt +RUN rbuild prepare -s develop -d $PREFIX +RUN groupadd -f render +# RUN cget install -f min-requirements.txt +# RUN CXXFLAGS='-isystem $PREFIX/include' cget install -f ./mlir-requirements.txt diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000000..f7f029ce90 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,225 @@ +def rocmnode(name) { + return 'rocmtest && miopen && ' + name +} + +def show_node_info() { + sh """ + echo "NODE_NAME = \$NODE_NAME" + lsb_release -sd + uname -r + cat /sys/module/amdgpu/version + ls /opt/ -la + """ +} + +def cmake_build(Map conf=[:]){ + + def compiler = conf.get("compiler","/opt/rocm/bin/hipcc") + def config_targets = conf.get("config_targets","check") + def debug_flags = "-g -fno-omit-frame-pointer -fsanitize=undefined -fno-sanitize-recover=undefined " + conf.get("extradebugflags", "") + def build_envs = "CTEST_PARALLEL_LEVEL=4 MIOPEN_CONV_PRECISE_ROCBLAS_TIMING=0 " + conf.get("build_env","") + def prefixpath = conf.get("prefixpath","/opt/rocm") + def setup_args = conf.get("setup_args","") + + if (prefixpath != "/usr/local"){ + setup_args = setup_args + " -DCMAKE_PREFIX_PATH=${prefixpath} " + } + + def build_type_debug = (conf.get("build_type",'release') == 'debug') + + //cmake_env can overwrite default CXX variables. + def cmake_envs = "CXX=${compiler} CXXFLAGS='-Werror' " + conf.get("cmake_ex_env","") + + def package_build = (conf.get("package_build","") == "true") + + if (package_build == true) { + config_targets = "package" + } + + if(conf.get("build_install","") == "true") + { + config_targets = 'install ' + config_targets + setup_args = ' -DBUILD_DEV=Off -DCMAKE_INSTALL_PREFIX=../install' + setup_args + } else{ + setup_args = ' -DBUILD_DEV=On' + setup_args + } + + if(build_type_debug){ + setup_args = " -DCMAKE_BUILD_TYPE=debug -DCMAKE_CXX_FLAGS_DEBUG='${debug_flags}'" + setup_args + }else{ + setup_args = " -DCMAKE_BUILD_TYPE=release" + setup_args + } + + def pre_setup_cmd = """ + echo \$HSA_ENABLE_SDMA + ulimit -c unlimited + rm -rf build + mkdir build + rm -rf install + mkdir install + cd build + """ + def setup_cmd = conf.get("setup_cmd", "${cmake_envs} cmake ${setup_args} .. ") + def build_cmd = conf.get("build_cmd", "${build_envs} dumb-init make -j\$(nproc) ${config_targets}") + def execute_cmd = conf.get("execute_cmd", "") + + def cmd = conf.get("cmd", """ + ${pre_setup_cmd} + ${setup_cmd} + ${build_cmd} + ${execute_cmd} + """) + + echo cmd + sh cmd + + // Only archive from master or develop + if (package_build == true && (env.BRANCH_NAME == "develop" || env.BRANCH_NAME == "master")) { + archiveArtifacts artifacts: "build/*.deb", allowEmptyArchive: true, fingerprint: true + } +} + +def buildHipClangJob(Map conf=[:]){ + show_node_info() + + env.HSA_ENABLE_SDMA=0 + checkout scm + + def image = "composable_kernels" + def prefixpath = conf.get("prefixpath", "/opt/rocm") + def gpu_arch = conf.get("gpu_arch", "gfx908") + + // Jenkins is complaining about the render group + // def dockerOpts="--device=/dev/kfd --device=/dev/dri --group-add video --group-add render --cap-add=SYS_PTRACE --security-opt seccomp=unconfined" + def dockerOpts="--device=/dev/kfd --device=/dev/dri --group-add video --cap-add=SYS_PTRACE --security-opt seccomp=unconfined" + if (conf.get("enforce_xnack_on", false)) { + dockerOpts = dockerOpts + " --env HSA_XNACK=1" + } + def dockerArgs = "--build-arg PREFIX=${prefixpath} --build-arg GPU_ARCH='${gpu_arch}' " + + def variant = env.STAGE_NAME + + + def retimage + gitStatusWrapper(credentialsId: '7126e5fe-eb51-4576-b52b-9aaf1de8f0fd', gitHubContext: "Jenkins - ${variant}", account: 'ROCmSoftwarePlatform', repo: 'composable_kernel') { + try { + retimage = docker.build("${image}", dockerArgs + '.') + withDockerContainer(image: image, args: dockerOpts) { + timeout(time: 5, unit: 'MINUTES') + { + sh 'PATH="/opt/rocm/opencl/bin:/opt/rocm/opencl/bin/x86_64:$PATH" clinfo' + } + } + } + catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e){ + echo "The job was cancelled or aborted" + throw e + } + catch(Exception ex) { + retimage = docker.build("${image}", dockerArgs + "--no-cache .") + withDockerContainer(image: image, args: dockerOpts) { + timeout(time: 5, unit: 'MINUTES') + { + sh 'PATH="/opt/rocm/opencl/bin:/opt/rocm/opencl/bin/x86_64:$PATH" clinfo' + } + } + } + + withDockerContainer(image: image, args: dockerOpts + ' -v=/var/jenkins/:/var/jenkins') { + timeout(time: 5, unit: 'HOURS') + { + cmake_build(conf) + } + } + } + return retimage +} + +def reboot(){ + build job: 'reboot-slaves', propagate: false , parameters: [string(name: 'server', value: "${env.NODE_NAME}"),] +} + +def buildHipClangJobAndReboot(Map conf=[:]){ + try{ + buildHipClangJob(conf) + } + catch(e){ + echo "throwing error exception for the stage" + echo 'Exception occurred: ' + e.toString() + throw e + } + finally{ + if (!conf.get("no_reboot", false)) { + reboot() + } + } +} + +pipeline { + agent none + options { + parallelsAlwaysFailFast() + } + // environment{ + // variable = value + // } + stages{ + stage("Static checks") { + parallel{ + // enable after we move from hipcc to hip-clang + // stage('Tidy') { + // agent{ label rocmnode("nogpu") } + // environment{ + // // setup_cmd = "CXX='/opt/rocm/bin/hipcc' cmake -DBUILD_DEV=On .. " + // build_cmd = "make -j\$(nproc) -k analyze" + // } + // steps{ + // buildHipClangJobAndReboot(build_cmd: build_cmd, no_reboot:true, prefixpath: '/opt/rocm', build_type: 'debug') + // } + // } + stage('Build Profiler: gfx908') + { + agent { label rocmnode("gfx908")} + environment{ + setup_args = """ -D CMAKE_CXX_FLAGS="-DCK_AMD_GPU_GFX908 --amdgpu-target=gfx908 -O3 " -DBUILD_DEV=On """ + build_cmd = "make -j\$(nproc) -k ckProfiler" + } + steps{ + buildHipClangJobAndReboot(setup_args:setup_args, build_cmd:build_cmd, no_reboot:true, build_type: 'Release') + } + } + stage('Clang Format') { + agent{ label rocmnode("nogpu") } + environment{ + execute_cmd = "find . -iname \'*.h\' \ + -o -iname \'*.hpp\' \ + -o -iname \'*.cpp\' \ + -o -iname \'*.h.in\' \ + -o -iname \'*.hpp.in\' \ + -o -iname \'*.cpp.in\' \ + -o -iname \'*.cl\' \ + | grep -v 'build/' \ + | xargs -n 1 -P 1 -I{} -t sh -c \'clang-format-10 -style=file {} | diff - {}\'" + } + steps{ + buildHipClangJobAndReboot(setup_cmd: "", build_cmd: "", execute_cmd: execute_cmd, no_reboot:true) + } + } + } + } + // enable after the cmake file supports packaging + // stage("Packages") { + // when { + // expression { params.BUILD_PACKAGES && params.TARGET_NOGPU && params.DATATYPE_NA } + // } + // parallel { + // stage("Package /opt/rocm") { + // agent{ label rocmnode("nogpu") } + // steps{ + // buildHipClangJobAndReboot( package_build: "true", prefixpath: '/opt/rocm', gpu_arch: "gfx906;gfx908;gfx90a") + // } + // } + // } + // } + } +} \ No newline at end of file diff --git a/cmake/TargetFlags.cmake b/cmake/TargetFlags.cmake new file mode 100644 index 0000000000..4f83fb5d39 --- /dev/null +++ b/cmake/TargetFlags.cmake @@ -0,0 +1,50 @@ + +function(get_target_property2 VAR TARGET PROPERTY) + get_target_property(_pflags ${TARGET} ${PROPERTY}) + if(_pflags) + set(${VAR} ${_pflags} PARENT_SCOPE) + else() + set(${VAR} "" PARENT_SCOPE) + endif() +endfunction() + + +macro(append_flags FLAGS TARGET PROPERTY PREFIX) + get_target_property2(_pflags ${TARGET} ${PROPERTY}) + foreach(FLAG ${_pflags}) + if(TARGET ${FLAG}) + target_flags(_pflags2 ${FLAG}) + string(APPEND ${FLAGS} " ${_pflags2}") + else() + string(APPEND ${FLAGS} " ${PREFIX}${FLAG}") + endif() + endforeach() +endmacro() + +macro(append_link_flags FLAGS TARGET PROPERTY) + get_target_property2(_pflags ${TARGET} ${PROPERTY}) + foreach(FLAG ${_pflags}) + if(TARGET ${FLAG}) + target_flags(_pflags2 ${FLAG}) + string(APPEND ${FLAGS} " ${_pflags2}") + elseif(FLAG MATCHES "^-.*") + string(APPEND ${FLAGS} " ${FLAG}") + elseif(EXISTS ${FLAG}) + string(APPEND ${FLAGS} " ${FLAG}") + else() + string(APPEND ${FLAGS} " -l${FLAG}") + endif() + endforeach() +endmacro() + +function(target_flags FLAGS TARGET) + set(_flags) + append_flags(_flags ${TARGET} "INTERFACE_COMPILE_OPTIONS" "") + append_flags(_flags ${TARGET} "INTERFACE_COMPILE_DEFINITIONS" "-D") + append_flags(_flags ${TARGET} "INTERFACE_INCLUDE_DIRECTORIES" "-isystem ") + append_flags(_flags ${TARGET} "INTERFACE_LINK_DIRECTORIES" "-L ") + append_flags(_flags ${TARGET} "INTERFACE_LINK_OPTIONS" "") + append_link_flags(_flags ${TARGET} "INTERFACE_LINK_LIBRARIES" "") + # message("_flags: ${_flags}") + set(${FLAGS} ${_flags} PARENT_SCOPE) +endfunction() diff --git a/composable_kernel/include/utility/config.hpp b/composable_kernel/include/config.hpp similarity index 99% rename from composable_kernel/include/utility/config.hpp rename to composable_kernel/include/config.hpp index f29ab54660..bb6ba58e6a 100644 --- a/composable_kernel/include/utility/config.hpp +++ b/composable_kernel/include/config.hpp @@ -1,7 +1,7 @@ #ifndef CK_CONFIG_AMD_HPP #define CK_CONFIG_AMD_HPP -#ifndef MIOPEN_DONT_USE_HIP_RUNTIME_HEADERS +#ifndef CK_DONT_USE_HIP_RUNTIME_HEADERS #include "hip/hip_runtime.h" #include "hip/hip_fp16.h" #endif diff --git a/composable_kernel/include/hip_version.hpp.in b/composable_kernel/include/hip_version.hpp.in new file mode 100644 index 0000000000..4290ef7e0d --- /dev/null +++ b/composable_kernel/include/hip_version.hpp.in @@ -0,0 +1,28 @@ +#pragma once + +// "_PACKAGE_" to avoid name contentions: the macros like +// HIP_VERSION_MAJOR are defined in HIP_VERSION.h. +// clang-format off +#define CK_HIP_PACKAGE_VERSION_MAJOR @CK_HIP_VERSION_MAJOR@ +#define CK_HIP_PACKAGE_VERSION_MINOR @CK_HIP_VERSION_MINOR@ +#define CK_HIP_PACKAGE_VERSION_PATCH @CK_HIP_VERSION_PATCH@ +// clang-format on + +#ifndef CK_HIP_PACKAGE_VERSION_MAJOR +#define CK_HIP_PACKAGE_VERSION_MAJOR 0 +#endif +#ifndef CK_HIP_PACKAGE_VERSION_MINOR +#define CK_HIP_PACKAGE_VERSION_MINOR 0 +#endif +#ifndef CK_HIP_PACKAGE_VERSION_PATCH +#define CK_HIP_PACKAGE_VERSION_PATCH 0 +#endif +// 3 decimal digits for major and minor, 6 digits for patch number. +// Max number is 999,999,999999 == 0xE8,D4A5,0FFF that fits into 64-bit math. +#if CK_HIP_PACKAGE_VERSION_MAJOR > 999 || CK_HIP_PACKAGE_VERSION_MAJOR > 999 || \ + CK_HIP_PACKAGE_VERSION_PATCH > 999999 +#error "Too big HIP version number(s)" +#endif +#define CK_HIP_PACKAGE_VERSION_FLAT \ + ((CK_HIP_PACKAGE_VERSION_MAJOR * 1000ULL + CK_HIP_PACKAGE_VERSION_MINOR) * 1000000 + \ + CK_HIP_PACKAGE_VERSION_PATCH) diff --git a/dev-requirements.txt b/dev-requirements.txt new file mode 100644 index 0000000000..5d123edb85 --- /dev/null +++ b/dev-requirements.txt @@ -0,0 +1,3 @@ +ROCmSoftwarePlatform/rocm-recipes +# 1.90+ +danmar/cppcheck@dd05839a7e63ef04afd34711cb3e1e0ef742882f \ No newline at end of file diff --git a/host/CMakeLists.txt b/host/CMakeLists.txt index 1570fe2a5e..8b8636a4bc 100644 --- a/host/CMakeLists.txt +++ b/host/CMakeLists.txt @@ -1,2 +1 @@ -add_subdirectory(host_tensor) -# add_subdirectory(driver_offline) # deprecated +add_subdirectory(host_tensor) \ No newline at end of file diff --git a/rbuild.ini b/rbuild.ini new file mode 100644 index 0000000000..2ab625c411 --- /dev/null +++ b/rbuild.ini @@ -0,0 +1,8 @@ +[develop] +cxx = ${rocm_path}/bin/hipcc +cc = ${rocm_path}/llvm/bin/clang +ignore = pcre +deps = + -f dev-requirements.txt +define = + BUILD_DEV=On \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000000..afc833cfcf --- /dev/null +++ b/requirements.txt @@ -0,0 +1,2 @@ +half,https://github.com/pfultz2/half/archive/1.12.0.tar.gz -X header -H sha256:0a08660b68abb176ebc2a0cdf8de46e3182a7f46c66443bb80dbfaaec98cf969 --build +danmar/cppcheck@dd05839a7e63ef04afd34711cb3e1e0ef742882f