Lines Matching refs:Toy
6 help to compile Toy.
41 Here is the MLIR assembly for the Toy `transpose` operations:
53 An operation may define zero or more results (in the context of Toy, we
122 operation. For example, we could place our Toy operation from above into an
143 This handling can be observed by crafting what should be an invalid IR for Toy
157 ## Defining a Toy Dialect
159 To effectively interface with MLIR, we will define a new Toy dialect. This
160 dialect will model the structure of the Toy language, as well as provide an easy
164 /// This is the definition of the Toy dialect. A dialect inherits from
176 /// register attributes, operations, types, and more within the Toy dialect.
199 "Toy language";
203 The Toy language is a tensor-based language that allows you to define
229 components, meaning that other dialects, such as our `Toy` dialect, must be
232 ## Defining Toy Operations
234 Now that we have a `Toy` dialect, we can start defining the operations. This
237 operation. This operation will represent a constant value in the Toy language.
325 properties of operations. This means that when we define our Toy operations, we
364 operation definitions, we will define a base class for operations in the Toy
541 At this point we can generate our "Toy IR". For example, the following:
563 …(%arg0: tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy":4:1), %arg1: tensor<*xf64> loc("test…
564 …%0 = "toy.transpose"(%arg0) : (tensor<*xf64>) -> tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.…
565 …%1 = "toy.transpose"(%arg1) : (tensor<*xf64>) -> tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.…
566 …%2 = "toy.mul"(%0, %1) : (tensor<*xf64>, tensor<*xf64>) -> tensor<*xf64> loc("test/Examples/Toy/Ch…
567 "toy.return"(%2) : (tensor<*xf64>) -> () loc("test/Examples/Toy/Ch2/codegen.toy":5:3)
568 …sor<*xf64>, tensor<*xf64>) -> tensor<*xf64>} : () -> () loc("test/Examples/Toy/Ch2/codegen.toy":4:…
570 …00000e+00]]> : tensor<2x3xf64>} : () -> tensor<2x3xf64> loc("test/Examples/Toy/Ch2/codegen.toy":9:…
571 …%1 = "toy.reshape"(%0) : (tensor<2x3xf64>) -> tensor<2x3xf64> loc("test/Examples/Toy/Ch2/codegen.t…
572 …, 6.000000e+00]> : tensor<6xf64>} : () -> tensor<6xf64> loc("test/Examples/Toy/Ch2/codegen.toy":10…
573 …%3 = "toy.reshape"(%2) : (tensor<6xf64>) -> tensor<2x3xf64> loc("test/Examples/Toy/Ch2/codegen.toy…
574 …} : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy":11…
575 …} : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy":12…
576 "toy.print"(%5) : (tensor<*xf64>) -> () loc("test/Examples/Toy/Ch2/codegen.toy":13:3)
577 "toy.return"() : () -> () loc("test/Examples/Toy/Ch2/codegen.toy":8:1)
578 }) {sym_name = "main", type = () -> ()} : () -> () loc("test/Examples/Toy/Ch2/codegen.toy":8:1)
582 One thing to notice here is that all of our Toy operations are printed using the
692 …%0 = toy.transpose(%arg0 : tensor<*xf64>) to tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy"…
693 …%1 = toy.transpose(%arg1 : tensor<*xf64>) to tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy"…
694 %2 = toy.mul %0, %1 : tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy":5:25)
695 toy.return %2 : tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy":5:3)
696 } loc("test/Examples/Toy/Ch2/codegen.toy":4:1)
698 …00e+00, 5.000000e+00, 6.000000e+00]]> : tensor<2x3xf64> loc("test/Examples/Toy/Ch2/codegen.toy":9:…
699 …%1 = toy.reshape(%0 : tensor<2x3xf64>) to tensor<2x3xf64> loc("test/Examples/Toy/Ch2/codegen.toy":…
700 …00000e+00, 5.000000e+00, 6.000000e+00]> : tensor<6xf64> loc("test/Examples/Toy/Ch2/codegen.toy":10…
701 …%3 = toy.reshape(%2 : tensor<6xf64>) to tensor<2x3xf64> loc("test/Examples/Toy/Ch2/codegen.toy":10…
702 …) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy":11…
703 …) : (tensor<2x3xf64>, tensor<2x3xf64>) -> tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy":12…
704 toy.print %5 : tensor<*xf64> loc("test/Examples/Toy/Ch2/codegen.toy":13:3)
705 toy.return loc("test/Examples/Toy/Ch2/codegen.toy":8:1)
706 } loc("test/Examples/Toy/Ch2/codegen.toy":8:1)
715 ## Complete Toy Example
717 We can now generate our "Toy IR". You can build `toyc-ch2` and try yourself on
718 the above example: `toyc-ch2 test/Examples/Toy/Ch2/codegen.toy -emit=mlir
720 test/Examples/Toy/Ch2/codegen.toy -emit=mlir -mlir-print-debuginfo 2>
724 At this point, MLIR knows about our Toy dialect and operations. In the
726 high-level language-specific analyses and transformations for the Toy language.