From: Zoltán Böszörményi <[email protected]>

Add the patchset to the recipe from
https://github.com/intel/opencl-clang/pull/273

Signed-off-by: Zoltán Böszörményi <[email protected]>
Signed-off-by: Khem Raj <[email protected]>
---
 .../opencl-clang/files/273.patch              | 175 ++++++++++++++++++
 .../opencl-clang/opencl-clang_13.0.0.bb       |  34 ++++
 2 files changed, 209 insertions(+)
 create mode 100644 
dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/273.patch
 create mode 100644 
dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_13.0.0.bb

diff --git 
a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/273.patch 
b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/273.patch
new file mode 100644
index 00000000..f8f84cc4
--- /dev/null
+++ b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/files/273.patch
@@ -0,0 +1,175 @@
+From 6e2558aee743fba89c66404bb38f64fe633d123c Mon Sep 17 00:00:00 2001
+From: Haonan Yang <[email protected]>
+Date: Fri, 27 Aug 2021 13:50:27 +0800
+Subject: [PATCH 1/2] Update version number and branch names for ocl-open-130
+ branch
+
+Signed-off-by: Haonan Yang <[email protected]>
+---
+ .travis.yml         | 13 ++++++++-----
+ CMakeLists.txt      | 27 +++++++++++++++++----------
+ README.md           | 10 +++++-----
+ options_compile.cpp |  1 -
+ 4 files changed, 30 insertions(+), 21 deletions(-)
+
+diff --git a/.travis.yml b/.travis.yml
+index d4c11bc..99d7372 100644
+--- a/.travis.yml
++++ b/.travis.yml
+@@ -11,11 +11,11 @@ git:
+
+ branches:
+   only:
+-    - master
++    - ocl-open-130
+
+ env:
+   global:
+-    - LLVM_VERSION=12
++    - LLVM_VERSION=13
+   matrix:
+     - BUILD_TYPE=Release
+     - BUILD_TYPE=Debug
+@@ -31,8 +31,11 @@ before_install:
+       libclang-cpp${LLVM_VERSION}-dev
+
+ install:
+-  - wget 
https://github.com/KhronosGroup/SPIRV-LLVM-Translator/releases/download/dev-build/SPIRV-LLVM-Translator-dev-build-linux-Release.zip
 -O /tmp/SPIRV-LLVM-Translator-dev-build-linux-${BUILD_TYPE}.zip
+-  - unzip /tmp/SPIRV-LLVM-Translator-dev-build-linux-${BUILD_TYPE}.zip -d 
spirv-llvm-translator
++  - git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git 
spirv-llvm-translator -b llvm_release_${LLVM_VERSION}0
++  - mkdir spirv-llvm-translator/build && cd spirv-llvm-translator/build
++  - cmake .. -DCMAKE_INSTALL_PREFIX=./install -DBUILD_SHARED_LIBS=ON 
-DLLVM_BUILD_TOOLS=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
++  - make -j`nproc` && make install
++  - cd ../../
+
+ compiler:
+   - gcc
+@@ -40,5 +43,5 @@ compiler:
+
+ script:
+   - mkdir build && cd build
+-  - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLLVM_NO_DEAD_STRIP=ON 
-DLLVMSPIRV_INCLUDED_IN_LLVM=OFF -DSPIRV_TRANSLATOR_DIR=./spirv-llvm-translator 
-DCMAKE_INSTALL_PREFIX=./install ..
++  - cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLLVM_NO_DEAD_STRIP=ON 
-DLLVMSPIRV_INCLUDED_IN_LLVM=OFF 
-DSPIRV_TRANSLATOR_DIR=${TRAVIS_BUILD_DIR}/spirv-llvm-translator/build/install 
-DCMAKE_INSTALL_PREFIX=./install ..
+   - make install
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 18344c8..ebbe4c7 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -80,9 +80,13 @@ set(TARGET_NAME 
${COMMON_CLANG_LIBRARY_NAME}${BUILD_PLATFORM} )
+ if(NOT USE_PREBUILT_LLVM)
+
+     if(NOT LLVM_EXTERNAL_CLANG_SOURCE_DIR)
++        set(LLVM_BASE_REVISION release_13)
+         set(CLANG_SOURCE_DIR ${LLVM_SOURCE_DIR}/tools/clang)
++        set(CLANG_BASE_REVISION release_13)
+     elseif(EXISTS "${LLVM_EXTERNAL_CLANG_SOURCE_DIR}/CMakeLists.txt")
++          set(LLVM_BASE_REVISION release/13.x)
+         set(CLANG_SOURCE_DIR "${LLVM_EXTERNAL_CLANG_SOURCE_DIR}")
++        set(CLANG_BASE_REVISION release/13.x)
+     endif()
+     if(EXISTS ${CLANG_SOURCE_DIR})
+         message(STATUS "[OPENCL-CLANG] Using Clang source code direcotry: 
${CLANG_SOURCE_DIR}")
+@@ -116,19 +120,22 @@ if(NOT USE_PREBUILT_LLVM)
+             "out at `llvm/projects/llvm-spirv`"
+         )
+     endif()
+-
+-    set(CLANG_BASE_REVISION master)
+-    set(SPIRV_BASE_REVISION master)
+-    set(TARGET_BRANCH "ocl-open-110")
+-
+-    apply_patches(${CLANG_SOURCE_DIR}
+-                  ${CMAKE_CURRENT_SOURCE_DIR}/patches/clang
+-                  ${CLANG_BASE_REVISION}
+-                  ${TARGET_BRANCH})
++
++    set(SPIRV_BASE_REVISION llvm_release_130)
++    set(TARGET_BRANCH "ocl-open-130")
++    get_filename_component(LLVM_MONOREPO_DIR ${LLVM_SOURCE_DIR} DIRECTORY)
++    set(LLVM_PATCHES_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/patches/llvm
++                          ${CMAKE_CURRENT_SOURCE_DIR}/patches/clang)
++    apply_patches(${LLVM_MONOREPO_DIR}
++                  "${LLVM_PATCHES_DIRS}"
++                  ${LLVM_BASE_REVISION}
++                  ${TARGET_BRANCH}
++                  ret)
+     apply_patches(${SPIRV_SOURCE_DIR}
+                   ${CMAKE_CURRENT_SOURCE_DIR}/patches/spirv
+                   ${SPIRV_BASE_REVISION}
+-                  ${TARGET_BRANCH})
++                  ${TARGET_BRANCH}
++                  ret)
+ endif(NOT USE_PREBUILT_LLVM)
+
+ #
+diff --git a/README.md b/README.md
+index fc55831..a989cdd 100644
+--- a/README.md
++++ b/README.md
+@@ -25,9 +25,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/13.x
++git clone https://github.com/KhronosGroup/SPIRV-LLVM-Translator.git -b 
llvm_release_130
++git clone https://github.com/intel/opencl-clang.git -b ocl-open-130
+ ```
+
+ Then we need to create a build directory and run the build:
+@@ -58,7 +58,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-130
+ mkdir build && cd build
+ cmake ../opencl-clang
+ make all -j`nproc`
+@@ -68,7 +68,7 @@ make all -j`nproc`
+
+ ##### Preferred LLVM version
+
+-By default, openclc-clang's cmake script is searching for LLVM 12.0.0. You can
++By default, opencl-clang's cmake script is searching for LLVM 12.0.0. You can
+ override target version of LLVM by using the `PREFERRED_LLVM_VERSION` cmake
+ option:
+
+diff --git a/options_compile.cpp b/options_compile.cpp
+index 1c5a959..84997da 100644
+--- a/options_compile.cpp
++++ b/options_compile.cpp
+@@ -178,7 +178,6 @@ std::string EffectiveOptionsFilter::processOptions(const 
OpenCLArgList &args,
+   effectiveArgs.push_back("-cl-kernel-arg-info");
+   effectiveArgs.push_back("-fno-validate-pch");
+   effectiveArgs.push_back("-fno-caret-diagnostics");
+-  effectiveArgs.push_back("-dwarf-column-info");
+
+   if (std::find_if(effectiveArgs.begin(), effectiveArgs.end(),
+                    [](const ArgsVector::value_type& a) {
+
+From e7fb9581ca583d08c56e8ebdb3bfeb73403fc979 Mon Sep 17 00:00:00 2001
+From: Haonan Yang <[email protected]>
+Date: Fri, 27 Aug 2021 15:59:50 +0800
+Subject: [PATCH 2/2] Update README.md
+
+Signed-off-by: Haonan Yang <[email protected]>
+---
+ README.md | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/README.md b/README.md
+index a989cdd..f5d3700 100644
+--- a/README.md
++++ b/README.md
+@@ -68,7 +68,7 @@ make all -j`nproc`
+
+ ##### Preferred LLVM version
+
+-By default, opencl-clang's cmake script is searching for LLVM 12.0.0. You can
++By default, opencl-clang's cmake script is searching for LLVM 13.0.0. You can
+ override target version of LLVM by using the `PREFERRED_LLVM_VERSION` cmake
+ option:
+
diff --git 
a/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_13.0.0.bb 
b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_13.0.0.bb
new file mode 100644
index 00000000..f44c9fc1
--- /dev/null
+++ 
b/dynamic-layers/clang-layer/recipes-opencl/opencl-clang/opencl-clang_13.0.0.bb
@@ -0,0 +1,34 @@
+SUMMARY = "Common clang is a thin wrapper library around clang"
+DESCRIPTION = "Common clang has OpenCL-oriented API and is capable \
+ to compile OpenCL C kernels to SPIR-V modules."
+
+LICENSE = "NCSA"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=e8a15bf1416762a09ece07e44c79118c"
+
+SRC_URI = 
"git://github.com/intel/opencl-clang.git;branch=ocl-open-130;protocol=https \
+           file://0001-don-t-redefine-LLVM_TABLEGEN_EXE.patch \
+           file://273.patch \
+           "
+SRCREV = "e0d718e677c1c65236aa1a8b5f8e4a3f3cc24fcb"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+DEPENDS += " clang spirv-llvm-translator"
+DEPENDS:append:class-target = " clang-native opencl-clang-native"
+
+COMPATIBLE_HOST = '(x86_64).*-linux'
+COMPATIBLE_HOST:libc-musl = "null"
+
+EXTRA_OECMAKE += "\
+                  -DLLVM_TABLEGEN_EXE=${STAGING_BINDIR_NATIVE}/llvm-tblgen \
+                  -DCMAKE_SKIP_RPATH=TRUE \
+                  -DPREFERRED_LLVM_VERSION=${LLVMVERSION} \
+                  "
+
+do_install:append:class-native() {
+        install -d ${D}${bindir}
+        install -m 0755 ${B}/linux_linker/linux_resource_linker ${D}${bindir}/
+}
+
+BBCLASSEXTEND = "native nativesdk"
--
2.33.0
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#7243): 
https://lists.yoctoproject.org/g/meta-intel/message/7243
Mute This Topic: https://lists.yoctoproject.org/mt/85296690/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-intel/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to