MLIR build with Dialects

Is there a flag to pass to cmake when building MLIR to specify which public dialects to build along with the MLIR installation?

Running config with:

cmake  -G Ninja  \
     -DMLIR_ENABLE_BINDINGS_PYTHON=ON \
     -DPYTHON3_EXECUTABLE=$PYTHON_EXECUTABLE \
    -DLLVM_ENABLE_PROJECTS=mlir \
    -DLLVM_BUILD_EXAMPLES=OFF \
    -DLLVM_TARGETS_TO_BUILD="Native;NVPTX;AMDGPU" \
    -DCMAKE_BUILD_TYPE=Release

I can see that the build includes .inc files for each of the public dialects under $build_dir/tools/mlir/include/mlir/Dialect.

Reason I ask is that I am using this current MLIR build as an out-of-tree dependency for a downstream project which requires the GPUOps library as a build dependency:

add_mlir_dialect_library(TritonGPUIR
  Dialect.cpp
  Traits.cpp

  DEPENDS
  TritonGPUTableGen
  TritonGPUAttrDefsIncGen

  LINK_LIBS PUBLIC
  **MLIRGPUOps**
  TritonIR
)

Apologies if this question is ill-posed, as I am still learning MLIR and shaky around how dialects are built / linked.

Thanks!

No there isn’t: we’ll build everything. You could script a custom distribution, but in general people are statically linking the libraries they need and that will only pull the minimal amount of things in the final binary.

Thanks for the response!

When building the downstream project using the out-of-tree MLIR build per above, I get this error:

CMake Error at /notebooks/CUDA-CPP/MLIR/llvm-project/build_mlir/lib/cmake/llvm/AddLLVM.cmake:556 (add_dependencies):
  The dependency target "MLIRGPUOps" of target "obj.TritonGPUIR" does not
  exist.
Call Stack (most recent call first):
  /notebooks/CUDA-CPP/MLIR/llvm-project/build_mlir/lib/cmake/mlir/AddMLIR.cmake:347 (llvm_add_library)
  /notebooks/CUDA-CPP/MLIR/llvm-project/build_mlir/lib/cmake/mlir/AddMLIR.cmake:626 (add_mlir_library)
  lib/Dialect/TritonGPU/IR/CMakeLists.txt:1 (add_mlir_dialect_library)

How would I build MLIRGPUOps? I can see the inc files generated for each of the public dialects in my MLIR build directory – I’m assuming MLIRGPUOps refers to the public gpu dialect…

You’re using an old version of MLIR: [mlir][GPU] Rename MLIRGPUOps CMake target to MLIRGPUDialect · llvm/llvm-project@61223c4 · GitHub

Thanks!