Generate dialect documentations in the doc folder for every dialect

Also add a mlir-doc build target to general all the docs

PiperOrigin-RevId: 283353529
This commit is contained in:
Mehdi Amini 2019-12-02 09:17:51 -08:00 committed by A. Unique TensorFlower
parent e7c8e542f4
commit 5e6795070c
10 changed files with 33 additions and 40 deletions

View file

@ -12,6 +12,27 @@ function(mlir_tablegen ofn)
PARENT_SCOPE)
endfunction()
function(add_mlir_dialect dialect)
set(LLVM_TARGET_DEFINITIONS ${dialect}.td)
mlir_tablegen(${dialect}.h.inc -gen-op-decls)
mlir_tablegen(${dialect}.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIR${dialect}IncGen)
# Generate Dialect Documentation
tablegen(MLIR ${dialect}.md -gen-op-doc "-I${MLIR_MAIN_SRC_DIR}" "-I${MLIR_INCLUDE_DIR}")
set(GEN_DOC_FILE ${MLIR_BINARY_DIR}/docs/Dialects/${dialect}.md)
add_custom_command(
OUTPUT ${GEN_DOC_FILE}
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/${dialect}.md
${GEN_DOC_FILE}
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${dialect}.md)
add_custom_target(${dialect}DocGen DEPENDS ${GEN_DOC_FILE})
add_dependencies(mlir-doc ${dialect}DocGen)
endfunction()
add_custom_target(mlir-doc)
# TODO: This is to handle the current static registration, but should be
# factored out a bit.
function(whole_archive_link target)

View file

@ -1,4 +1 @@
set(LLVM_TARGET_DEFINITIONS AffineOps.td)
mlir_tablegen(AffineOps.h.inc -gen-op-decls)
mlir_tablegen(AffineOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRAffineOpsIncGen)
add_mlir_dialect(AffineOps)

View file

@ -1,4 +1 @@
set(LLVM_TARGET_DEFINITIONS FxpMathOps.td)
mlir_tablegen(FxpMathOps.h.inc -gen-op-decls)
mlir_tablegen(FxpMathOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRFxpMathOpsIncGen)
add_mlir_dialect(FxpMathOps)

View file

@ -1,4 +1 @@
set(LLVM_TARGET_DEFINITIONS GPUOps.td)
mlir_tablegen(GPUOps.h.inc -gen-op-decls)
mlir_tablegen(GPUOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRGPUOpsIncGen)
add_mlir_dialect(GPUOps)

View file

@ -4,14 +4,10 @@ mlir_tablegen(LLVMOps.cpp.inc -gen-op-defs)
mlir_tablegen(LLVMOpsEnums.h.inc -gen-enum-decls)
mlir_tablegen(LLVMOpsEnums.cpp.inc -gen-enum-defs)
add_public_tablegen_target(MLIRLLVMOpsIncGen)
set(LLVM_TARGET_DEFINITIONS NVVMOps.td)
mlir_tablegen(NVVMOps.h.inc -gen-op-decls)
mlir_tablegen(NVVMOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRNVVMOpsIncGen)
set(LLVM_TARGET_DEFINITIONS ROCDLOps.td)
mlir_tablegen(ROCDLOps.h.inc -gen-op-decls)
mlir_tablegen(ROCDLOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRROCDLOpsIncGen)
add_mlir_dialect(NVVMOps)
add_mlir_dialect(ROCDLOps)
set(LLVM_TARGET_DEFINITIONS LLVMOps.td)
mlir_tablegen(LLVMConversions.inc -gen-llvmir-conversions)
add_public_tablegen_target(MLIRLLVMConversionsIncGen)

View file

@ -1,7 +1,4 @@
set(LLVM_TARGET_DEFINITIONS LinalgOps.td)
mlir_tablegen(LinalgOps.h.inc -gen-op-decls)
mlir_tablegen(LinalgOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRLinalgOpsIncGen)
add_mlir_dialect(LinalgOps)
set(LLVM_TARGET_DEFINITIONS LinalgLibraryOps.td)
mlir_tablegen(LinalgLibraryOps.h.inc -gen-op-decls)
mlir_tablegen(LinalgLibraryOps.cpp.inc -gen-op-defs)

View file

@ -1,4 +1 @@
set(LLVM_TARGET_DEFINITIONS LoopOps.td)
mlir_tablegen(LoopOps.h.inc -gen-op-decls)
mlir_tablegen(LoopOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRLoopOpsIncGen)
add_mlir_dialect(LoopOps)

View file

@ -1,4 +1 @@
set(LLVM_TARGET_DEFINITIONS QuantOps.td)
mlir_tablegen(QuantOps.h.inc -gen-op-decls)
mlir_tablegen(QuantOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRQuantOpsIncGen)
add_mlir_dialect(QuantOps)

View file

@ -3,10 +3,7 @@ mlir_tablegen(SPIRVLowering.h.inc -gen-struct-attr-decls)
mlir_tablegen(SPIRVLowering.cpp.inc -gen-struct-attr-defs)
add_public_tablegen_target(MLIRSPIRVLoweringStructGen)
set(LLVM_TARGET_DEFINITIONS SPIRVOps.td)
mlir_tablegen(SPIRVOps.h.inc -gen-op-decls)
mlir_tablegen(SPIRVOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRSPIRVOpsIncGen)
add_mlir_dialect(SPIRVOps)
set(LLVM_TARGET_DEFINITIONS SPIRVBase.td)
mlir_tablegen(SPIRVEnums.h.inc -gen-enum-decls)

View file

@ -1,7 +1,4 @@
set(LLVM_TARGET_DEFINITIONS VectorOps.td)
mlir_tablegen(VectorOps.h.inc -gen-op-decls)
mlir_tablegen(VectorOps.cpp.inc -gen-op-defs)
add_public_tablegen_target(MLIRVectorOpsIncGen)
add_mlir_dialect(VectorOps)
set(LLVM_TARGET_DEFINITIONS VectorTransformPatterns.td)
mlir_tablegen(VectorTransformPatterns.h.inc -gen-rewriters)