Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package intel-graphics-compiler for openSUSE:Factory checked in at 2025-01-27 20:50:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/intel-graphics-compiler (Old) and /work/SRC/openSUSE:Factory/.intel-graphics-compiler.new.2316 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "intel-graphics-compiler" Mon Jan 27 20:50:33 2025 rev:16 rq:1239876 version:2.5.6 Changes: -------- --- /work/SRC/openSUSE:Factory/intel-graphics-compiler/intel-graphics-compiler.changes 2024-08-14 14:15:54.067173136 +0200 +++ /work/SRC/openSUSE:Factory/.intel-graphics-compiler.new.2316/intel-graphics-compiler.changes 2025-01-27 20:50:36.923153897 +0100 @@ -1,0 +2,17 @@ +Wed Jan 15 08:48:35 UTC 2025 - Patrik Jakobsson <patrik.jakobs...@suse.com> + +- Don't include versioned libs in devel packages +- Create missing .so links + +------------------------------------------------------------------- +Thu Jan 9 11:48:07 UTC 2025 - Patrik Jakobsson <patrik.jakobs...@suse.com> + +- Update to version 2.5.6 + * No changelog was made available +- Update opencl_clang to 470cf0018e1ef6fc92eda1356f5f31f7da452abc +- Update spirv_llvm_translator to efbedd32b700c01a15d44121fca862625c2594ac +- Update vc_intrinsics to v0.21.0 +- Removed 0001-Use-patch-instead-of-git-to-apply-opencl-clang-patch.patch + * No longer needed + +------------------------------------------------------------------- Old: ---- 0001-Use-patch-instead-of-git-to-apply-opencl-clang-patch.patch igc-1.0.17193.4.tar.gz New: ---- v2.5.6.tar.gz BETA DEBUG BEGIN: Old:- Update vc_intrinsics to v0.21.0 - Removed 0001-Use-patch-instead-of-git-to-apply-opencl-clang-patch.patch * No longer needed BETA DEBUG END: ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ intel-graphics-compiler.spec ++++++ --- /var/tmp/diff_new_pack.ZpLziy/_old 2025-01-27 20:50:39.659266855 +0100 +++ /var/tmp/diff_new_pack.ZpLziy/_new 2025-01-27 20:50:39.659266855 +0100 @@ -1,7 +1,7 @@ # # spec file for package intel-graphics-compiler # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,22 +17,22 @@ %global llvm_commit llvmorg-14.0.5 -%global opencl_clang_commit 66a54cbef6726c4e791986779a60d7a45b09c9c9 -%global spirv_llvm_translator_commit 62f5b09b11b1da42274371b1f7535f6f2ab11485 -%global vc_intrinsics_commit v0.18.0 +%global opencl_clang_commit 470cf0018e1ef6fc92eda1356f5f31f7da452abc +%global spirv_llvm_translator_commit efbedd32b700c01a15d44121fca862625c2594ac +%global vc_intrinsics_commit v0.21.0 +%global so_version 2.5.0 Name: intel-graphics-compiler -Version: 1.0.17193.4 +Version: 2.5.6 Release: 1%{?dist} Summary: Intel Graphics Compiler for OpenCL License: MIT Group: Development/Libraries/C and C++ -URL: https://github.com/intel/intel-graphics-compile -Source0: https://github.com/intel/intel-graphics-compiler/archive/igc-%{version}.tar.gz +URL: http://github.com/intel/intel-graphics-compile +Source0: https://github.com/intel/intel-graphics-compiler/archive/v%{version}.tar.gz Source1: https://github.com/intel/opencl-clang/archive/%{opencl_clang_commit}/intel-opencl-clang.tar.gz Source2: https://github.com/KhronosGroup/SPIRV-LLVM-Translator/archive/%{spirv_llvm_translator_commit}/spirv-llvm-translator.tar.gz Source3: https://github.com/llvm/llvm-project/archive/%{llvm_commit}/llvm-project.tar.gz Source4: https://github.com/intel/vc-intrinsics/archive/%{vc_intrinsics_commit}/vc-intrinsics.zip -Patch0: 0001-Use-patch-instead-of-git-to-apply-opencl-clang-patch.patch BuildRequires: bison BuildRequires: cmake BuildRequires: flex @@ -44,6 +44,7 @@ BuildRequires: pkgconfig BuildRequires: python3 BuildRequires: python3-Mako +BuildRequires: python3-PyYAML BuildRequires: spirv-headers BuildRequires: spirv-tools-devel BuildRequires: unzip @@ -52,16 +53,16 @@ %description Intel Graphics Compiler for OpenCL. -%package -n libigc1 +%package -n libigc2 Summary: Library for Intel Graphics Compiler Group: System/Libraries -%description -n libigc1 +%description -n libigc2 An LLVM based compiler for OpenCL targeting Intel Gen graphics hardware architecture. %package -n libigc-devel Summary: Headers for the Intel Graphics Compiler library -Requires: libigc1 = %{version}-%{release} +Requires: libigc2 = %{version}-%{release} %description -n libigc-devel This package contains development files for libigc. @@ -73,30 +74,30 @@ %description -n iga Assembler and disassembler for OpenCL kernels. -%package -n libiga64-1 +%package -n libiga64-2 Summary: Library for Intel Graphics Assembler Group: System/Libraries -%description -n libiga64-1 +%description -n libiga64-2 Library files for Intel Graphics Assembler. %package -n libiga-devel Summary: Headers for the Intel Graphics Assembler library -Requires: libiga64-1 = %{version}-%{release} +Requires: libiga64-2 = %{version}-%{release} %description -n libiga-devel This package contains development files for libiga -%package -n libigdfcl1 +%package -n libigdfcl2 Summary: Intel Graphics Frontend Compiler library Group: System/Libraries -%description -n libigdfcl1 +%description -n libigdfcl2 Library files for the Intel Graphics Frontend Compiler. %package -n libigdfcl-devel Summary: Headers for the Intel Graphics Frontend Compiler library -Requires: libigdfcl1 = %{version}-%{release} +Requires: libigdfcl2 = %{version}-%{release} %description -n libigdfcl-devel This package contains development files for libigdfcl. @@ -120,14 +121,11 @@ pushd llvm-project/llvm/projects mkdir opencl-clang llvm-spirv tar -xzf %{_sourcedir}/intel-opencl-clang.tar.gz -C opencl-clang --strip-components=1 -pushd opencl-clang -%patch -P 0 -p1 -popd tar -xzf %{_sourcedir}/spirv-llvm-translator.tar.gz -C llvm-spirv --strip-components=1 popd mkdir igc -tar -xzf %{_sourcedir}/igc-%{version}.tar.gz -C igc --strip-components=1 +tar -xzf %{_sourcedir}/v%{version}.tar.gz -C igc --strip-components=1 pushd igc popd @@ -163,36 +161,39 @@ %{buildroot}%{_includedir}/opencl-c-base.h \ %{buildroot}%{_prefix}/lib/debug chmod +x %{buildroot}%{_libdir}/libopencl-clang.so.14 - -%post -n libigc1 -p /sbin/ldconfig -%postun -n libigc1 -p /sbin/ldconfig -%post -n libiga64-1 -p /sbin/ldconfig -%postun -n libiga64-1 -p /sbin/ldconfig -%post -n libigdfcl1 -p /sbin/ldconfig -%postun -n libigdfcl1 -p /sbin/ldconfig +ln -s %{_libdir}/libiga64.so.%{so_version} %{buildroot}%{_libdir}/libiga64.so +ln -s %{_libdir}/libigc.so.%{so_version} %{buildroot}%{_libdir}/libigc.so +ln -s %{_libdir}/libigdfcl.so.%{so_version} %{buildroot}%{_libdir}/libigdfcl.so + +%post -n libigc2 -p /sbin/ldconfig +%postun -n libigc2 -p /sbin/ldconfig +%post -n libiga64-2 -p /sbin/ldconfig +%postun -n libiga64-2 -p /sbin/ldconfig +%post -n libigdfcl2 -p /sbin/ldconfig +%postun -n libigdfcl2 -p /sbin/ldconfig %post -n libopencl-clang14 -p /sbin/ldconfig %postun -n libopencl-clang14 -p /sbin/ldconfig %files -n iga %{_bindir}/iga64 -%files -n libiga64-1 +%files -n libiga64-2 %{_libdir}/libiga64.so.* %files -n libiga-devel %{_libdir}/libiga64.so %{_includedir}/iga -%files -n libigc1 +%files -n libigc2 %{_libdir}/libigc.so.* -%dir %{_libdir}/igc -%license %{_libdir}/igc/NOTICES.txt +%dir %{_libdir}/igc2 +%license %{_libdir}/igc2/NOTICES.txt %files -n libigc-devel %{_libdir}/libigc.so %{_includedir}/igc -%files -n libigdfcl1 +%files -n libigdfcl2 %{_libdir}/libigdfcl.so.* %files -n libigdfcl-devel ++++++ intel-opencl-clang.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opencl-clang-66a54cbef6726c4e791986779a60d7a45b09c9c9/CMakeLists.txt new/opencl-clang-470cf0018e1ef6fc92eda1356f5f31f7da452abc/CMakeLists.txt --- old/opencl-clang-66a54cbef6726c4e791986779a60d7a45b09c9c9/CMakeLists.txt 2024-06-06 06:52:53.000000000 +0200 +++ new/opencl-clang-470cf0018e1ef6fc92eda1356f5f31f7da452abc/CMakeLists.txt 2024-07-09 07:28:19.000000000 +0200 @@ -40,6 +40,10 @@ llvm_create_cross_target(${PROJECT_NAME} NATIVE "" Release) endif() +option(LLVMSPIRV_INCLUDED_IN_LLVM + "Set to ON if libLLVMSPIRVLib is linked into libLLVM" ON) +option(APPLY_PATCHES "Apply local patches" ON) + if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) set(USE_PREBUILT_LLVM ON) @@ -61,8 +65,6 @@ set(CMAKE_CXX_STANDARD 14) set(CMAKE_CXX_STANDARD_REQUIRED ON) - option(LLVMSPIRV_INCLUDED_IN_LLVM - "Set to ON if libLLVMSPIRVLib is linked into libLLVM" ON) if(LLVMSPIRV_INCLUDED_IN_LLVM) message(STATUS "[OPENCL-CLANG] Assuming that libLLVMSPIRVLib is linked into libLLVM") else(LLVMSPIRV_INCLUDED_IN_LLVM) @@ -152,16 +154,19 @@ 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} - ret) + if(APPLY_PATCHES) + message(STATUS "APPLY_PATCHES is enabled.") + apply_patches(${LLVM_MONOREPO_DIR} + "${LLVM_PATCHES_DIRS}" + ${LLVM_BASE_REVISION} + ${TARGET_BRANCH}) + apply_patches(${SPIRV_SOURCE_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/patches/spirv + ${SPIRV_BASE_REVISION} + ${TARGET_BRANCH}) + else() + message(STATUS "APPLY_PATCHES is disabled, skip patch apply process.") + endif() endif(NOT USE_PREBUILT_LLVM) # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/opencl-clang-66a54cbef6726c4e791986779a60d7a45b09c9c9/cmake/modules/CMakeFunctions.cmake new/opencl-clang-470cf0018e1ef6fc92eda1356f5f31f7da452abc/cmake/modules/CMakeFunctions.cmake --- old/opencl-clang-66a54cbef6726c4e791986779a60d7a45b09c9c9/cmake/modules/CMakeFunctions.cmake 2024-06-06 06:52:53.000000000 +0200 +++ new/opencl-clang-470cf0018e1ef6fc92eda1356f5f31f7da452abc/cmake/modules/CMakeFunctions.cmake 2024-07-09 07:28:19.000000000 +0200 @@ -87,7 +87,7 @@ # Then all patches from the `patches_dir` are committed to the `target_branch`. # Does nothing if the `target_branch` is already checked out in the `repo_dir`. # -function(apply_patches repo_dir patches_dir base_revision target_branch ret) +function(apply_patches repo_dir patches_dir base_revision target_branch) foreach(patches_dir ${patches_dir}) file(GLOB patches_in_dir ${patches_dir}/*.patch) list(APPEND patches ${patches_in_dir}) @@ -97,7 +97,13 @@ return() endif() - message(STATUS "[OPENCL-CLANG] Patching repository ${repo_dir}") + # Check if it's a git repo + if(EXISTS "${repo_dir}/.git") + message(STATUS "[OPENCL-CLANG] Patching repository ${repo_dir}") + else() + message(STATUS "[OPENCL-CLANG][Warning] ${repo_dir} is not a git repository, therefore, local patches are not applied") + return() + endif() # Check if the target branch already exists execute_process( COMMAND ${GIT_EXECUTABLE} rev-parse --verify --no-revs -q ${target_branch} @@ -105,9 +111,7 @@ RESULT_VARIABLE patches_needed OUTPUT_QUIET ) - if(patches_needed EQUAL 128) # not a git repo - set(ret_not_git_repo 1) - elseif(patches_needed) # The target branch doesn't exist + if(patches_needed EQUAL 1) # The target branch doesn't exist list(SORT patches) is_valid_revision(${repo_dir} ${base_revision} exists_base_rev) @@ -147,7 +151,7 @@ endif() endif() endforeach(patch) - else() # The target branch already exists + elseif(patches_needed EQUAL 0) # The target branch already exists execute_process( # Check it out COMMAND ${GIT_EXECUTABLE} checkout ${target_branch} WORKING_DIRECTORY ${repo_dir} @@ -155,8 +159,8 @@ RESULT_VARIABLE ret_check_out ) endif() - if (NOT (ret_not_git_repo OR ret_check_out OR ret_apply_patch)) - set(${ret} True PARENT_SCOPE) + if (NOT (ret_check_out OR ret_apply_patch)) + message(STATUS "[OPENCL-CLANG] Applied patch successfully!") else() message(FATAL_ERROR "[OPENCL-CLANG] Failed to apply patch!") endif() ++++++ spirv-llvm-translator.tar.gz ++++++ ++++ 4598 lines of diff (skipped) ++++++ vc-intrinsics.zip ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/.github/workflows/on-pr-update.yml new/vc-intrinsics-0.21.0/.github/workflows/on-pr-update.yml --- old/vc-intrinsics-0.18.0/.github/workflows/on-pr-update.yml 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/.github/workflows/on-pr-update.yml 2024-11-26 19:19:54.000000000 +0100 @@ -11,17 +11,24 @@ status: pull_request_review: +permissions: + contents: read + jobs: notify: runs-on: [self-hosted, linux, gfx] steps: - name: Get branch name if status changed if: github.event_name == 'status' + env: + PR_BR_NAME: ${{ github.event.branches[0].name }} run: > - echo "os_branch=${{ github.event.branches[0].name }}" >> $GITHUB_ENV + echo "os_branch=$PR_BR_NAME" >> $GITHUB_ENV - name: Get branch name if pr review state changed if: github.event_name == 'pull_request_review' + env: + PR_HEAD_REF: ${{ github.event.pull_request.head.ref }} run: > - echo "os_branch=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV + echo "os_branch=$PR_HEAD_REF" >> $GITHUB_ENV - name: Notify run: ${{ secrets.NOTIFY }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/CMakeLists.txt new/vc-intrinsics-0.21.0/CMakeLists.txt --- old/vc-intrinsics-0.18.0/CMakeLists.txt 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/CMakeLists.txt 2024-11-26 19:19:54.000000000 +0100 @@ -12,13 +12,12 @@ set(LLVM_GENX_INTRINSICS_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) +option(LLVM_GENX_INTRINSICS_IN_TREE_INSTALL "Do install after in-tree build" FALSE) + # check if we build inside llvm or not if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) get_filename_component(LLVM_CMAKE_PATH ${LLVM_DIR} ABSOLUTE BASE_DIR ${CMAKE_BINARY_DIR}) set(BUILD_EXTERNAL YES) - if(NOT DEFINED INSTALL_REQUIRED) - set(INSTALL_REQUIRED YES) - endif() project(LLVM_GenXIntrinsics VERSION ${LLVM_GENX_INTRINSICS_VERSION} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/CMakeLists.txt new/vc-intrinsics-0.21.0/GenXIntrinsics/CMakeLists.txt --- old/vc-intrinsics-0.18.0/GenXIntrinsics/CMakeLists.txt 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/CMakeLists.txt 2024-11-26 19:19:54.000000000 +0100 @@ -47,44 +47,40 @@ endif() endif() -# this option is to switch on install when we are building not inside IGC -if(INSTALL_REQUIRED) - install(DIRECTORY include/llvm - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - COMPONENT genx-intrinsics-headers - FILES_MATCHING - PATTERN "*.h" - ) +install(DIRECTORY include/llvm + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + COMPONENT genx-intrinsics-headers + FILES_MATCHING + PATTERN "*.h" +) + +# cmake creates too many subdirectories in build directory +# and then "install(DIRECTORY" installs them even if they are empty +# so generated file has to be installed separetely +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/llvm/GenXIntrinsics/${GENX_INTRINSICS_DESCRIPTION} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm/GenXIntrinsics + COMPONENT genx-intrinsics-headers +) + +install(TARGETS LLVMGenXIntrinsics EXPORT LLVMGenXIntrinsicsTargets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) - # cmake creates too many subdirectories in build directory - # and then "install(DIRECTORY" installs them even if they are empty - # so generated file has to be installed separetely - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/llvm/GenXIntrinsics/${GENX_INTRINSICS_DESCRIPTION} - DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/llvm/GenXIntrinsics - COMPONENT genx-intrinsics-headers +# Install Config-file only for external build +if(BUILD_EXTERNAL OR LLVM_GENX_INTRINSICS_IN_TREE_INSTALL) + + # Legacy export. To remove when all clients switch to new name. + install(EXPORT LLVMGenXIntrinsicsTargets + FILE LLVMGenXIntrinsicsConfig.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LLVMGenXIntrinsics ) - # for now not clear do we need to check deps on install, - # so config will only contain single file - # we need to limit it to external build - if(BUILD_EXTERNAL) - install(TARGETS LLVMGenXIntrinsics EXPORT LLVMGenXIntrinsicsTargets - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - ) - - # Legacy export. To remove when all clients switch to new name. - install(EXPORT LLVMGenXIntrinsicsTargets - FILE LLVMGenXIntrinsicsConfig.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/LLVMGenXIntrinsics - ) - - set(PACKAGE_NAME VCIntrinsics${LLVM_VERSION_MAJOR}) - install(EXPORT LLVMGenXIntrinsicsTargets - FILE ${PACKAGE_NAME}Config.cmake - DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME} - ) - endif() # BUILD_EXTERNAL -endif() # INSTALL_REQUIRED + set(PACKAGE_NAME VCIntrinsics${LLVM_VERSION_MAJOR}) + install(EXPORT LLVMGenXIntrinsicsTargets + FILE ${PACKAGE_NAME}Config.cmake + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PACKAGE_NAME} + ) +endif() # BUILD_EXTERNAL OR LLVM_GENX_INTRINSICS_IN_TREE_INSTALL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/CMakeLists.txt new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/CMakeLists.txt --- old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/CMakeLists.txt 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/CMakeLists.txt 2024-11-26 19:19:54.000000000 +0100 @@ -1,6 +1,6 @@ #=========================== begin_copyright_notice ============================ # -# Copyright (C) 2019-2021 Intel Corporation +# Copyright (C) 2019-2024 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -29,7 +29,7 @@ endif() if(${LLVM_VERSION_MAJOR} LESS 9) - find_file(FOUND_VCS GetSVN.cmake PATHS ${LLVM_CMAKE_DIR} REQUIRED) + find_file(FOUND_VCS GetSVN.cmake PATHS ${LLVM_CMAKE_DIR} REQUIRED NO_CMAKE_FIND_ROOT_PATH) add_custom_command( OUTPUT "${version_inc}" COMMAND @@ -38,7 +38,7 @@ "-DHEADER_FILE=${version_inc}" -P "${FOUND_VCS}") else() - find_file(FOUND_VCS VersionFromVCS.cmake PATHS ${LLVM_CMAKE_DIR} REQUIRED) + find_file(FOUND_VCS VersionFromVCS.cmake PATHS ${LLVM_CMAKE_DIR} REQUIRED NO_CMAKE_FIND_ROOT_PATH) add_custom_command( OUTPUT "${version_inc}" COMMAND @@ -59,3 +59,4 @@ ) add_custom_target(GenXIntrinsicsGen) add_dependencies(GenXIntrinsicsGen GenXIntrinsicDescriptionGen) + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsicInst.h new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsicInst.h --- old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsicInst.h 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsicInst.h 2024-11-26 19:19:54.000000000 +0100 @@ -50,12 +50,8 @@ } // Methods for support type inquiry through isa, cast, and dyn_cast: - static bool classof(const CallInst *I) { - if (const Function *CF = I->getCalledFunction()) { - return CF->getName().startswith(GenXIntrinsic::getGenXIntrinsicPrefix()); - } - return false; - } + static bool classof(const CallInst *I); + static bool classof(const Value *V) { return isa<CallInst>(V) && classof(cast<CallInst>(V)); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h --- old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h 2024-11-26 19:19:54.000000000 +0100 @@ -23,6 +23,9 @@ #include "llvm/IR/Intrinsics.h" #include "llvm/IR/Instructions.h" #include "llvm/GenXIntrinsics/GenXVersion.h" +#if LLVM_VERSION_MAJOR >= 16 +#include "llvm/Support/ModRef.h" +#endif namespace llvm { @@ -138,9 +141,7 @@ /// the function's name starts with "llvm.genx.". /// It's possible for this function to return true while getGenXIntrinsicID() /// returns GenXIntrinsic::not_genx_intrinsic! -inline bool isGenXIntrinsic(const Function *CF) { - return CF->getName().startswith(getGenXIntrinsicPrefix()); -} +bool isGenXIntrinsic(const Function *CF); /// GenXIntrinsic::isGenXIntrinsic(V) - Returns true if /// the function's name starts with "llvm.genx.". @@ -294,15 +295,8 @@ /// using iAny, fAny, vAny, or iPTRAny). For a declaration of an overloaded /// intrinsic, Tys must provide exactly one type for each overloaded type in /// the intrinsic. -inline Function *getAnyDeclaration(Module *M, unsigned id, - ArrayRef<Type *> Tys = {}) { - assert(isAnyNonTrivialIntrinsic(id)); - if (isGenXIntrinsic(id)) { - return getGenXDeclaration(M, (ID)id, Tys); - } else { - return Intrinsic::getDeclaration(M, (Intrinsic::ID)id, Tys); - } -} +Function *getAnyDeclaration(Module *M, unsigned id, + ArrayRef<Type *> Tys = {}); /// GenXIntrinsic::getGenXMulIID(S1, S2) - returns GenXIntrinsic::ID for /// the enx_XXmul opertation, where XX is is defined by the input arguments diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/Intrinsic_definitions.py new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/Intrinsic_definitions.py --- old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/Intrinsic_definitions.py 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/Intrinsic_definitions.py 2024-11-26 19:19:54.000000000 +0100 @@ -1589,20 +1589,37 @@ }, ### ``llvm.genx.dpas2.<return type>.<vector type>.<vector type>.<vector type>`` : dpas instruction (Dot Product Accumulate Systolic) -### ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +### ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ### ### * arg0: accumulator first input value, vector integer/float type ### * arg1: src1 input value, vector integer/float type ### * arg2: src2 fourth input value, integer type ### * arg3: int information of src1 PresisionType ### * arg4: int information of src2 PresisionType -### * arg5: int SystolicDepth -### * arg6: int RepeatCount +### * arg5: int SystolicDepth, must be a constant, the only supported value is 8 +### * arg6: int RepeatCount, must be a constant in range [1, 8] ### * arg7: int sign dst( 0 - unsigned, 1 sign) ### * arg8: int sign src0 ### ### * Return value: result ### +### The src1 and src2 PrecisionType arguments should be enum values defined as follows: +### +### +---------------+-------+-------------------------------------------------+ +### | PrecisionType | Value | Description | +### +---------------+-------+-------------------------------------------------+ +### | S2 | 3 | 2-bit signed integer | +### | U2 | 4 | 2-bit unsigned integer | +### | S4 | 5 | 4-bit signed integer | +### | U4 | 6 | 4-bit unsigned integer | +### | S8 | 7 | 8-bit signed integer | +### | U8 | 8 | 8-bit unsigned integer | +### | BF16 | 9 | bfloat16 (S1E8M7) floating point | +### | HF16 | 10 | half-precision (S1E5M10) floating point | +### | TF32 | 12 | tensorfloat32 (S1E8M10) floating point | +### +---------------+-------+-------------------------------------------------+ +### +### "dpas2" : { "result" : "anyvector", "arguments" : ["anyvector","anyvector","anyvector","int","int", "int", "int", "int", "int"], "attributes" : "NoMem", @@ -1873,9 +1890,27 @@ ### "qf_cvt" : { "result" : "anyvector", "arguments" : ["anyvector"], - "attributes" : "NoMem" + "attributes" : "NoMem", + "platforms" : "Xe3+" }, +### hf8_cvt +### ^^^^^^ +### +### ``llvm.genx.hf8.cvt.<return type>.<vector type>`` : hf8_cvt instruction +### ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +### * ``llvm.genx.hf8.cvt`` : hf8<->half conversion +### +### * arg0: first input, any scalar/vector i8/half type (overloaded) +### +### * Return value: result, must be i8 if arg0 is half, or half if arg0 is i8. +### + "hf8_cvt" : { "result" : "anyvector", + "arguments" : ["anyvector"], + "attributes" : "NoMem", + "platforms" : "Xe3+" + }, + ### ``llvm.genx.lsc.load.*.<return type if not void>.<any type>.<any type>`` : lsc_load instructions ### ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ### @@ -2294,6 +2329,112 @@ "attributes" : "None" }, +### ``llvm.genx.lsc.*.2d.ugm.desc.*`` : 2d block load/store/prefetch instructions +### ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +### +### * arg0: i1, Predicate +### * arg1: vNi8, Cache controls, where N is the number of supported cache levels [MBC] +### * arg2: i8, Number of blocks [MBC] +### * arg3: i16, Block width (in elements) [MBC] +### * arg4: i16, Block height [MBC] +### * arg5: v16i32 Matrix descriptor +### * arg6: i32, Memory block X immediate offset (in elements) [MBC] +### * arg7: i32, Memory block Y immediate offset [MBC] +### * arg8: value to passthru when predicate is false on load, +### or value to write on store, +### or dummy value for prefetch to deduce the matrix element type +### +### * Return value: the value read or void +### +### The matrix descriptor is a 16-element vector that describes the 2D block layout in memory. +### The descriptor layout is as follows: +### desc[0]: low 32 bits of the base address +### desc[1]: high 32 bits of the base address +### desc[2]: matrix width in bytes, minus 1 +### desc[3]: matrix height, minus 1 +### desc[4]: matrix pitch in bytes, minus 1 +### desc[5]: block start X in elements, signed +### desc[6]: block start Y in rows, signed +### desc[7]: block size encoded as follows: +### (block_width - 1) | ((block_height - 1) << 8) | ((number_of_blocks - 1) << 16) +### desc[8-15]: reserved +### + "lsc_load_2d_ugm_desc" : { "result" : "anyvector", + "arguments" : [ + "bool", # i1, predicate + "anyvector", # cache controls + "char", # number of blocks + "short", # block width + "short", # block height + "int16", # matrix descriptor + "int", # X offset + "int", # Y offset + 0, # value to passthru when predicate is false + ], + "attributes" : "ReadMem", + "platforms" : "XeHPC+", + }, + "lsc_load_2d_ugm_desc_transpose" : { "result" : "anyvector", + "arguments" : [ + "bool", # i1, predicate + "anyvector", # cache controls + "char", # number of blocks + "short", # block width + "short", # block height + "int16", # matrix descriptor + "int", # X offset + "int", # Y offset + 0, # value to passthru when predicate is false + ], + "attributes" : "ReadMem", + "platforms" : "XeHPC+", + }, + "lsc_load_2d_ugm_desc_vnni" : { "result" : "anyvector", + "arguments" : [ + "bool", # i1, predicate + "anyvector", # cache controls + "char", # number of blocks + "short", # block width + "short", # block height + "int16", # matrix descriptor + "int", # X offset + "int", # Y offset + 0, # value to passthru when predicate is false + ], + "attributes" : "ReadMem", + "platforms" : "XeHPC+", + }, + "lsc_prefetch_2d_ugm_desc" : { "result" : "void", + "arguments" : [ + "bool", # i1, predicate + "anyvector", # cache controls + "char", # number of blocks + "short", # block width + "short", # block height + "int16", # matrix descriptor + "int", # X offset + "int", # Y offset + "anyvector", # dummy value, only element type is used + ], + "attributes" : "SideEffects", + "platforms" : "XeHPC+", + }, + "lsc_store_2d_ugm_desc" : { "result" : "void", + "arguments" : [ + "bool", # i1, predicate + "anyvector", # cache controls + "char", # number of blocks + "short", # block width + "short", # block height + "int16", # matrix descriptor + "int", # X offset + "int", # Y offset + "anyvector", # value to store + ], + "attributes" : "WriteMem", + "platforms" : "XeHPC+", + }, + ### ``llvm.genx.lsc.*.quad.typed.bti.<return type>.<predicate type>.<address type>``: LSC typed load/store/prefetch ### ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ### @@ -4372,7 +4513,7 @@ ### "raw_send" : { "result" : "anyvector", "arguments" : ["int","anyint","int","int","anyvector",0], - "attributes" : "None" + "attributes" : "SideEffects" }, ### ``llvm.genx.raw.send.noresult.<any int>.<vector type>`` : vISA RAW_SEND instruction with no result @@ -4397,7 +4538,7 @@ ### "raw_send_noresult" : { "result" : "void", "arguments" : ["int","anyint","int","int","anyvector"], - "attributes" : "None" + "attributes" : "SideEffects" }, ### ``llvm.genx.raw.sends.<return type>.<any int>.<vector type>.<vector type>`` : vISA RAW_SENDS instruction diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/Intrinsics.py new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/Intrinsics.py --- old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvm/GenXIntrinsics/Intrinsics.py 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvm/GenXIntrinsics/Intrinsics.py 2024-11-26 19:19:54.000000000 +0100 @@ -2,7 +2,7 @@ # ========================== begin_copyright_notice ============================ # -# Copyright (C) 2019-2023 Intel Corporation +# Copyright (C) 2019-2024 Intel Corporation # # SPDX-License-Identifier: MIT # @@ -76,6 +76,12 @@ "SideEffects": set(["NoUnwind"]), } +modref_map = { + "ReadNone": "none", + "ReadOnly": "readOnly", + "WriteOnly": "writeOnly" +} + # order does really matter. # It is used to define ordering between the respected platforms platform_list = [ @@ -91,6 +97,7 @@ "XeHPC", "XeHPCVG", "Xe2", + "Xe3", ] def getAttributeList(Attrs): @@ -101,6 +108,21 @@ s = reduce(lambda acc, v: attribute_map[v] | acc, Attrs, set()) return ['Attribute::'+x for x in sorted(s)] + +def getAttributeListModRef(Attrs): + """ + Takes a list of attribute names, calculates the union, + and returns a list of the the given attributes + """ + s = reduce(lambda acc, v: attribute_map[v] | acc, Attrs, set()) + attr = [] + for x in sorted(s): + if x in modref_map: + attr += ['addMemoryAttr(MemoryEffects::' + modref_map[x] + '())'] + else: + attr += ['addAttribute(Attribute::'+x+')'] + return attr + Intrinsics = dict() parse = sys.argv @@ -451,8 +473,8 @@ source_result = encodeTypeString(source_list,type_string,anyArgs_array) type_string = source_result[0] - array_of_longs = re.findall("(?<=\<)(.*?)(?=\>)",type_string) #Search for my long values <> - type_string = re.sub("(<)(.*?)(>)",".",type_string) #Replace long_nums for now with . + array_of_longs = re.findall(r"(?<=\<)(.*?)(?=\>)",type_string) #Search for my long values <> + type_string = re.sub(r"(<)(.*?)(>)",".",type_string) #Replace long_nums for now with . IIT_Basic.append(["0x"+type_string[::-1],array_of_longs]) #Reverse the string before appending and add array of longs @@ -535,12 +557,18 @@ for i in range(len(attribute_Array)): #Building case statements Attrs = getAttributeList([x.strip() for x in attribute_Array[i].split(',')]) + AttrModRef = getAttributeListModRef([x.strip() for x in attribute_Array[i].split(',')]) f.write(""" case {num}: {{ + #if LLVM_VERSION_MAJOR >= 16 + AttrBuilder Atts(C); + Atts.{attrs_mod}; + #else const Attribute::AttrKind Atts[] = {{{attrs}}}; + #endif AS[0] = AttributeList::get(C, AttributeList::FunctionIndex, Atts); NumAttrs = 1; break; - }}\n""".format(num=i+1, attrs=','.join(Attrs))) + }}\n""".format(num=i+1, attrs_mod='.'.join(AttrModRef), attrs=','.join(Attrs))) f.write(" }\n" " }\n" " return AttributeList::get(C, ArrayRef<AttributeList>(AS, NumAttrs));\n" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvmVCWrapper/ADT/StringRef.h new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvmVCWrapper/ADT/StringRef.h --- old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvmVCWrapper/ADT/StringRef.h 1970-01-01 01:00:00.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvmVCWrapper/ADT/StringRef.h 2024-11-26 19:19:54.000000000 +0100 @@ -0,0 +1,30 @@ +/*========================== begin_copyright_notice ============================ + +Copyright (C) 2020-2022 Intel Corporation + +SPDX-License-Identifier: MIT + +============================= end_copyright_notice ===========================*/ + +#ifndef VCINTR_ADT_STRINGREF_H +#define VCINTR_ADT_STRINGREF_H + +#include <llvm/ADT/StringRef.h> + +namespace VCINTR { + +namespace StringRef { + +inline bool starts_with(llvm::StringRef S, llvm::StringRef Prefix) { +#if VC_INTR_LLVM_VERSION_MAJOR >= 16 + return S.starts_with(Prefix); +#else + return S.startswith(Prefix); +#endif +} + +} // namespace StringRef + +} // namespace VCINTR + +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvmVCWrapper/IR/Type.h new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvmVCWrapper/IR/Type.h --- old/vc-intrinsics-0.18.0/GenXIntrinsics/include/llvmVCWrapper/IR/Type.h 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/include/llvmVCWrapper/IR/Type.h 2024-11-26 19:19:54.000000000 +0100 @@ -1,6 +1,6 @@ /*========================== begin_copyright_notice ============================ -Copyright (C) 2022 Intel Corporation +Copyright (C) 2022-2024 Intel Corporation SPDX-License-Identifier: MIT @@ -17,12 +17,28 @@ inline llvm::Type *getNonOpaquePtrEltTy(const llvm::Type *PTy) { #if VC_INTR_LLVM_VERSION_MAJOR < 14 return PTy->getPointerElementType(); -#else // VC_INTR_LLVM_VERSION_MAJOR < 14 +#elif VC_INTR_LLVM_VERSION_MAJOR < 17 return PTy->getNonOpaquePointerElementType(); -#endif // VC_INTR_LLVM_VERSION_MAJOR < 14 +#else + llvm_unreachable("Pointers no longer have element types"); +#endif } } // namespace Type +namespace PointerType { + +inline llvm::PointerType *getWithSamePointeeType(llvm::PointerType *PT, + unsigned int AS) { +#if VC_INTR_LLVM_VERSION_MAJOR < 14 + return llvm::PointerType::get(PT->getElementType(), AS); +#elif VC_INTR_LLVM_VERSION_MAJOR < 17 + return llvm::PointerType::getWithSamePointeeType(PT, AS); +#else + return llvm::PointerType::get(PT->getContext(), AS); +#endif +} + +} // namespace PointerType } // namespace VCINTR -#endif // VCINTR_IR_TYPE_H \ No newline at end of file +#endif // VCINTR_IR_TYPE_H diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/AdaptorsCommon.cpp new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/AdaptorsCommon.cpp --- old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/AdaptorsCommon.cpp 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/AdaptorsCommon.cpp 2024-11-26 19:19:54.000000000 +0100 @@ -40,7 +40,7 @@ continue; #if VC_INTR_LLVM_VERSION_MAJOR >= 13 -#if VC_INTR_LLVM_VERSION_MAJOR < 18 +#if VC_INTR_LLVM_VERSION_MAJOR < 17 if (PTy->isOpaque()) #endif // VC_INTR_LLVM_VERSION_MAJOR < 18 continue; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp --- old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp 2024-11-26 19:19:54.000000000 +0100 @@ -1,6 +1,6 @@ /*========================== begin_copyright_notice ============================ -Copyright (C) 2019-2023 Intel Corporation +Copyright (C) 2019-2024 Intel Corporation SPDX-License-Identifier: MIT @@ -19,6 +19,7 @@ // Implementation of methods declared in llvm/GenXIntrinsics/GenXIntrinsics.h #include "llvm/GenXIntrinsics/GenXIntrinsics.h" +#include "llvm/GenXIntrinsics/GenXIntrinsicInst.h" #include "llvm/IR/Constants.h" #include "llvm/IR/Function.h" @@ -31,6 +32,7 @@ #include <llvm/ADT/StringMap.h> #include <llvm/CodeGen/ValueTypes.h> +#include "llvmVCWrapper/ADT/StringRef.h" #include "llvmVCWrapper/IR/DerivedTypes.h" #include "llvmVCWrapper/IR/Intrinsics.h" #include "llvmVCWrapper/IR/Type.h" @@ -299,7 +301,12 @@ switch (D.Kind) { case IITDescriptor::Void: return Type::getVoidTy(Context); case IITDescriptor::VarArg: return Type::getVoidTy(Context); - case IITDescriptor::MMX: return Type::getX86_MMXTy(Context); + case IITDescriptor::MMX: +#if VC_INTR_LLVM_VERSION_MAJOR >= 20 + return FixedVectorType::get(Type::getInt64Ty(Context), 1); +#else // VC_INTR_LLVM_VERSION_MAJOR >= 20 + return Type::getX86_MMXTy(Context); +#endif // VC_INTR_LLVM_VERSION_MAJOR >= 20 case IITDescriptor::Token: return Type::getTokenTy(Context); case IITDescriptor::Metadata: return Type::getMetadataTy(Context); case IITDescriptor::Half: return Type::getHalfTy(Context); @@ -431,7 +438,7 @@ if (PointerType *PTyp = dyn_cast<PointerType>(Ty)) { Result += "p" + llvm::utostr(PTyp->getAddressSpace()); #if VC_INTR_LLVM_VERSION_MAJOR >= 13 -#if VC_INTR_LLVM_VERSION_MAJOR < 18 +#if VC_INTR_LLVM_VERSION_MAJOR < 17 if (PTyp->isOpaque()) #endif // VC_INTR_LLVM_VERSION_MAJOR < 18 return Result; @@ -531,12 +538,26 @@ #undef GET_INTRINSIC_OVERLOAD_RET_TABLE } +Function *GenXIntrinsic::getAnyDeclaration(Module *M, unsigned id, + ArrayRef<Type *> Tys) { + assert(isAnyNonTrivialIntrinsic(id)); + if (isGenXIntrinsic(id)) { + return getGenXDeclaration(M, (ID)id, Tys); + } else { +#if VC_INTR_LLVM_VERSION_MAJOR < 20 + return Intrinsic::getDeclaration(M, (Intrinsic::ID)id, Tys); +#else + return Intrinsic::getOrInsertDeclaration(M, (Intrinsic::ID)id, Tys); +#endif + } +} + /// Find the segment of \c IntrinsicNameTable for intrinsics with the same /// target as \c Name, or the generic table if \c Name is not target specific. /// /// Returns the relevant slice of \c IntrinsicNameTable static ArrayRef<const char *> findTargetSubtable(StringRef Name) { - assert(Name.startswith("llvm.genx.")); + assert(VCINTR::StringRef::starts_with(Name, "llvm.genx.")); ArrayRef<IntrinsicTargetInfo> Targets(TargetInfos); // Drop "llvm." and take the first dotted component. That will be the target @@ -554,7 +575,7 @@ GenXIntrinsic::ID GenXIntrinsic::getGenXIntrinsicID(const Function *F) { assert(F); llvm::StringRef Name = F->getName(); - if (!Name.startswith(getGenXIntrinsicPrefix())) + if (!VCINTR::StringRef::starts_with(Name, getGenXIntrinsicPrefix())) return GenXIntrinsic::not_genx_intrinsic; // Check metadata cache. @@ -568,7 +589,7 @@ if (isGenXIntrinsic(Id)) { const char *NamePrefix = GenXIntrinsicNameTable[Id - GenXIntrinsic::not_genx_intrinsic]; - if (Name.startswith(NamePrefix)) + if (VCINTR::StringRef::starts_with(Name, NamePrefix)) return Id; } } @@ -757,3 +778,16 @@ return VCINTR::VectorType::getNumElements(VT); return 1; } + +bool GenXIntrinsic::isGenXIntrinsic(const Function *CF) { + return VCINTR::StringRef::starts_with(CF->getName(), + getGenXIntrinsicPrefix()); +} + +bool GenXIntrinsicInst::classof(const CallInst *I) { + if (const Function *CF = I->getCalledFunction()) { + return VCINTR::StringRef::starts_with( + CF->getName(), GenXIntrinsic::getGenXIntrinsicPrefix()); + } + return false; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp --- old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVReaderAdaptor.cpp 2024-11-26 19:19:54.000000000 +0100 @@ -141,9 +141,7 @@ break; case SPIRVIRTypes::DimBuffer: ResultType = SPIRVType::Image1dBuffer; - break; - default: - llvm_unreachable("Bad Image Type"); + break; } } else { switch (Dim) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp --- old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp 2024-11-26 19:19:54.000000000 +0100 @@ -28,6 +28,7 @@ #include "llvm/Pass.h" #include "llvm/Support/Process.h" +#include "llvmVCWrapper/ADT/StringRef.h" #include "llvmVCWrapper/IR/Attributes.h" #include "llvmVCWrapper/IR/DerivedTypes.h" #include "llvmVCWrapper/IR/Function.h" @@ -253,19 +254,22 @@ transformKernelSignature(Function &F, const std::vector<SPIRVArgDesc> &Descs) { SmallVector<Type *, 8> NewParams; - auto GetArgType = -#if VC_INTR_LLVM_VERSION_MAJOR >= 16 - [UseTargetTypes = !F.getContext().supportsTypedPointers()]( - SPIRVArgDesc Desc, Argument &Arg) { - if (UseTargetTypes) - return getArgTargetTypeFromDesc(Desc, Arg); - return getArgTypeFromDesc(Desc, Arg); - }; -#else // VC_INTR_LLVM_VERSION_MAJOR >= 16 - [](SPIRVArgDesc Desc, Argument &Arg) { - return getArgTypeFromDesc(Desc, Arg); - }; -#endif // VC_INTR_LLVM_VERSION_MAJOR >= 16 + // Before LLVM 16, we don't want to use target types. After LLVM 16, typed + // pointers are always disabled, so we must use target types. +#if VC_INTR_LLVM_VERSION_MAJOR == 16 + bool UseTargetTypes = !F.getContext().supportsTypedPointers(); +#elif VC_INTR_LLVM_VERSION_MAJOR > 16 + constexpr bool UseTargetTypes = true; +#endif + auto GetArgType = [&](SPIRVArgDesc Desc, Argument &Arg) { +#if VC_INTR_LLVM_VERSION_MAJOR == 16 + if (UseTargetTypes) + return getArgTargetTypeFromDesc(Desc, Arg); +#elif VC_INTR_LLVM_VERSION_MAJOR > 16 + return getArgTargetTypeFromDesc(Desc, Arg); +#endif + return getArgTypeFromDesc(Desc, Arg); + }; std::transform(Descs.begin(), Descs.end(), F.arg_begin(), std::back_inserter(NewParams), GetArgType); @@ -283,8 +287,7 @@ if (Descs[i].Ty == SPIRVType::None) continue; #if VC_INTR_LLVM_VERSION_MAJOR >= 16 - if (!F.getContext().supportsTypedPointers() && - Descs[i].Ty == SPIRVType::Image2dMediaBlock) { + if (UseTargetTypes && Descs[i].Ty == SPIRVType::Image2dMediaBlock) { AttrBuilder AttrBuilder(NewF->getContext()); AttrBuilder.addAttribute(VCFunctionMD::VCMediaBlockIO); NewF->addParamAttrs(i, AttrBuilder); @@ -577,8 +580,8 @@ bool GenXSPIRVWriterAdaptorImpl::run(Module &M) { auto TargetTriple = StringRef(M.getTargetTriple()); - if (TargetTriple.startswith("genx")) { - if (TargetTriple.startswith("genx32")) + if (VCINTR::StringRef::starts_with(TargetTriple, "genx")) { + if (VCINTR::StringRef::starts_with(TargetTriple, "genx32")) M.setTargetTriple("spir"); else M.setTargetTriple("spir64"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp --- old/vc-intrinsics-0.18.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp 2024-02-14 02:59:16.000000000 +0100 +++ new/vc-intrinsics-0.21.0/GenXIntrinsics/lib/GenXIntrinsics/GenXSimdCFLowering.cpp 2024-11-26 19:19:54.000000000 +0100 @@ -1,6 +1,6 @@ /*========================== begin_copyright_notice ============================ -Copyright (C) 2015-2023 Intel Corporation +Copyright (C) 2015-2024 Intel Corporation SPDX-License-Identifier: MIT @@ -531,7 +531,7 @@ auto AS1 = LI->getPointerAddressSpace(); if (AS1 != AS0) { auto PtrTy = cast<PointerType>(Ptr->getType()); - PtrTy = PointerType::get(VCINTR::Type::getNonOpaquePtrEltTy(PtrTy), AS0); + PtrTy = VCINTR::PointerType::getWithSamePointeeType(PtrTy, AS0); Ptr = Builder.CreateAddrSpaceCast(Ptr, PtrTy); } Type* Tys[] = { LI->getType(), Ptr->getType() }; @@ -549,7 +549,7 @@ auto AS1 = SI->getPointerAddressSpace(); if (AS1 != AS0) { auto PtrTy = cast<PointerType>(Ptr->getType()); - PtrTy = PointerType::get(VCINTR::Type::getNonOpaquePtrEltTy(PtrTy), AS0); + PtrTy = VCINTR::PointerType::getWithSamePointeeType(PtrTy, AS0); Ptr = Builder.CreateAddrSpaceCast(Ptr, PtrTy); } Type* Tys[] = { SI->getValueOperand()->getType(), Ptr->getType() }; @@ -1484,14 +1484,15 @@ Instruction *Load = nullptr; if (auto SInst = dyn_cast<StoreInst>(SI)) { auto *PtrOp = SInst->getPointerOperand(); - Load = new LoadInst(VCINTR::Type::getNonOpaquePtrEltTy(PtrOp->getType()), PtrOp, + Load = new LoadInst(SInst->getValueOperand()->getType(), PtrOp, PtrOp->getName() + ".simdcfpred.load", false /* isVolatile */, SI); } else { auto ID = GenXIntrinsic::genx_vload; + Value *Data = SI->getOperand(0); Value *Addr = SI->getOperand(1); - Type *Tys[] = {VCINTR::Type::getNonOpaquePtrEltTy(Addr->getType()), Addr->getType()}; + Type *Tys[] = {Data->getType(), Addr->getType()}; auto Fn = GenXIntrinsic::getGenXDeclaration( SI->getParent()->getParent()->getParent(), ID, Tys); Load = CallInst::Create(Fn, Addr, ".simdcfpred.vload", SI); @@ -1739,11 +1740,11 @@ Br); Value *RMAddr = getRMAddr(UIP, SimdWidth); Instruction *OldEM = - new LoadInst(VCINTR::Type::getNonOpaquePtrEltTy(EMVar->getType()), EMVar, - EMVar->getName(), false /* isVolatile */, Br); + new LoadInst(EMVar->getValueType(), EMVar, EMVar->getName(), + false /* isVolatile */, Br); OldEM->setDebugLoc(DL); auto OldRM = - new LoadInst(VCINTR::Type::getNonOpaquePtrEltTy(RMAddr->getType()), RMAddr, + new LoadInst(cast<AllocaInst>(RMAddr)->getAllocatedType(), RMAddr, RMAddr->getName(), false /* isVolatile */, Br); OldRM->setDebugLoc(DL); Type *Tys[] = { OldEM->getType(), OldRM->getType() }; @@ -1779,11 +1780,11 @@ // Insert {NewEM,BranchCond} = llvm.genx.simdcf.join(OldEM,RM) Value *RMAddr = getRMAddr(JP, SimdWidth); Instruction *OldEM = - new LoadInst(VCINTR::Type::getNonOpaquePtrEltTy(EMVar->getType()), EMVar, - EMVar->getName(), false /* isVolatile */, InsertBefore); + new LoadInst(EMVar->getValueType(), EMVar, EMVar->getName(), + false /* isVolatile */, InsertBefore); OldEM->setDebugLoc(DL); auto RM = - new LoadInst(VCINTR::Type::getNonOpaquePtrEltTy(RMAddr->getType()), RMAddr, + new LoadInst(cast<AllocaInst>(RMAddr)->getAllocatedType(), RMAddr, RMAddr->getName(), false /* isVolatile */, InsertBefore); RM->setDebugLoc(DL); Type *Tys[] = { OldEM->getType(), RM->getType() }; @@ -1865,8 +1866,8 @@ // put in genx_simdcf_savemask and genx_simdcf_remask const auto &DL = CIB->getDebugLoc(); Instruction *OldEM = - new LoadInst(VCINTR::Type::getNonOpaquePtrEltTy(EMVar->getType()), EMVar, - EMVar->getName(), false /* isVolatile */, CIB); + new LoadInst(EMVar->getValueType(), EMVar, EMVar->getName(), + false /* isVolatile */, CIB); OldEM->setDebugLoc(DL); Type *Tys[] = {OldEM->getType()}; auto SavemaskFunc = GenXIntrinsic::getGenXDeclaration( @@ -1888,8 +1889,8 @@ ->setDebugLoc(DL); // put in genx_simdcf_remask const auto &DLCIE = CIE->getDebugLoc(); - OldEM = new LoadInst(VCINTR::Type::getNonOpaquePtrEltTy(EMVar->getType()), EMVar, - EMVar->getName(), false /* isVolatile */, CIE); + OldEM = new LoadInst(EMVar->getValueType(), EMVar, EMVar->getName(), + false /* isVolatile */, CIE); OldEM->setDebugLoc(DLCIE); Type *Ty2s[] = {OldEM->getType()}; auto RemaskFunc = GenXIntrinsic::getGenXDeclaration( @@ -1967,9 +1968,8 @@ */ Instruction *CMSimdCFLower::loadExecutionMask(Instruction *InsertBefore, unsigned SimdWidth) { - Instruction *EM = - new LoadInst(VCINTR::Type::getNonOpaquePtrEltTy(EMVar->getType()), EMVar, - EMVar->getName(), false /* isVolatile */, InsertBefore); + Instruction *EM = new LoadInst(EMVar->getValueType(), EMVar, EMVar->getName(), + false /* isVolatile */, InsertBefore); // If the simd width is not MAX_SIMD_CF_WIDTH, extract the part of EM we want. if (SimdWidth == MAX_SIMD_CF_WIDTH) @@ -2012,7 +2012,7 @@ } assert(!SimdWidth || VCINTR::VectorType::getNumElements(cast<VectorType>( - VCINTR::Type::getNonOpaquePtrEltTy((*RMAddr)->getType()))) == SimdWidth); + cast<AllocaInst>(*RMAddr)->getAllocatedType())) == SimdWidth); return *RMAddr; }