@River707 @mehdi_amini There is a cmake function mlir_tablegen that generates tablegen_compile_commands.yml. Is there any bazel rule for that?
Have you looked into the Bazel build rules in the repo? There is everything needed to build MLIR with Bazel there. Here is the TableGen helpers for example: llvm-project/tblgen.bzl at main · llvm/llvm-project · GitHub
Thanks @mehdi_amini . I have not found anything like the following: llvm-project/AddMLIR.cmake at main · llvm/llvm-project · GitHub
There isn’t no. That is used by the LSP and where we use bazel we use a different indexing mechanism, so this was missed. It would be a welcome contribution.
@jpienaar I am using TensorFlow. Currently, as a workaround (only for LSP), I tried to write CMakeLists.txt inside tensorflow and generated tablegen_compile_commands.yml
. While the LSP recognizes llvm-project/mlir/*.td
files, it gives me an error for tensorflow *.td
files
Expected<T> must be checked before access or destruction.
Unchecked Expected<T> contained error:
File scheme: expect body to be an absolute path starting with '/': tensorflow/core/ir/dialect.td[Info - 8:39:11 AM] Connection to server got closed. Server will restart.
Here are my includes
include "tensorflow/core/ir/dialect.td"
include "tensorflow/core/ir/interfaces.td"
include "tensorflow/core/ir/types/attributes.td"
include "tensorflow/core/ir/types/types.td"
include "mlir/IR/FunctionInterfaces.td"
include "mlir/IR/OpAsmInterface.td"
include "mlir/IR/RegionKindInterface.td"
include "mlir/IR/SymbolInterfaces.td"
include "mlir/Interfaces/CallInterfaces.td"
include "mlir/Interfaces/ControlFlowInterfaces.td"
include "mlir/Interfaces/SideEffectInterfaces.td"
Here is my tablegen_compile_commands.yml
. Note <TF_ROOT> and <LLVM_ROOT> contains absolute paths for the respective project directories.
--- !FileInfo:
filepath: "<TF_ROOT>/tensorflow/core/ir/types/attributes.td"
includes: "<TF_ROOT>/tensorflow/core/ir/types;<TF_ROOT>;<LLVM_ROOT>/mlir/include"
--- !FileInfo:
filepath: "<TF_ROOT>/tensorflow/core/ir/types/types.td"
includes: "<TF_ROOT>/tensorflow/core/ir/types;<TF_ROOT>;<LLVM_ROOT>/mlir/include"
--- !FileInfo:
filepath: "<TF_ROOT>/tensorflow/core/ir/types/dialect.td"
includes: "<TF_ROOT>/tensorflow/core/ir/types;<TF_ROOT>;<LLVM_ROOT>/mlir/include"
--- !FileInfo:
filepath: "<TF_ROOT>/tensorflow/core/ir/dialect.td"
includes: "<TF_ROOT>/tensorflow/core/ir;<TF_ROOT>;<LLVM_ROOT>/mlir/include"
--- !FileInfo:
filepath: "<TF_ROOT>/tensorflow/core/ir/interfaces.td"
includes: "<TF_ROOT>/tensorflow/core/ir;<TF_ROOT>;<LLVM_ROOT>/mlir/include"
--- !FileInfo:
filepath: "<TF_ROOT>/tensorflow/core/ir/ops.td"
includes: "<TF_ROOT>/tensorflow/core/ir;<TF_ROOT>;<LLVM_ROOT>/mlir/include"
I am wondering what am I missing here.
That looks like it should be logged as an error (if the file path isn’t as it expects), can you file an issue with a repro? Unchecked Expected indicates a bug to me.
@River707 It actually gives me an error.
File scheme: expect body to be an absolute path starting with ‘/’: tensorflow/core/ir/dialect.td[Error - 10:05:51 AM] The TABLEGEN Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
@River707 I have my include path set to an absolute path. But I am wondering why include path is working for llvm-project/mlir *.td
, but not for tensorflow *.td
files. Am I missing anything?
@River707 I faced similar issue as @mdfaijulamin - I am going through Toy tutorial and adding my own example for practice, when I write my own *.td file and try include other *.td added by me, I am getting the same error
File scheme: expect body to be an absolute path starting with ‘/’: tensorflow/core/ir/dialect.td[Error - 10:05:51 AM] The TABLEGEN Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
If I include *.td files already existing in the repo (for example include "mlir/IR/DialectBase.td"
) - issue does not reproduce
Is there anything I am doing wrong?
Thanks,
Gleb