Giter Site home page Giter Site logo

mlir-standalone-template's Introduction

An out-of-tree dialect template for MLIR

This repository contains a template for an out-of-tree MLIR dialect as well as a standalone opt-like tool to operate on that dialect.

How to build

This setup assumes that you have built LLVM and MLIR in $BUILD_DIR and installed them to $PREFIX. To build and launch the tests, run

mkdir build && cd build
cmake -G Ninja .. -DMLIR_DIR=$PREFIX/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit
cmake --build . --target check-standalone-opt

To build the documentation from the TableGen description of the dialect operations, run

cmake --build . --target mlir-doc

Note: Make sure to pass -DLLVM_INSTALL_UTILS=ON when building LLVM with CMake so that it installs FileCheck to the chosen installation prefix.

License

This dialect template is made available under the Apache License 2.0 with LLVM Exceptions. See the LICENSE.txt file for more details.

mlir-standalone-template's People

Contributors

chelini avatar gmngeoffrey avatar jmgorius avatar math-fehr avatar stephenneuendorffer 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  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

mlir-standalone-template's Issues

Compile Issue

In standalone-opt.cpp : line 25 mlir::registerAllDialects(); too few arguments to call,

Build Issue

ninja: error: loading 'build.ninja': No such file or directory while trying to build

error: Variable not defined: 'Pure'

I'm not entirely sure whether this is a bug, or I'm doing something wrong. But when I try to build the standalone dialect, I get the following error.

llvm-project/mlir/examples/standalone/build> cmake -G Ninja .. -DMLIR_DIR=/usr/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=/usr/tools/lit/lit.py
-- Using MLIRConfig.cmake in: /workspaces/julia_from_source/usr/lib/cmake/mlir
-- Using LLVMConfig.cmake in: /workspaces/julia_from_source/usr/lib/cmake/llvm
-- Building with -fPIC
-- Configuring done
-- Generating done
-- Build files have been written to: /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build

llvm-project/mlir/examples/standalone/build> cmake --build . --target check-standalone

[1/24] Building StandaloneOps.cpp.inc...
FAILED: include/Standalone/StandaloneOps.cpp.inc /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/include/Standalone/StandaloneOps.cpp.inc 
cd /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build && /workspaces/julia_from_source/usr/bin/mlir-tblgen -gen-op-defs -I /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include/Standalone -I/workspaces/julia_from_source/usr/include -I/workspaces/julia_from_source/usr/include -I/workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include -I/workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/include /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include/Standalone/StandaloneOps.td --write-if-changed -o include/Standalone/StandaloneOps.cpp.inc -d include/Standalone/StandaloneOps.cpp.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /workspaces/julia_from_source/llvm-project/mlir/examples/standalone /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include/Standalone /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/include/Standalone /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/include/Standalone/StandaloneOps.cpp.inc.d /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/CMakeFiles/d/05cabdec811fed6580eb1cc2cc1caeea7ffdf45efba752a5a9cb648c69099e6f.d
/workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include/Standalone/StandaloneOps.td:16:46: error: Variable not defined: 'Pure'
def Standalone_FooOp : Standalone_Op<"foo", [Pure,
                                             ^
[2/24] Building StandaloneOpsTypes.h.inc...
FAILED: include/Standalone/StandaloneOpsTypes.h.inc /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/include/Standalone/StandaloneOpsTypes.h.inc 
cd /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build && /workspaces/julia_from_source/usr/bin/mlir-tblgen -gen-typedef-decls -typedefs-dialect=standalone -I /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include/Standalone -I/workspaces/julia_from_source/usr/include -I/workspaces/julia_from_source/usr/include -I/workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include -I/workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/include /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include/Standalone/StandaloneOps.td --write-if-changed -o include/Standalone/StandaloneOpsTypes.h.inc -d include/Standalone/StandaloneOpsTypes.h.inc.d && /usr/bin/cmake -E cmake_transform_depfile Ninja gccdepfile /workspaces/julia_from_source/llvm-project/mlir/examples/standalone /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include/Standalone /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/include/Standalone /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/include/Standalone/StandaloneOpsTypes.h.inc.d /workspaces/julia_from_source/llvm-project/mlir/examples/standalone/build/CMakeFiles/d/b828fdc35d89b8d0d6ca8f196b31862527962db2ff9ed79e653a184e4045940a.d
/workspaces/julia_from_source/llvm-project/mlir/examples/standalone/include/Standalone/StandaloneOps.td:16:46: error: Variable not defined: 'Pure'
def Standalone_FooOp : Standalone_Op<"foo", [Pure,
                                             ^
[3/24] Building StandaloneOps.h.inc...
FAILED: include/Standalone/StandaloneOp [...continued...]

Build file generation runs without issue, is this an indication that the directories I'm passing are correct, or can I not make that assumption?
Any help would be appreciated!

Errors when building; may not be compatible with current llvm-project `master`

Hello, I am struggling to install the standalone template (I want to use this as a template for a larger project where I will be writing a new dialect). I have already installed llvm and mlir. I am installing on Ubuntu 20.04.4. I tried to copy the same build arguments that were used in build_and_test.yaml. One possible point of discrepancy is that I am installing MLIR and LLVM from the most recent master branch of llvm-project, whereas build_and_test.yaml seems to check out commit-id 161bddf3af09aa883c9414d793de79c89e51636a.

How I built LLVM/MLIR:

I installed LLVM and MLIR with the following commands, which process without error. Perhaps I am missing some options, or including options that are incompatible:

sudo apt-get upgrade
sudo apt-get install ninja-build clang lld

git clone https://github.com/llvm/llvm-project.git
mkdir llvm-project/build
mkdir llvm-project/prefix
cd llvm-project/build

cmake -G Ninja ../llvm \
  -DCMAKE_BUILD_TYPE=Release \
  -DCMAKE_C_COMPILER=clang \
  -DCMAKE_CXX_COMPILER=clang++ \
  -DLLVM_ENABLE_LLD=ON \
  -DLLVM_ENABLE_ASSERTIONS=ON \
  -DLLVM_BUILD_EXAMPLES=ON \
  -DLLVM_TARGETS_TO_BUILD="host;X86;NVPTX;AMDGPU" \
  -DLLVM_ENABLE_PROJECTS='mlir' \
  -DLLVM_OPTIMIZED_TABLEGEN=ON \
  -DLLVM_ENABLE_OCAMLDOC=OFF \
  -DLLVM_ENABLE_BINDINGS=OFF \
  -DLLVM_INSTALL_UTILS=ON \
  -DLLVM_CCACHE_BUILD=ON \
  -DCMAKE_INSTALL_PREFIX=../prefix

ninja
ninja check-mlir
ninja install

Errors when trying to build mlir-standalone-template

When running

mkdir build && cd build
cmake -G Ninja .. -DMLIR_DIR=$PREFIX/lib/cmake/mlir -DLLVM_EXTERNAL_LIT=$BUILD_DIR/bin/llvm-lit
cmake --build . --target check-standalone-opt

I get quite a few errors upon cmake --build. I've attached the full error log as a text file to this issue post. I'm surprised to be getting these errors, since I have tried to match the options that are used in build_and_test.yaml

Build Error Log

build_log.txt

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.