Giter VIP home page Giter VIP logo

vc-intrinsics's Introduction

VC Intrinsics

Introduction

VC Intrinsics project contains a set of new intrinsics on top of core LLVM IR instructions that represent SIMD semantics of a program targeting GPU. This set is now used by

frontend compilers and

License

VC Intrinsics are distributed under the MIT license.

You may obtain a copy of the License at:

https://opensource.org/licenses/MIT

Dependencies

Source code

Tools

To build libraries:

To build documentation:

Building

VC Intrinsics can be built in two major modes: in-tree and external. All major LLVM versions starting from LLVM 8 are supported.

LLVM ToT can be used too, but there is no guarantee that it will always work (because of sudden breaking changes in LLVM C++ API). However, maintainers are trying to fix such issues as fast as possible.

In-tree build

For in-tree build VC Intrinsics can be considered as an external LLVM project. Put VC Intrinsics source directory inside llvm/projects directory or add -DLLVM_EXTERNAL_PROJECTS="vc-intrinsics" -DLLVM_EXTERNAL_VC_INTRINSICS_SOURCE_DIR=<vc-intrinsics> to cmake command arguments when configuring LLVM.

External build

To configure VC Intrinsics with prebuilt LLVM run cmake as follows:

$ cmake -DLLVM_DIR=<llvm install>/lib/cmake/llvm <vc-intrinsics>

Documentation

VC Intrinsics documentation is inside docs subdirectory and can be built using Sphinx. To build html version do the following:

$ cd docs
$ make -f Makefile.sphinx html

This will extract comments from main intrinsics description and generate readable html output in _build/html subdirectory.

Testing

VC Intrinsics repository contains lit tests that are enabled when -DVC_INTR_ENABLE_LIT_TESTS=ON is passed to cmake command. Lit tests use LLVM plugins and currently are supported only with dynamic LLVM (when LLVM is configured with -DLLVM_LINK_LLVM_DYLIB=ON). In external build path to lit utility should be specified as follows: -DLLVM_EXTERNAL_LIT=<lit>. Full example with external build:

$ cmake -DLLVM_DIR=<llvm install>/lib/cmake/llvm -DVC_INTR_ENABLE_LIT_TESTS=ON -DLLVM_EXTERNAL_LIT=<lit> <vc-intrinsics>

Target check-vc-intrinsics will run lit tests.

How to provide feedback

Please submit an issue using native github.com interface: https://github.com/intel/vc-intrinsics/issues.

How to contribute

Create a pull request on github.com with your patch. A maintainer will contact you if there are questions or concerns.

vc-intrinsics's People

Contributors

againull avatar amulikhointel avatar aparshin-intel avatar aus-intel avatar azabazno avatar dmitrybushev avatar dmitryryintel avatar fineg74 avatar frasercrmck avatar gvsharap avatar idmitryy avatar igorban-intel avatar intel-kzhavoro avatar kyansito avatar lukaszgotszaldintel avatar mshelego avatar nikitarudenkointel avatar saininav avatar sarnex avatar sergey-semenov avatar skachkov-intel avatar ssidelni avatar sys-cmllvm avatar vchernon-intel avatar vmustya avatar vsemenov368 avatar xinwang10 avatar ytarasov-intel avatar zahiraam avatar zuban32 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vc-intrinsics's Issues

Reporting a vulnerability

Hello!

I hope you are doing well!

We are a security research team. Our tool automatically detected a vulnerability in this repository. We want to disclose it responsibly. GitHub has a feature called Private vulnerability reporting, which enables security research to privately disclose a vulnerability. Unfortunately, it is not enabled for this repository.

Can you enable it, so that we can report it?

Thanks in advance!

PS: you can read about how to enable private vulnerability reporting here: https://docs.github.com/en/code-security/security-advisories/repository-security-advisories/configuring-private-vulnerability-reporting-for-a-repository

Covertion of non-genx_volatile globals to genx_volatile ones can/must be removed.

Hi, @igorban-intel

* it generate issue in register allocator - because it will be put to

The issue is not in register allocator or a special case for coalescing as the comment in the source code states.

The faulty situation is reflected in this LIT test: https://github.com/intel/intel-graphics-compiler/blob/1b038250fd5eb6c6b51d2c8062174f645ceefad2/IGC/VectorCompiler/test/GenXLegalizeGVLoadUses/mem2reg_gv_clobbering_avoidance.ll
The comment in the test explains it in pseudocode: LLVM's optimization replaced non-genx_volatile variable with genx_volatile one while it has proved that they constitute the same value (totally legitimate from LLVM semantics standpoint).

This was fixed (intel/intel-graphics-compiler@9fa222a) in the compiler by "legalization" of genx.vload users to genx-controlled subset hence mem2reg or any other LLVM optimizations are not to break the implied genx-middle-end semantics anymore. After the abovementioned fix was applied in IGC VectorCompiler this is no longer an issue.

This particular change (covertion of non-genx_volatile globals to genx_volatile ones) now can be removed. Otherwize, it increases register pressure and potentially can cause some workloads not compile.

Does not built with latest llvm

cmake --build . --target LLVMGenXIntrinsics

llvm-project/llvm/projects/vc-intrinsics/GenXIntrinsics/lib/GenXIntrinsics/GenXSPIRVWriterAdaptor.cpp:119:24: error: 'class llvm::Module' has no member name
d 'getTypeByName'
  119 |   StructType *STy = M->getTypeByName(Name);

0.17.0: cmake fails on using system installed llvm/clang

Looks like vc-intrinsics wants to have an access to llvm source tree ๐Ÿค”

+ /usr/bin/cmake -B x86_64-redhat-linux-gnu -D BUILD_SHARED_LIBS=ON -D CMAKE_AR=/usr/bin/gcc-ar -D CMAKE_BUILD_TYPE=RelWithDebInfo -D CMAKE_C_FLAGS_RELEASE=-DNDEBUG -D CMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -D CMAKE_Fortran_FLAGS_RELEASE=-DNDEBUG -D CMAKE_INSTALL_PREFIX=/usr -D CMAKE_NM=/usr/bin/gcc-nm -D CMAKE_RANLIB=/usr/bin/gcc-ranlib -D CMAKE_VERBOSE_MAKEFILE=ON -D INCLUDE_INSTALL_DIR=/usr/include -D LIB_INSTALL_DIR=/usr/lib64 -D LIB_SUFFIX=64 -D SHARE_INSTALL_PREFIX=/usr/share -D SYSCONF_INSTALL_DIR=/etc -S .
CMake Error at CMakeLists.txt:17 (get_filename_component):
  get_filename_component unknown component BASE_DIR


-- Configuring incomplete, errors occurred!

building in-tree from source error: Could not find FOUND_VCS

Looking into enabling opencl with SynoCommunity ffmpeg for x86_64 arch.
Related PR: SynoCommunity/spksrc#6148 (IGC, intel-clang-opencl and al not yet included in PR, pending this issue)
Note: the following below without vc-intrinsics it does configure & build properly.

Building wiht vc-intrinsics in-tree from source with the following:

CMAKE_ARGS += -DLLVM_TARGETS_TO_BUILD=X86
CMAKE_ARGS += -DLLVM_ENABLE_PROJECTS='clang'
CMAKE_ARGS += -DLLVM_EXTERNAL_PROJECTS='llvm-spirv;opencl-clang;vc-intrinsics'
CMAKE_ARGS += -DLLVM_EXTERNAL_LLVM_SPIRV_SOURCE_DIR=$(WORK_DIR)/SPIRV-LLVM-Translator
CMAKE_ARGS += -DLLVM_EXTERNAL_SPIRV_HEADERS_SOURCE_DIR=$(WORK_DIR)/SPIRV-Headers
CMAKE_ARGS += -DLLVM_EXTERNAL_VC_INTRINSICS_SOURCE_DIR=$(WORK_DIR)/vc-intrinsics
CMAKE_ARGS += -DLLVM_EXTERNAL_OPENCL_CLANG_SOURCE_DIR=$(WORK_DIR)/$(PKG_NAME)

And getting the following configuration error (present with version 0.18.0, also tested much older 0.3.0, same issue):

- Using SPIR-V Headers from
          /home/spksrc/ffmpeg-update/spksrc/cross/intel-opencl-clang/work-x64-7.1/SPIRV-Headers
-- Checking for one of the modules 'SPIRV-Tools'
-- [OPENCL-CLANG] Using Clang source code direcotry: /home/spksrc/ffmpeg-update/spksrc/cross/intel-opencl-clang/work-x64-7.1/llvm/../clang
-- [OPENCL-CLANG] Using SPIRV-LLVM-Translator source code directory: /home/spksrc/ffmpeg-update/spksrc/cross/intel-opencl-clang/work-x64-7.1/SPIRV-LLVM-Translator
-- [OPENCL-CLANG] No patches in /home/spksrc/ffmpeg-update/spksrc/cross/intel-opencl-clang/work-x64-7.1/opencl-clang/patches/clang
-- [OPENCL-CLANG] No patches in /home/spksrc/ffmpeg-update/spksrc/cross/intel-opencl-clang/work-x64-7.1/opencl-clang/patches/spirv
-- Found Python: /usr/bin/python3.9 (found version "3.9.2") found components: Interpreter 
CMake Error at /home/spksrc/ffmpeg-update/spksrc/cross/intel-opencl-clang/work-x64-7.1/vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/CMakeLists.txt:41 (find_file):
  Could not find FOUND_VCS using the following files: VersionFromVCS.cmake


-- Configuring incomplete, errors occurred!
make[2]: *** [../../mk/spksrc.cross-cmake.mk:150: cmake_configure_target] Error 1
make[2]: Leaving directory '/home/spksrc/ffmpeg-update/spksrc/cross/intel-opencl-clang'
make[1]: *** [../../mk/spksrc.supported.mk:71: build-arch-x64-7.1] Error 1
make[1]: Leaving directory '/home/spksrc/ffmpeg-update/spksrc/cross/intel-opencl-clang'

0.12.0 is not compatible with LLVM 15

vc-intrinsics/GenXIntrinsics/lib/GenXIntrinsics/GenXSingleElementVectorUtil.cpp:776:37: error: 'llvm::Type* llvm::Type::getPointerElementType() const' is deprecated: Deprecated without replacement, see https://llvm.org/docs/OpaquePointers.html for context and migration instructions [-Werror=deprecated-declarations]
776 |             ->getPointerElementType();
    |                                     ^

Add release tag(s)

Please add a release tag to a known good version, so that (besides my own) e.g. IGC release notes can tell against which version of vc-intrinsics it's been tested and built against.

IGC build fails with 0.4.1

Building latest "igc-1.0.11104" IGC version with vc-intrinsics "0.3.0" succeeds.

But it fails when using latest "0.4.1" vc-intrinsics version:

In file included from vc-intrinsics/GenXIntrinsics/lib/GenXIntrinsics/GenXIntrinsics.cpp:21:
vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h: In function 'int llvm::GenXIntrinsic::LSCArgIdx::getLSCVectorSize(llvm::GenXIntrinsic::LSCCategory)':
vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h:712:1: error: control reaches end of non-void function [-Werror=return-type]
  712 | }
      | ^
vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h: In function 'int llvm::GenXIntrinsic::LSCArgIdx::getLSCDataSize(llvm::GenXIntrinsic::LSCCategory)':
vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h:736:1: error: control reaches end of non-void function [-Werror=return-type]
  736 | }
      | ^
vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h: In function 'int llvm::GenXIntrinsic::LSCArgIdx::getLSCDataOrder(llvm::GenXIntrinsic::LSCCategory)':
vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h:784:1: error: control reaches end of non-void function [-Werror=return-type]
  784 | }
      | ^
vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h: In function 'int llvm::GenXIntrinsic::LSCArgIdx::getLSCWidth(llvm::GenXIntrinsic::LSCCategory)':
vc-intrinsics/GenXIntrinsics/include/llvm/GenXIntrinsics/GenXIntrinsics.h:807:1: error: control reaches end of non-void function [-Werror=return-type]
  807 | }
      | ^
cc1plus: all warnings being treated as errors

(This on Ubuntu 21.10 / GCC 11.2 / LLVM 12.)

"Linkage" section in unclear in documentation

Hi folks,

I've been reading through GenXLangRef.rst and I find Linkage section to be quite confusing:

A kernel is represented by a function with dllexport linkage.

There is no such linkage type in LLVM IR. There is a DLL storage class with such name, but that's not a linkage type.

A non-kernel function is represented by a function with public linkage.

Could you please clarify what is a public linkage? The only occurrence of word "public" in LangRef is within "Publications" link in right menu under "Additional Links".

License file

Could you add the license file into the source/releases please ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.