Skip to content

Commit

Permalink
Support LLVM 14 (#203)
Browse files Browse the repository at this point in the history
* support llvm 14

* fix install-deps.sh on windows for llvm14

* Disable macOS + LLVM 13 CI build

The GitHub Actions images do not seem to have a version of Xcode that
is compatible with the prebuilt LLVM 13 binaries.

* Fix mismatched LLVM version for CTS CI jobs

Co-authored-by: James Price <jamesprice.dev@gmail.com>
  • Loading branch information
alexfikl and jrprice committed Sep 4, 2022
1 parent 5c9a39f commit 6c76e7b
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ jobs:
os: [ubuntu-20.04, macos-11.0]
compiler: [gcc, clang]
build_type: [Release, Debug]
llvm: [11, 12, 13]
llvm: [11, 12, 13, 14]
exclude:
- os: ubuntu-20.04
llvm: 11
- os: macos-11.0
llvm: 13
- os: macos-11.0
compiler: gcc

Expand Down Expand Up @@ -103,7 +105,7 @@ jobs:
strategy:
matrix:
platform: [Win32, x64]
llvm: [11, 12, 13]
llvm: [11, 12, 13, 14]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -179,9 +181,7 @@ jobs:
runs-on: ubuntu-20.04
needs: [build]
env:
LLVM_VERSION: 13
cts_hash: 3dab3df48d7dbc22accf6c37c59e54e35a35de7f

steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
Expand Down Expand Up @@ -246,7 +246,6 @@ jobs:
runs-on: ubuntu-20.04
needs: [build-cts]
env:
LLVM_VERSION: 13
cts_hash: 3dab3df48d7dbc22accf6c37c59e54e35a35de7f
strategy:
fail-fast: false
Expand Down Expand Up @@ -286,7 +285,9 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: bash .github/workflows/install-deps.sh
run: >
LLVM_VERSION=${{ env.RELEASE_LLVM }} \
bash .github/workflows/install-deps.sh
- name: Download Oclgrind
uses: actions/download-artifact@v2
with:
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/install-deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,19 @@ elif [[ "`uname`" == "MINGW64"* ]]; then
curl -OL "$URL/$ARCHIVE"
tar xf "$ARCHIVE" --strip-components 1 -C llvm-${LLVM_VERSION}/tools/clang

if [ ${LLVM_VERSION} == 14 ]; then
mkdir -p cmake
mv "llvm-${LLVM_VERSION}/Modules" cmake
fi

# Build LLVM + Clang
mkdir -p llvm-${LLVM_VERSION}/build
cd llvm-${LLVM_VERSION}/build
cmake .. \
-G "Visual Studio 16 2019" -A ${BUILD_PLATFORM} \
-DCMAKE_INSTALL_PREFIX=$PWD/../install \
-DLLVM_TARGETS_TO_BUILD=host
-G "Visual Studio 16 2019" -A ${BUILD_PLATFORM} \
-DCMAKE_INSTALL_PREFIX=$PWD/../install \
-DLLVM_TARGETS_TO_BUILD=host \
-DLLVM_INCLUDE_BENCHMARKS=OFF
cmake --build . --config Release --target ALL_BUILD
cmake --build . --config Release --target INSTALL
fi
Expand Down
3 changes: 3 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
For more information, please visit the Oclgrind Wiki:
https://github.com/jrprice/Oclgrind/wiki

Oclgrind Next
=============
- Added support for LLVM 14

Oclgrind 21.10
==============
Expand Down
6 changes: 3 additions & 3 deletions src/core/WorkItemBuiltins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@ class WorkItemBuiltins
int coordIndex = 1;

// Check for sampler version
if (callInst->getNumArgOperands() > 2)
if (callInst->arg_size() > 2)
{
sampler = ((llvm::ConstantInt*)PARG(1))->getZExtValue();
coordIndex = 2;
Expand Down Expand Up @@ -1346,7 +1346,7 @@ class WorkItemBuiltins
int coordIndex = 1;

// Check for sampler version
if (callInst->getNumArgOperands() > 2)
if (callInst->arg_size() > 2)
{
sampler = ((llvm::ConstantInt*)PARG(1))->getZExtValue();
coordIndex = 2;
Expand Down Expand Up @@ -1419,7 +1419,7 @@ class WorkItemBuiltins
int coordIndex = 1;

// Check for sampler version
if (callInst->getNumArgOperands() > 2)
if (callInst->arg_size() > 2)
{
sampler = ((llvm::ConstantInt*)PARG(1))->getZExtValue();
coordIndex = 2;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/Uninitialized.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2070,7 +2070,7 @@ void Uninitialized::SimpleOrAtomic(const WorkItem* workItem,
newShadow = ShadowContext::getPoisonedValue(4);
}

if (CI->getNumArgOperands() > 1)
if (CI->arg_size() > 1)
{
TypedValue argShadow =
shadowContext.getValue(workItem, CI->getArgOperand(1));
Expand Down

0 comments on commit 6c76e7b

Please sign in to comment.