diff --git a/conf/layer.conf b/conf/layer.conf index 63a6745..08482cd 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -20,3 +20,6 @@ LAYERVERSION_meta-python-ai = "1" LAYERSERIES_COMPAT_meta-python-ai = "nanbield" LAYERDEPENDS_meta-python-ai = "core openembedded-layer meta-python" + +# This is for setvars.sh in Intel DPCPP compiler +HOSTTOOLS += "ps" diff --git a/recipes-python/pytorch/python3-pytorch_2.3.1.bb b/recipes-python/pytorch/python3-pytorch_2.3.1.bb index d0558a6..c71609c 100644 --- a/recipes-python/pytorch/python3-pytorch_2.3.1.bb +++ b/recipes-python/pytorch/python3-pytorch_2.3.1.bb @@ -14,9 +14,8 @@ DEPENDS = " \ " DEPENDS:append:class-target = " \ - zstd-native intel-oneapi-mkl intel-oneapi-dpcpp-cpp \ - onednn tbb glog gloo numactl opencv \ - opencl-headers virtual/opencl-icd \ + zstd-native glog gloo numactl \ + chipstar-native chipstar virtual/opencl-icd \ shaderc spirv-tools mesa vulkan-headers vulkan-loader \ python3-numpy python3-typing-extensions python3-pyyaml \ python3-pybind11 python3-pytorch-native \ @@ -230,9 +229,6 @@ BUILD_CFLAGS += " \ -Wno-error=uninitialized \ " -LDFLAGS:append:class-target = " -ldnnl" -BUILD_LDFLAGS:append:class-target = " -ldnnl" - # Leave these variables below un-indented. # The contents of EXTRA_OECMAKE is split in python code, # which expects a single space between pieces. @@ -249,12 +245,8 @@ EXTRA_OECMAKE = "\ -DPYTHON_LIBRARY=${STAGING_DIR}/${libdir}/${PYTHON_DIR} \ -DPYTHON_INCLUDE_DIR=${PYTHON_INCLUDE_DIR} \ -DGLIBCXX_USE_CXX11_ABI=1 \ --DBLAS=MKL \ --DUSE_MKLDNN=ON \ --DUSE_MKLDNN_CBLAS=ON \ --DBUILD_ONEDNN_GRAPH=ON \ -DUSE_ITT=OFF \ --DUSE_CUDA=OFF \ +-DUSE_CUDA=ON \ -DUSE_FFMPEG=OFF \ -DBUILD_CAFFE2=ON \ -DBUILD_CAFFE2_OPS=ON \ @@ -263,11 +255,10 @@ EXTRA_OECMAKE = "\ -DUSE_SYSTEM_SLEEF=ON \ -DUSE_GOLD_LINKER=ON \ -DUSE_TBB=ON \ --DUSE_SYSTEM_TBB=ON \ -DUSE_GFLAGS=ON \ -DUSE_GLOG=ON \ --DUSE_OPENCL=OFF \ --DUSE_OPENCV=ON \ +-DUSE_OPENCL=ON \ +-DUSE_OPENCV=OFF \ -DUSE_VULKAN=ON \ -DUSE_VULKAN_FP16_INFERENCE=ON \ -DUSE_VULKAN_RELAXED_PRECISION=ON \ @@ -296,6 +287,12 @@ EXTRA_OECMAKE:class-native = "\ export CMAKE_TOOLCHAIN_FILE="${WORKDIR}/toolchain.cmake" +# For chipStar: Fake CUDA 12.0.0 +#CUCC_VERSION_STRING = "12.0.0" +#export CUCC_VERSION_STRING +export STAGING_BINDIR_NATIVE +export STAGING_EXECPREFIXDIR + do_configure () { export EXTRA_OECMAKE="${EXTRA_OECMAKE}" setuptools3_legacy_do_configure @@ -337,9 +334,7 @@ FILES:${PN} += " \ INSANE_SKIP:${PN} = "dev-so" RDEPENDS:${PN}:class-target = " \ - sleef glslang gflags zstd \ - intel-oneapi-mkl intel-oneapi-dpcpp-cpp-runtime \ - onednn tbb glog numactl opencv \ + sleef glslang gflags zstd glog numactl \ shaderc spirv-tools vulkan-loader \ python3-numpy python3-typing-extensions \ python3-pyyaml python3-pybind11 \ diff --git a/recipes-support/chipstar/chipstar/0001-Build-ccompat-with-native-hipcc.patch b/recipes-support/chipstar/chipstar/0001-Build-ccompat-with-native-hipcc.patch new file mode 100644 index 0000000..8002107 --- /dev/null +++ b/recipes-support/chipstar/chipstar/0001-Build-ccompat-with-native-hipcc.patch @@ -0,0 +1,44 @@ +From f744933a68f40ca1fde55b233a9435f5561e1c02 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Mon, 17 Jun 2024 14:28:01 +0200 +Subject: [PATCH] Build ccompat with native hipcc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [Yocto specific] +Signed-off-by: Zoltán Böszörményi +--- + samples/ccompat/CMakeLists.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/samples/ccompat/CMakeLists.txt b/samples/ccompat/CMakeLists.txt +index 2c0e7648..05a478e9 100644 +--- a/samples/ccompat/CMakeLists.txt ++++ b/samples/ccompat/CMakeLists.txt +@@ -1,18 +1,18 @@ + add_custom_command( + OUTPUT saxpy.o DEPENDS ${CMAKE_SOURCE_DIR}/samples/ccompat/saxpy.hip +- COMMAND ${CMAKE_BINARY_DIR}/bin/hipcc ++ COMMAND hipcc + ${CMAKE_SOURCE_DIR}/samples/ccompat/saxpy.hip -c -g -pthread + -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/HIP/include) + + add_custom_command( + OUTPUT ccompat.o DEPENDS ${CMAKE_SOURCE_DIR}/samples/ccompat/ccompat.c +- COMMAND ${CMAKE_BINARY_DIR}/bin/hipcc ++ COMMAND hipcc + ${CMAKE_SOURCE_DIR}/samples/ccompat/ccompat.c -c -g -pthread + -I${CMAKE_SOURCE_DIR}/include -I${CMAKE_SOURCE_DIR}/HIP/include) + + add_custom_command( + OUTPUT ccompat DEPENDS ccompat.o saxpy.o +-COMMAND ${CMAKE_BINARY_DIR}/bin/hipcc ++COMMAND hipcc + ./ccompat.o ./saxpy.o -o ccompat -g -pthread) + + add_custom_target(ccompatBuild ALL +-- +2.45.2 + diff --git a/recipes-support/chipstar/chipstar/0001-Build-hipInfo-with-native-hipcc.patch b/recipes-support/chipstar/chipstar/0001-Build-hipInfo-with-native-hipcc.patch new file mode 100644 index 0000000..9e6b5d7 --- /dev/null +++ b/recipes-support/chipstar/chipstar/0001-Build-hipInfo-with-native-hipcc.patch @@ -0,0 +1,31 @@ +From f65d4a6be3da2cce6ae1fbb06a473284526376c1 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Mon, 17 Jun 2024 14:20:48 +0200 +Subject: [PATCH] Build hipInfo with native hipcc +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [Yocto specific] +Signed-off-by: Zoltán Böszörményi +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ea989ca2..5514d6ee 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -395,7 +395,7 @@ endif() + # once hipcc.bin is built, execute hipcc ./samples/hipSample.cpp + add_custom_command( + OUTPUT ${CMAKE_BINARY_DIR}/hipInfo +- COMMAND ${HIPCC_BUILD_PATH}/hipcc ${CMAKE_SOURCE_DIR}/samples/hipInfo/hipInfo.cpp -o ${CMAKE_BINARY_DIR}/hipInfo ++ COMMAND hipcc ${CMAKE_SOURCE_DIR}/samples/hipInfo/hipInfo.cpp -o ${CMAKE_BINARY_DIR}/hipInfo + DEPENDS ${CMAKE_SOURCE_DIR}/samples/hipInfo/hipInfo.cpp hipcc.bin CHIP devicelib_bc + ) + +-- +2.45.2 + diff --git a/recipes-support/chipstar/chipstar/0001-Eliminate-RPATH.patch b/recipes-support/chipstar/chipstar/0001-Eliminate-RPATH.patch new file mode 100644 index 0000000..3cc0b06 --- /dev/null +++ b/recipes-support/chipstar/chipstar/0001-Eliminate-RPATH.patch @@ -0,0 +1,61 @@ +From d86a6b7c55a024343a206b78163111df508bc760 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Wed, 19 Jun 2024 07:54:25 +0200 +Subject: [PATCH] Eliminate RPATH +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Signed-off-by: Zoltán Böszörményi +--- + CMakeLists.txt | 11 ----------- + 1 file changed, 11 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5514d6ee..481c7485 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -208,7 +208,6 @@ option(CHIP_VERBOSE "Verbose compilation" OFF) + option(CHIP_BUILD_SHARED_LIBS "Build chipStar as a shared library" ON) + option(CHIP_BUILD_DOCS "Build doxygen documentation" OFF) + option(CHIP_LLVM_USE_INTERGRATED_SPIRV "Use LLVM's intergrated SPIR-V backend for emitting device binary instead of SPIR-V translator. Requires LLVM 15" OFF) +-option(CHIP_SET_RPATH "Add CMAKE_INSTALL_PREFIX/lib to the RPATH for chipStar executables" ON) + option(CHIP_ENABLE_UNCOMPILABLE_TESTS "Enable tests which are known to not compile" OFF) + option(CHIP_BUILD_TESTS "Enable build_tests target" ON) + option(CHIP_BUILD_SAMPLES "Build samples" ON) +@@ -506,8 +505,6 @@ set(HIP_OFFLOAD_COMPILE_OPTIONS_BUILD_ + -I${CMAKE_SOURCE_DIR}/HIP/include + -I${CMAKE_BINARY_DIR}/include) + +-# HIP applications need to link against libCHIP.so; add it to rpath +-# + # -no-hip-rt: Prevents linking amdhip64 library implicitly when doing + # combined compile and link or when the --hip-link is + # present at the link step. +@@ -517,22 +514,14 @@ list(APPEND HIP_OFFLOAD_LINK_OPTIONS_BUILD_ + "-L${CMAKE_BINARY_DIR}" "-lCHIP" "-no-hip-rt") + + if(OpenCL_LIBRARY) +- target_link_options(CHIP PUBLIC -Wl,-rpath,${OpenCL_DIR}) + target_link_directories(CHIP PUBLIC ${OpenCL_DIR}) + endif() + + if(LevelZero_LIBRARY) + include_directories(CHIP PUBLIC ${LevelZeroInclude_DIR}) +- target_link_options(CHIP PUBLIC -Wl,-rpath,${LevelZeroLib_DIR}) + target_link_directories(CHIP PUBLIC ${LevelZeroLib_DIR}) + endif() + +-if(CHIP_SET_RPATH) +- list(APPEND HIP_OFFLOAD_LINK_OPTIONS_INSTALL_ "-Wl,-rpath,${LIB_INSTALL_DIR}") +- list(APPEND HIP_OFFLOAD_LINK_OPTIONS_BUILD_ "-Wl,-rpath,${CMAKE_BINARY_DIR}") +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") +-endif() +- + # Workaround istead of trying to generate the CMake generator expression + string(REPLACE ";" " " HIP_OFFLOAD_COMPILE_OPTIONS_INSTALL "${HIP_OFFLOAD_COMPILE_OPTIONS_INSTALL_}") + string(REPLACE ";" " " HIP_OFFLOAD_COMPILE_OPTIONS_BUILD "${HIP_OFFLOAD_COMPILE_OPTIONS_BUILD_}") +-- +2.45.2 + diff --git a/recipes-support/chipstar/chipstar/0001-Fix-executing-commands-in-opencl_bc_lib-macro-in-cma.patch b/recipes-support/chipstar/chipstar/0001-Fix-executing-commands-in-opencl_bc_lib-macro-in-cma.patch new file mode 100644 index 0000000..e191fee --- /dev/null +++ b/recipes-support/chipstar/chipstar/0001-Fix-executing-commands-in-opencl_bc_lib-macro-in-cma.patch @@ -0,0 +1,57 @@ +From 449a7530f6e417aa1c845937f50673a2828199b7 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Mon, 17 Jun 2024 11:12:55 +0200 +Subject: [PATCH] Fix executing commands in opencl_bc_lib macro in + cmake/OCL.cmake +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [Yocto specific] +Signed-off-by: Zoltán Böszörményi +--- + cmake/OCL.cmake | 10 +++++----- + 1 file changed, 5 insertions(+), 5 deletions(-) + +diff --git a/cmake/OCL.cmake b/cmake/OCL.cmake +index 2eaf44e..8fd0a2d 100644 +--- a/cmake/OCL.cmake ++++ b/cmake/OCL.cmake +@@ -32,7 +32,7 @@ endif() + # Disable code object version module flag if available. + file(WRITE ${CMAKE_BINARY_DIR}/tmp.cl "") + execute_process ( +- COMMAND ${LLVM_TOOLS_BINARY_DIR}/clang${EXE_SUFFIX} ${CLANG_OCL_FLAGS} -Xclang -mcode-object-version=none ${CMAKE_BINARY_DIR}/tmp.cl ++ COMMAND clang${EXE_SUFFIX} ${CLANG_OCL_FLAGS} -Xclang -mcode-object-version=none ${CMAKE_BINARY_DIR}/tmp.cl + RESULT_VARIABLE TEST_CODE_OBJECT_VERSION_NONE_RESULT + ERROR_QUIET + ) +@@ -99,7 +99,7 @@ macro(opencl_bc_lib) + if (fext STREQUAL ".cl") + set(output "${CMAKE_CURRENT_BINARY_DIR}/${fname_we}${BC_EXT}") + add_custom_command(OUTPUT "${output}" +- COMMAND ${CLANG_ROOT_PATH_BIN}/clang ${inc_options} ${CLANG_OCL_FLAGS} ++ COMMAND clang ${inc_options} ${CLANG_OCL_FLAGS} + -emit-llvm -Xclang -mlink-builtin-bitcode -Xclang "${irif_lib_output}" + -c "${file}" -o "${output}" + DEPENDS "${file}" "${irif_lib_output}" "${CLANG}" +@@ -130,12 +130,12 @@ macro(opencl_bc_lib) + + add_custom_command(OUTPUT ${OUTPUT_BC_LIB} + # Link regular library dependencies +- COMMAND ${CLANG_ROOT_PATH_BIN}/llvm-link ++ COMMAND ${LLVM_LINK} + -o "${OUT_NAME}.link0${LIB_SUFFIX}" "@${OUT_NAME}_response" + # Extra link step with internalize +- COMMAND ${CLANG_ROOT_PATH_BIN}/llvm-link -internalize -only-needed "${name}.link0${LIB_SUFFIX}" ++ COMMAND ${LLVM_LINK} -internalize -only-needed "${name}.link0${LIB_SUFFIX}" + -o "${OUT_NAME}${LIB_SUFFIX}" ${internal_link_libs} +- COMMAND ${CLANG_ROOT_PATH_BIN}/opt -passes=strip ++ COMMAND opt -passes=strip + -o "${OUT_NAME}${STRIP_SUFFIX}" "${OUT_NAME}${LIB_SUFFIX}" + COMMAND "${PREPARE_BUILTINS}" + -o ${OUTPUT_BC_LIB} "${OUT_NAME}${STRIP_SUFFIX}" +-- +2.45.2 + diff --git a/recipes-support/chipstar/chipstar/0001-Fix-irif-CMakeLists.txt-to-find-llvm-link.patch b/recipes-support/chipstar/chipstar/0001-Fix-irif-CMakeLists.txt-to-find-llvm-link.patch new file mode 100644 index 0000000..846d429 --- /dev/null +++ b/recipes-support/chipstar/chipstar/0001-Fix-irif-CMakeLists.txt-to-find-llvm-link.patch @@ -0,0 +1,45 @@ +From f8c861eaae683e6d6f9557d3e50217d29ac60682 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Mon, 17 Jun 2024 10:36:21 +0200 +Subject: [PATCH] Fix irif/CMakeLists.txt to find llvm-link +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [Yocto specific] +Signed-off-by: Zoltán Böszörményi +--- + irif/CMakeLists.txt | 16 ++++++++++------ + 1 file changed, 10 insertions(+), 6 deletions(-) + +diff --git a/irif/CMakeLists.txt b/irif/CMakeLists.txt +index a874772..d9e3502 100644 +--- a/irif/CMakeLists.txt ++++ b/irif/CMakeLists.txt +@@ -11,12 +11,16 @@ file(GLOB sources + + set(irif_lib_file ${CMAKE_CURRENT_BINARY_DIR}/irif.bc) + +-# find_program(LLVM_LINK_EXECUTABLE NAMES llvm-link PATHS ${LLVM_CONFIG_DIR} NO_DEFAULT_PATH) +-# if(NOT LLVM_LINK_EXECUTABLE) +-# message(FATAL_ERROR "llvm-link not found") +-# endif() +-# add_executable(llvm-link IMPORTED) +-# set_target_properties(llvm-link PROPERTIES IMPORTED_LOCATION ${LLVM_LINK_EXECUTABLE}) ++if(NOT DEFINED LLVM_LINK) ++ find_program(LLVM_LINK NAMES llvm-link NO_DEFAULT_PATH PATHS ${CLANG_ROOT_PATH_BIN} ENV PATH) ++ if(NOT LLVM_LINK) ++ message(FATAL_ERROR "Can't find llvm-link. Please provide CMake argument -D$LLVM_LINK=/path/to/llvm-link<-version>") ++ endif() ++endif() ++message(STATUS "Using llvm-link: ${LLVM_LINK}") ++ ++add_executable(llvm-link IMPORTED) ++set_target_properties(llvm-link PROPERTIES IMPORTED_LOCATION ${LLVM_LINK}) + + add_custom_command(OUTPUT ${irif_lib_file} + COMMAND $ ${sources} -o ${irif_lib_file} +-- +2.45.2 + diff --git a/recipes-support/chipstar/chipstar/0001-H4I-HipBLAS-Don-t-set-CMAKE_INSTALL_RPATH.patch b/recipes-support/chipstar/chipstar/0001-H4I-HipBLAS-Don-t-set-CMAKE_INSTALL_RPATH.patch new file mode 100644 index 0000000..3c925ca --- /dev/null +++ b/recipes-support/chipstar/chipstar/0001-H4I-HipBLAS-Don-t-set-CMAKE_INSTALL_RPATH.patch @@ -0,0 +1,30 @@ +From 81c0ab815785aa884e29aa7b7bc8a599185b4a6f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Wed, 19 Jun 2024 07:42:16 +0200 +Subject: [PATCH] H4I-HipBLAS: Don't set CMAKE_INSTALL_RPATH +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [Yocto specific] +Signed-off-by: Zoltán Böszörményi +--- + CMakeLists.txt | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ed479ac..aefcd15 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -51,7 +51,6 @@ file(RELATIVE_PATH relRPath + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR} + ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR} + ) +-set(CMAKE_INSTALL_RPATH $ORIGIN $ORIGIN/${relRPath}) + + # Define a target capturing common configuration settings. + # Although we use 'add_library' for this, it is not a library - +-- +2.45.2 + diff --git a/recipes-support/chipstar/chipstar/0001-Use-TARGET_SYS-for-offload-compiler-commands.patch b/recipes-support/chipstar/chipstar/0001-Use-TARGET_SYS-for-offload-compiler-commands.patch new file mode 100644 index 0000000..c4ac55b --- /dev/null +++ b/recipes-support/chipstar/chipstar/0001-Use-TARGET_SYS-for-offload-compiler-commands.patch @@ -0,0 +1,39 @@ +From 81e528767342d17e06851ea8a932cc8c07d991e9 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Mon, 17 Jun 2024 13:50:00 +0200 +Subject: [PATCH] Use TARGET_SYS for offload compiler commands +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Upstream-Status: Inappropriate [Yocto specific] +Signed-off-by: Zoltán Böszörményi +--- + CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 272e759e..ea989ca2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -493,14 +493,14 @@ set(HIP_OFFLOAD_COMPILE_OPTIONS_INSTALL_ + ${HIP_ENABLE_SPIRV} + ${HIP_OFFLOAD_COMPILE_ONLY_OPTIONS_} + --hip-path=${CMAKE_INSTALL_PREFIX} +- ${HOST_ARCH} ++ --target=${TARGET_SYS} + ${HIP_FIXUPS_HEADER_INSTALL}) + + set(HIP_OFFLOAD_COMPILE_OPTIONS_BUILD_ + ${HIP_ENABLE_SPIRV} + ${HIP_OFFLOAD_COMPILE_ONLY_OPTIONS_} + --hip-path=${CMAKE_BINARY_DIR} +- ${HOST_ARCH} ++ --target=${TARGET_SYS} + ${HIP_FIXUPS_HEADER_BUILD} + -I${CMAKE_SOURCE_DIR}/include + -I${CMAKE_SOURCE_DIR}/HIP/include +-- +2.45.2 + diff --git a/recipes-support/chipstar/chipstar_1.1.900.bb b/recipes-support/chipstar/chipstar_1.1.900.bb new file mode 100644 index 0000000..1a2b822 --- /dev/null +++ b/recipes-support/chipstar/chipstar_1.1.900.bb @@ -0,0 +1,142 @@ +DESCRIPTION = "chipStar is a tool for compiling and running HIP/CUDA on SPIR-V via OpenCL or Level Zero APIs." +SUMMARY = "chipStar: CUDA/HIP over OpenCL or L0" +HOMEPAGE = "https://github.com/CHIP-SPV/chipStar/" +SECTION = "devel" +LICENSE = "MIT" + +DEPENDS = " \ + vim-native llvm spirv-llvm-translator \ +" + +DEPENDS:append:class-native = " ocl-icd-native" + +DEPENDS:append:class-target = " \ + virtual/opencl-icd spirv-llvm-translator-native \ + chipstar-native \ +" + +TOOLCHAIN = "clang" + +inherit qemu cmake clang + +LIC_FILES_CHKSUM = "file://LICENSE;md5=18c85a1e3dc7c297bc0ab9ed498ceb21" + +SRC_URI = " \ + gitsm://github.com/CHIP-SPV/chipStar.git;protocol=https;nobranch=1 \ + file://0001-Fix-irif-CMakeLists.txt-to-find-llvm-link.patch;patchdir=${S}/bitcode/ROCm-Device-Libs \ + file://0001-Fix-executing-commands-in-opencl_bc_lib-macro-in-cma.patch;patchdir=${S}/bitcode/ROCm-Device-Libs \ +" + +SRC_URI:append:class-target = " \ + file://0001-Use-TARGET_SYS-for-offload-compiler-commands.patch \ + file://0001-Build-hipInfo-with-native-hipcc.patch \ + file://0001-Build-ccompat-with-native-hipcc.patch \ + file://0001-Eliminate-RPATH.patch \ + file://0001-H4I-HipBLAS-Don-t-set-CMAKE_INSTALL_RPATH.patch;patchdir=${S}/H4I-HipBLAS \ +" + +SRCREV = "2403b0b16d0e5c29d3ef8d5ad73387eb975be4e1" + +S = "${WORKDIR}/git" + +EXTRA_OECMAKE = " \ + -DLLVM_DIR=${STAGING_LIBDIR}/cmake/llvm \ + -DClang_DIR=${STAGING_LIBDIR}/cmake/clang \ + -DCatch2_DIR=${S}/HIP/tests/catch/external/Catch2/cmake/Catch2 \ + -DCHIP_ENABLE_NON_COMPLIANT_DEVICELIB_CODE=ON \ + -DCHIP_FAST_MATH=ON \ + -DCHIP_USE_INTEL_USM=ON \ +" + +EXTRA_OECMAKE:prepend:class-target = " \ + -DPREPARE_BUILTINS=${STAGING_BINDIR_NATIVE}/chipstar-prepare-builtins \ + -DCMAKE_CXX_COMPILER_PATH=${STAGING_BINDIR_NATIVE}/${TARGET_SYS}/${TARGET_PREFIX}clang++ \ + -DCMAKE_C_COMPILER_PATH=${STAGING_BINDIR_NATIVE}/${TARGET_SYS}/${TARGET_PREFIX}clang \ + -DTARGET_SYS=${TARGET_SYS} \ +" + +PACKAGECONFIG ?= "" + +# Does not really work (yet?) +PACKAGECONFIG[hipblas] = "-DCHIP_BUILD_HIPBLAS=ON -DCMAKE_MODULE_PATH=${RECIPE_SYSROOT}/opt/intel/oneapi/compiler/2024.0/lib/cmake -DINTEL_COMPILER_PATH=${RECIPE_SYSROOT_NATIVE}/opt/intel/oneapi/compiler/2024.0/bin/icpx,-DCHIP_BUILD_HIPBLAS=OFF,intel-oneapi-dpcpp-cpp-native intel-oneapi-dpcpp-cpp-runtime-native intel-oneapi-mkl-native" + +# Prevent "error: unknown FP unit 'sse' +TUNE_CCARGS:remove:x86-64:class-target = "-mfpmath=sse" + +chipstar_enable_icpx () { + if [ "${@bb.utils.contains('PACKAGECONFIG', 'hipblas', '1', '0', d)}" = "1" ]; then + . ${RECIPE_SYSROOT_NATIVE}/opt/intel/oneapi/setvars.sh + fi +} + +do_configure:prepend () { + chipstar_enable_icpx +} + +do_configure:prepend:class-target () { + # Target build fails if it finds nvcc pointing to cucc + #rm -f ${STAGING_BINDIR_NATIVE}/nvcc +} + +do_configure:append:class-target () { + sed -i \ + -e 's,${S},${prefix}/src/${PN}-${PV},' \ + -e 's,${B},${prefix}/src/${PN}-${PV}/build,' \ + ${B}/include/chipStarConfig.hh +} + +do_compile[network] = "1" + +do_compile:prepend () { + chipstar_enable_icpx +} + +do_install:append () { + mv ${D}${prefix}/cmake/* ${D}${libdir}/cmake/ + rmdir ${D}${prefix}/cmake + chmod 0755 ${D}${libdir}/libCHIP.so + + # Fake nvcc + ln -s cucc ${D}${bindir}/nvcc +} + +do_install:append:class-target () { + sed -i \ + -e 's,${STAGING_DIR_HOST},,' \ + -e 's,${STAGING_DIR_NATIVE},,' \ + ${D}${bindir}/cuspvc \ + ${D}${datadir}/.hipInfo \ + ${D}${libdir}/cmake/*/*.cmake +} + +do_install:append:class-native () { + install -m0755 ${B}/bitcode/ROCm-Device-Libs/utils/prepare-builtins/prepare-builtins ${D}${bindir}/chipstar-prepare-builtins +} + +SYSROOT_PREPROCESS_FUNCS += "chipstar_sysroot_preprocess" + +chipstar_sysroot_preprocess () { + install -d ${SYSROOT_DESTDIR}${bindir_crossscripts}/ + install -m 755 ${D}${bindir}/cucc ${SYSROOT_DESTDIR}${bindir_crossscripts}/ + ln -s cucc ${SYSROOT_DESTDIR}${bindir_crossscripts}/nvcc + + sed -i \ + -e 's,return "${prefix}",return os.environ["STAGING_EXECPREFIXDIR"],' \ + -e 's,return get_hip_path() + "/bin/hipcc",return os.environ["STAGING_BINDIR_NATIVE"] + "/hipcc",' \ + ${SYSROOT_DESTDIR}${bindir_crossscripts}/cucc +} + +PACKAGES =+ "${PN}-device-libs ${PN}-libs ${PN}-samples" + +RDEPENDS:${PN} += "bash python3" + +FILES:${PN}-device-libs = "${libdir}/hip-device-lib/" + +FILES:${PN}-libs = "${libdir}/libCHIP.so ${libdir}/llvm/" +RDEPENDS:${PN}-libs += "${PN}-device-libs" + +FILES:${PN}-samples = "${bindir}/chip_spv_samples" + +FILES:${PN}-dev += "${bindir}/.hipVersion ${datadir}/.hipInfo" + +BBCLASSEXTEND = "native" diff --git a/recipes-support/dpcpp-compiler/intel-oneapi-dpcpp-cpp-runtime_%.bbappend b/recipes-support/dpcpp-compiler/intel-oneapi-dpcpp-cpp-runtime_%.bbappend new file mode 100644 index 0000000..20cd826 --- /dev/null +++ b/recipes-support/dpcpp-compiler/intel-oneapi-dpcpp-cpp-runtime_%.bbappend @@ -0,0 +1,2 @@ +SYSROOT_DIRS += "/opt" +SYSROOT_DIRS_NATIVE += "${RECIPE_SYSROOT_NATIVE}/opt" diff --git a/recipes-support/dpcpp-compiler/intel-oneapi-dpcpp-cpp_%.bbappend b/recipes-support/dpcpp-compiler/intel-oneapi-dpcpp-cpp_%.bbappend new file mode 100644 index 0000000..c9f9ba7 --- /dev/null +++ b/recipes-support/dpcpp-compiler/intel-oneapi-dpcpp-cpp_%.bbappend @@ -0,0 +1,7 @@ +SYSROOT_DIRS += "/opt" +SYSROOT_DIRS_NATIVE += "${RECIPE_SYSROOT_NATIVE}/opt" + +do_install:append () { + MAINVER=$(echo ${PV} | cut -d '.' -f 1-2) + ln -s $MAINVER ${D}${RECIPE_SYSROOT_NATIVE}/opt/intel/oneapi/compiler/latest +} diff --git a/recipes-support/mkl/intel-oneapi-mkl_%.bbappend b/recipes-support/mkl/intel-oneapi-mkl_%.bbappend new file mode 100644 index 0000000..58ec41d --- /dev/null +++ b/recipes-support/mkl/intel-oneapi-mkl_%.bbappend @@ -0,0 +1,2 @@ +BBCLASSEXTEND = "native nativesdk" +SYSROOT_DIRS_NATIVE += "${RECIPE_SYSROOT_NATIVE}/opt" diff --git a/recipes-support/opencl/ocl-icd_%.bbappend b/recipes-support/opencl/ocl-icd_%.bbappend new file mode 100644 index 0000000..8c7ada4 --- /dev/null +++ b/recipes-support/opencl/ocl-icd_%.bbappend @@ -0,0 +1,2 @@ +PV = "2.3.2" +SRCREV = "fdde6677b21329432db8b481e2637cd10f7d3cb2" diff --git a/recipes-support/tbb/tbb/0001-Don-t-use-upper-limit-for-GCC-version-in-concurrent_.patch b/recipes-support/tbb/tbb/0001-Don-t-use-upper-limit-for-GCC-version-in-concurrent_.patch new file mode 100644 index 0000000..f7cdd88 --- /dev/null +++ b/recipes-support/tbb/tbb/0001-Don-t-use-upper-limit-for-GCC-version-in-concurrent_.patch @@ -0,0 +1,51 @@ +From 7e8de483c7c7c7e9589bacdebb0c5308f833c287 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= + +Date: Wed, 19 Jun 2024 14:54:50 +0200 +Subject: [PATCH] Don't use upper limit for GCC version in concurrent_monitor.h +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This fixes a compiler error in GCC 14: + +| In file included from /usr/include/c++/14/atomic:50, +| from tmp-sicom-glibc/work/x86_64-linux/tbb-native/2021.12.0/git/src/tbb/../../include/oneapi/tbb/detail/_utils.h:22, +| from tmp-sicom-glibc/work/x86_64-linux/tbb-native/2021.12.0/git/src/tbb/task_dispatcher.h:20, +| from tmp-sicom-glibc/work/x86_64-linux/tbb-native/2021.12.0/git/src/tbb/arena.cpp:17: +| In member function ‘void std::__atomic_base<_IntTp>::store(__int_type, std::memory_order) [with _ITp = bool]’, +| inlined from ‘void std::atomic::store(bool, std::memory_order)’ at /usr/include/c++/14/atomic:109:20, +| inlined from ‘void tbb::detail::r1::concurrent_monitor_base::notify_one_relaxed() [with Context = long unsigned int]’ at tmp-sicom-glibc/work/x86_64-linux/tbb-native/2021.12.0/git/src/tbb/concurrent_monitor.h:300:53: +| /usr/include/c++/14/bits/atomic_base.h:477:25: error: ‘void __atomic_store_1(volatile void*, unsigned char, int)’ writing 1 byte into a region of size 0 overflows the destination [-Werror=stringop-overflow=] +| 477 | __atomic_store_n(&_M_i, __i, int(__m)); +| | ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ +| compilation terminated due to -Wfatal-errors. +| cc1plus: all warnings being treated as errors + +Signed-off-by: Zoltán Böszörményi +--- + src/tbb/concurrent_monitor.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/tbb/concurrent_monitor.h b/src/tbb/concurrent_monitor.h +index 3e5c4beb..c84552f6 100644 +--- a/src/tbb/concurrent_monitor.h ++++ b/src/tbb/concurrent_monitor.h +@@ -293,12 +293,12 @@ public: + + // GCC 12.x-13.x issues a warning here that to_wait_node(n)->my_is_in_list might have size 0, since n is + // a base_node pointer. (This cannot happen, because only wait_node pointers are added to my_waitset.) +-#if (__TBB_GCC_VERSION >= 120100 && __TBB_GCC_VERSION < 140000 ) && !__clang__ && !__INTEL_COMPILER ++#if (__TBB_GCC_VERSION >= 120100 ) && !__clang__ && !__INTEL_COMPILER + #pragma GCC diagnostic push + #pragma GCC diagnostic ignored "-Wstringop-overflow" + #endif + to_wait_node(n)->my_is_in_list.store(false, std::memory_order_relaxed); +-#if (__TBB_GCC_VERSION >= 120100 && __TBB_GCC_VERSION < 140000 ) && !__clang__ && !__INTEL_COMPILER ++#if (__TBB_GCC_VERSION >= 120100 ) && !__clang__ && !__INTEL_COMPILER + #pragma GCC diagnostic pop + #endif + } +-- +2.45.2 + diff --git a/recipes-support/tbb/tbb_%.bbappend b/recipes-support/tbb/tbb_%.bbappend new file mode 100644 index 0000000..de1a4b7 --- /dev/null +++ b/recipes-support/tbb/tbb_%.bbappend @@ -0,0 +1,7 @@ +PV = "2021.12.0" +SRCREV = "9afd759b72c0c233cd5ea3c3c06b0894c9da9c54" + +SRC_URI:remove = "file://0001-CMakeLists.txt-exclude-riscv64-riscv32.patch" + +FILESEXTRAPATHS:prepend := "${THISDIR}/${BPN}:" +SRC_URI:append = " file://0001-Don-t-use-upper-limit-for-GCC-version-in-concurrent_.patch"