Add new build workflow to github Action

Add new build workflow to github Action to build IGC OpenSource on
public repository on github hosted machines
This commit is contained in:
Marcin Naczk
2021-10-28 07:54:30 +00:00
committed by igcbot
parent ec41408cc7
commit e382784f5d
9 changed files with 184 additions and 8 deletions

32
.github/workflows/build-IGC.yml vendored Normal file
View File

@ -0,0 +1,32 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
name: Build IGC
on:
push:
branches: [ master ]
jobs:
build:
if: github.repository == 'intel/intel-graphics-compiler'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu1804, ubuntu2004 ]
llvm_ver: [ 10, 11 ]
compiler: [ gcc, clang ]
# include experimental builds
include:
- llvm_ver: 12
compiler: gcc
os: ubuntu2004
experimental: true
steps:
- uses: actions/checkout@v2
- name: Run Script Selectiong Docker
run: docker build -f scripts/Dockerfile-${{ matrix.os }} --build-arg BUILD_OS=${{ matrix.os }} --build-arg LLVM_VERSION=${{ matrix.llvm_ver }} --build-arg COMPILER=${{ matrix.compiler }} ./scripts

View File

@ -197,7 +197,7 @@ static bool processCmSrcOptions(
[&optname](const auto& Item) { return std::strcmp(Item, optname.c_str()) == 0; });
if (toErase != userArgs.end()) {
auto itFilename = toErase + 1;
if (itFilename != userArgs.end() && *itFilename != "--") {
if (itFilename != userArgs.end() && strcmp(*itFilename, "--") != 0) {
inputFile = *itFilename;
userArgs.erase(toErase, toErase + 2);
return true;

View File

@ -96,7 +96,7 @@ if(DEFINED SPIRVDLL_SRC)
ExternalProject_Add(SPIRVDLL_EX
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/SPIRVDLL
SOURCE_DIR ${SPIRV_SOURCES}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/spirv-install
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/spirv-install -DBASE_LLVM_VERSION=${IGC_OPTION__LLVM_PREFERRED_VERSION}
BUILD_COMMAND ${MAKE_EXEC} SPIRVDLL
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/spirv-install
)
@ -184,7 +184,7 @@ else()
ExternalProject_Add(SPIRVDLL_EX
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/SPIRVDLL
SOURCE_DIR ${SPIRV_COPY}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/spirv-install
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}/spirv-install -DBASE_LLVM_VERSION=${IGC_OPTION__LLVM_PREFERRED_VERSION}
BUILD_COMMAND ${MAKE_EXEC} SPIRVDLL
INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/spirv-install
)

View File

@ -0,0 +1,21 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
FROM ubuntu:18.04
LABEL maintainer="marcin.naczk@intel.com"
ENV DEBIAN_FRONTEND="noninteractive"
ARG BUILD_OS
ARG LLVM_VERSION
ARG COMPILER
RUN echo "[Build Status Dockerfile] Dockerfile start working"
RUN echo "[Build Status Dockerfile] BUILD_OS = ${BUILD_OS}"
RUN echo "[Build Status Dockerfile] LLVM_VERSION = ${LLVM_VERSION}"
RUN echo "[Build Status Dockerfile] COMPILER = ${COMPILER}"
COPY . /home
RUN /bin/bash -c "BUILD_OS=${BUILD_OS} LLVM_VERSION=${LLVM_VERSION} COMPILER=${COMPILER} sh /home/buildIGC.sh"

View File

@ -0,0 +1,21 @@
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
FROM ubuntu:20.04
LABEL maintainer="marcin.naczk@intel.com"
ENV DEBIAN_FRONTEND="noninteractive"
ARG BUILD_OS
ARG LLVM_VERSION
ARG COMPILER
RUN echo "[Build Status Dockerfile] Dockerfile start working"
RUN echo "[Build Status Dockerfile] BUILD_OS = ${BUILD_OS}"
RUN echo "[Build Status Dockerfile] LLVM_VERSION = ${LLVM_VERSION}"
RUN echo "[Build Status Dockerfile] COMPILER = ${COMPILER}"
COPY . /home
RUN /bin/bash -c "BUILD_OS=${BUILD_OS} LLVM_VERSION=${LLVM_VERSION} COMPILER=${COMPILER} sh /home/buildIGC.sh"

102
scripts/buildIGC.sh Normal file
View File

@ -0,0 +1,102 @@
#!/bin/sh
#
# Copyright (C) 2021 Intel Corporation
#
# SPDX-License-Identifier: MIT
#
set -e
# BUILD_OS supported value [ ubuntu1804, ubuntu2004 ] default ubuntu2004
# LLVM_VERSION supported value [ 10, 11, 12 ] default 11
# COMPILER supported value [ gcc, clang ] default gcc
# OWN_CMAKE_FLAGS not suported but can be use as WA (each flag should be with -D prefix) default empty
# example run: BUILD_OS=ubuntu2004 LLVM_VERSION=11 COMPILER=gcc sh /home/buildIGC.sh
echo "====================BUILD IGC========================="
echo "[Build Status] build script started"
if [ -z ${BUILD_OS+x} ]; then
echo "[Build Status] BUILD_OS is unset, use default ubuntu2004";
BUILD_OS="ubuntu2004"
else
echo "[Build Status] BUILD_OS = ${BUILD_OS}"
fi
if [ -z ${LLVM_VERSION+x} ]; then
echo "[Build Status] LLVM_VERSION is unset, use default 11";
LLVM_VERSION="11"
else
echo "[Build Status] LLVM_VERSION = ${LLVM_VERSION}"
fi
if [ -z ${COMPILER+x} ]; then
echo "[Build Status] COMPILER is unset, use default gcc";
COMPILER="gcc"
else
echo "[Build Status] COMPILER = ${COMPILER}"
fi
if [ -z ${OWN_CMAKE_FLAGS+x} ]; then
echo "[Build Status] OWN_CMAKE_FLAGS is unset, use default EMPTY";
OWN_CMAKE_FLAGS=""
else
echo "[Build Status] OWN_CMAKE_FLAGS = ${OWN_CMAKE_FLAGS}"
fi
apt-get update
apt-get install -y flex bison libz-dev cmake curl wget build-essential git software-properties-common
apt-get update
echo "[Build Status] flex bison libz-dev cmake curl wget build-essential git software-properties-common INSTALLED"
if [ "$BUILD_OS" = "ubuntu1804" ]; then
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | apt-key add -
apt-add-repository "deb https://apt.kitware.com/ubuntu/ bionic main"
apt update
apt-get install -y cmake
echo "[Build Status] new cmake on Ubuntu18.04 INSTALLED"
wget --no-check-certificate -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
add-apt-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic-$LLVM_VERSION main"
apt update
echo '[Build Status] LLVM "$LLVM_VERSION" on Ubuntu18.04 PREPARED'
fi
apt-get install -y llvm-"$LLVM_VERSION" llvm-"$LLVM_VERSION"-dev clang-"$LLVM_VERSION" liblld-"$LLVM_VERSION" liblld-"$LLVM_VERSION"-dev
echo "[Build Status] LLVM INSTALLED"
mkdir workspace
cd workspace
/usr/bin/git version
/usr/bin/git clone https://github.com/intel/intel-graphics-compiler ./igc
cd igc
echo "[Build Status] IGC commit hash below:"
/usr/bin/git log -1 --format='%H'
/usr/bin/git clone https://github.com/intel/vc-intrinsics ../vc-intrinsics
/usr/bin/git clone https://github.com/KhronosGroup/SPIRV-Headers.git ../SPIRV-Headers
/usr/bin/git clone https://github.com/KhronosGroup/SPIRV-Tools.git ../SPIRV-Tools
/usr/bin/git clone --branch llvm_release_"$LLVM_VERSION"0 https://github.com/KhronosGroup/SPIRV-LLVM-Translator ../llvm-project/llvm/projects/llvm-spirv
echo "[Build Status] All necessary repository CLONED"
mkdir build
cd build
curl -s https://api.github.com/repos/intel/intel-graphics-compiler/releases/latest | grep browser_download_url | egrep 'opencl_|core_' | cut -d '"' -f 4 | wget -qi -
dpkg -i *.deb
echo "[Build Status] Old IGC with opencl-clang downloaded and INSTALLED, WA to install opencl-clang"
if [ "$BUILD_OS" = "ubuntu1804" ] && [ "$LLVM_VERSION" = "11" ]; then
LLVM_VERSION_PREFERRED="$LLVM_VERSION".1.0
else
LLVM_VERSION_PREFERRED="$LLVM_VERSION".0.0
fi
echo "[Build Status] LLVM_VERSION_PREFERRED = $LLVM_VERSION_PREFERRED"
CONFIG_VARS="-DIGC_OPTION__LLVM_MODE=Prebuilds -DIGC_OPTION__LLVM_PREFERRED_VERSION=$LLVM_VERSION_PREFERRED"
case $COMPILER in
"clang")
CONFIG_VARS="$CONFIG_VARS -DCMAKE_C_COMPILER=clang-$LLVM_VERSION -DCMAKE_CXX_COMPILER=clang++-$LLVM_VERSION"
;;
esac
CONFIG_VARS="$CONFIG_VARS $OWN_CMAKE_FLAGS"
echo "[Build Status] CONFIG_VARS = $CONFIG_VARS"
cmake ../ $CONFIG_VARS
echo "[Build Status] Cmake created"
make -j`nproc`
echo "[Build Status] make DONE"
echo "====================BUILD IGC========================="

View File

@ -606,7 +606,7 @@ struct vector_opnd {
int getSizeInBinary() const;
};
typedef struct {
typedef struct _raw_opnd{
uint32_t index;
unsigned short offset;

View File

@ -18,7 +18,7 @@ SPDX-License-Identifier: MIT
#include <unordered_set>
#include <optional>
typedef struct{
typedef struct _AddrSubReg_Node{
short immAddrOff = 0;
int subReg = 0;
INST_LIST_ITER iter;
@ -81,7 +81,7 @@ typedef std::list<vISA::MSGTable*>::iterator MSGTable_ITER;
#define MESSAGE_HEADER_THRESHOLD 1
typedef struct
typedef struct _DEFA0
{
vISA::G4_INST *pred = nullptr;
vISA::G4_INST *curr = nullptr;

View File

@ -11,14 +11,14 @@ SPDX-License-Identifier: MIT
#include <stdint.h>
typedef struct {
typedef struct _VISA_BB_INFO{
int id;
unsigned staticCycle;
unsigned sendStallCycle;
unsigned char loopNestLevel;
} VISA_BB_INFO;
typedef struct {
typedef struct _FINALIZER_INFO{
// Common part
bool isSpill;
int numGRFUsed;