Skip to content

Commit

Permalink
[NFC] update llvm version to 19.1 and branch to llvm_release_190 (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenju-he authored Sep 23, 2024
1 parent bb0acfa commit adbf8a6
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 30 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: "CodeQL"

on:
push:
branches: [ "main" ]
branches: [ "ocl-open-190" ]
pull_request:
branches: [ "main" ]
branches: [ "ocl-open-190" ]

permissions:
contents: read

env:
LLVM_VERSION: 19
LLVM_VERSION_MINOR: 0
LLVM_VERSION_MINOR: 1

jobs:
analyze:
Expand Down Expand Up @@ -39,17 +39,18 @@ jobs:
run: |
curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
curl -L "https://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add -
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main" | sudo tee -a /etc/apt/sources.list
echo "deb https://packages.lunarg.com/vulkan jammy main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install \
clang-${{ env.LLVM_VERSION }} \
clang-tools-${{ env.LLVM_VERSION }} \
llvm-${{ env.LLVM_VERSION }}-dev \
libclang-${{ env.LLVM_VERSION }}-dev \
libclang-cpp${{ env.LLVM_VERSION }}-dev \
libllvmlibc-${{ env.LLVM_VERSION }}-dev \
libpolly-${{ env.LLVM_VERSION }}-dev \
libzstd-dev \
libedit-dev
mlir-19-tools
- name: Checkout opencl-clang sources for action files
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
Expand All @@ -61,7 +62,7 @@ jobs:
with:
repository: KhronosGroup/SPIRV-LLVM-Translator
path: SPIRV-LLVM-Translator
ref: main
ref: llvm_release_190

- name: Build SPIRV-LLVM-Translator
run: |
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/on-push-verification-in-tree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ permissions:
on:
push:
branches:
- main
- ocl-open-*
- ocl-open-190
pull_request:
branches:
- main
- ocl-open-*
- ocl-open-190
types:
- opened
- reopened
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/on-push-verification-out-of-tree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ permissions:

env:
LLVM_VERSION: 19
LLVM_VERSION_MINOR: 0
LLVM_VERSION_MINOR: 1

on:
push:
branches:
- main
- ocl-open-190
pull_request:
branches:
- main
- ocl-open-190
types:
- opened
- reopened
Expand All @@ -38,24 +38,25 @@ jobs:
run: |
curl -L "https://apt.llvm.org/llvm-snapshot.gpg.key" | sudo apt-key add -
curl -L "https://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add -
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy main" | sudo tee -a /etc/apt/sources.list
echo "deb https://apt.llvm.org/jammy/ llvm-toolchain-jammy-19 main" | sudo tee -a /etc/apt/sources.list
echo "deb https://packages.lunarg.com/vulkan jammy main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get -yq --no-install-suggests --no-install-recommends install \
clang-${{ env.LLVM_VERSION }} \
clang-tools-${{ env.LLVM_VERSION }} \
llvm-${{ env.LLVM_VERSION }}-dev \
libclang-${{ env.LLVM_VERSION }}-dev \
libclang-cpp${{ env.LLVM_VERSION }}-dev \
libllvmlibc-${{ env.LLVM_VERSION }}-dev \
libpolly-${{ env.LLVM_VERSION }}-dev \
libzstd-dev \
libedit-dev
mlir-19-tools
- name: Checkout SPIRV-LLVM-Translator sources
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
repository: KhronosGroup/SPIRV-LLVM-Translator
path: SPIRV-LLVM-Translator
ref: main
ref: llvm_release_190

- name: Build SPIRV-LLVM-Translator
run: |
Expand Down
13 changes: 9 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
cmake_minimum_required(VERSION 3.13.4)

if(NOT DEFINED BASE_LLVM_VERSION)
set(BASE_LLVM_VERSION 19.1)
endif(NOT DEFINED BASE_LLVM_VERSION)
set(OPENCL_CLANG_VERSION ${BASE_LLVM_VERSION}.0)

if(NOT DEFINED OPENCL_CLANG_BUILD_EXTERNAL)
# check if we build inside llvm or not
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
Expand Down Expand Up @@ -39,7 +44,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
add_definitions(-DUSE_PREBUILT_LLVM)

if(NOT PREFERRED_LLVM_VERSION)
set(PREFERRED_LLVM_VERSION "19.0")
set(PREFERRED_LLVM_VERSION "19.1")
endif(NOT PREFERRED_LLVM_VERSION)
message(STATUS "[OPENCL-CLANG] Looking for LLVM version ${PREFERRED_LLVM_VERSION}")
find_package(LLVM ${PREFERRED_LLVM_VERSION} REQUIRED)
Expand Down Expand Up @@ -152,9 +157,9 @@ if(NOT USE_PREBUILT_LLVM)
)
endif()

set(CLANG_BASE_REVISION master)
set(SPIRV_BASE_REVISION master)
set(TARGET_BRANCH "ocl-open-110")
set(CLANG_BASE_REVISION release/19.x)
set(SPIRV_BASE_REVISION llvm_release_190)
set(TARGET_BRANCH "ocl-open-190")

apply_patches(${CLANG_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/patches/clang
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ Before the build all dependencies must be downloaded and laid out as follows:
This can be done using the following commands:
```bash
cd <workspace>
git clone https://github.com/llvm/llvm-project.git .
git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git
git clone https://github.com/intel/opencl-clang.git
git clone https://github.com/llvm/llvm-project.git . -b release/19.x
git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git -b llvm_release_190
git clone https://github.com/intel/opencl-clang.git -b ocl-open-190
```

Then we need to create a build directory and run the build:
Expand Down Expand Up @@ -61,7 +61,7 @@ documented in [Embedding LLVM in your project](https://llvm.org/docs/CMake.html#
Commands to checkout sources and build:
```bash
cd <workspace>
git clone https://github.com/intel/opencl-clang.git
git clone https://github.com/intel/opencl-clang.git -b ocl-open-190
mkdir build && cd build
cmake ../opencl-clang
make all -j`nproc`
Expand All @@ -71,13 +71,13 @@ make all -j`nproc`

##### Preferred LLVM version

By default, opencl-clang's cmake script is searching for LLVM which is built
based on the latest verion of current branch. You can override target version of
LLVM by using the `PREFERRED_LLVM_VERSION` cmake option:
By default, opencl-clang's cmake script is searching for LLVM 19.1. You can
override target version of LLVM by using the `PREFERRED_LLVM_VERSION` cmake
option:

Example:
```bash
cmake -DPREFERRED_LLVM_VERSION="19.0" ../opencl-clang
cmake -DPREFERRED_LLVM_VERSION="19.1" ../opencl-clang
```

##### Custom LLVM installation
Expand Down

0 comments on commit adbf8a6

Please sign in to comment.