Add more navigation to the MLIR toy tutorial.
authorMLIR Team <no-reply@google.com>
Fri, 15 Nov 2019 10:17:09 +0000 (02:17 -0800)
committerA. Unique TensorFlower <gardener@tensorflow.org>
Fri, 15 Nov 2019 10:17:38 +0000 (02:17 -0800)
This comes in the form of:
1. Missing links to next chapters.
2. Table of contents for each page.

PiperOrigin-RevId: 280619053

mlir/g3doc/Tutorials/Toy/Ch-1.md
mlir/g3doc/Tutorials/Toy/Ch-3.md
mlir/g3doc/Tutorials/Toy/Ch-4.md
mlir/g3doc/Tutorials/Toy/Ch-5.md
mlir/g3doc/Tutorials/Toy/Ch-6.md

index cec79a4..deb773d 100644 (file)
@@ -1,5 +1,7 @@
 # Chapter 1: Toy Tutorial Introduction
 
+[TOC]
+
 This tutorial runs through the implementation of a basic toy language on top of
 MLIR. The goal of this tutorial is to introduce the concepts of MLIR, and
 especially how *dialects* can help easily support language specific constructs
@@ -7,6 +9,8 @@ and transformations, while still offering an easy path to lower to LLVM or other
 codegen infrastructure. This tutorial is based on the model of the
 [LLVM Kaleidoscope Tutorial](https://llvm.org/docs/tutorial/MyFirstLanguageFrontend/index.html).
 
+## The Chapters
+
 This tutorial is divided in the following chapters:
 
 -   [Chapter #1](Ch-1.md): Introduction to the Toy language, and the definition
index 07f8c5c..38da307 100644 (file)
@@ -1,5 +1,7 @@
 # Chapter 3: High-level Language-Specific Analysis and Transformation
 
+[TOC]
+
 Creating a dialect that closely represents the semantics of an input language
 enables analyses, transformations and optimizations in MLIR that require high
 level language information and are generally performed on the language AST. For
@@ -256,3 +258,7 @@ As expected, no reshape operations remain after canonicalization.
 
 Further details on the declarative rewrite method can be found at
 [Table-driven Declarative Rewrite Rule (DRR)](../../DeclarativeRewrites.md).
+
+In this chapter, we saw how to use certain core transformations through always
+available hooks. In the [next chapter](Ch-4.md), we will see how to use generic
+solutions that scale better through Interfaces.
index 39349eb..5acb631 100644 (file)
@@ -1,5 +1,7 @@
 # Chapter 4: Enabling Generic Transformation with Interfaces
 
+[TOC]
+
 ## Background: Grappling with an Extensible IR
 
 Through dialects, MLIR allows for the representation of many different levels of
@@ -274,8 +276,8 @@ def ShapeInferenceOpInterface : OpInterface<"ShapeInference"> {
 Next we define the interface methods that the operations will need to provide.
 An interface method is comprised of: a description, a c++ return type in string
 form, a method name in string form, as well as a few optional components
-depending on the need. See the [ODS
-documentation]](../../OpDefinitions.md#operation-interfaces) for more
+depending on the need. See the
+[ODS documentation](../../OpDefinitions.md#operation-interfaces) for more
 information.
 
 ```.td
index badbd3a..69ba870 100644 (file)
@@ -1,5 +1,7 @@
 # Chapter 5 - Partial Lowering to Lower-Level Dialects for Optimization
 
+[TOC]
+
 At this point, we are eager to generate actual code and see our Toy language
 taking life. We will obviously use LLVM to generate code, but just showing the
 LLVM builder interface wouldn't be very exciting here. Instead, we will show how
index 49114b4..4a88407 100644 (file)
@@ -1,5 +1,7 @@
 # Chapter 6 - Lowering to LLVM and CodeGeneration
 
+[TOC]
+
 In the [previous chapter](Ch-5.md), we introduced the
 [dialect conversion](../../DialectConversion.md) framework and partially lowered
 many of the `Toy` operations to affine loop nests for optimization. In this
@@ -318,3 +320,6 @@ You can also play with -emit=mlir, -emit=mlir-affine, -emit=mlir-llvm, and
 -emit=llvm to compare the various levels of IR involved. Also try options like
 [--print-ir-after-all](../../WritingAPass.md#ir-printing) to track the evolution
 of the IR throughout the pipeline.
+
+So far, we have worked with primitive data types. In the
+[next chapter](Ch-7.md), we will add a composite `struct` type.