Skip to content

Commit

Permalink
Fix formatting on spec examples (openxla#2117)
Browse files Browse the repository at this point in the history
As pointed out in
openxla#2097 (comment),
MLIR doesn't insert spaces between the brackets and the content. I've
also made minor formatting improvements.
  • Loading branch information
ghpvnist authored Mar 21, 2024
1 parent b27ef13 commit 4f180d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions docs/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func.func @main(
%0 = "stablehlo.reshape"(%image) : (tensor<28x28xf32>) -> tensor<1x784xf32>
%1 = "stablehlo.dot"(%0, %weights) : (tensor<1x784xf32>, tensor<784x10xf32>) -> tensor<1x10xf32>
%2 = "stablehlo.add"(%1, %bias) : (tensor<1x10xf32>, tensor<1x10xf32>) -> tensor<1x10xf32>
%3 = "stablehlo.constant"() { value = dense<0.0> : tensor<1x10xf32> } : () -> tensor<1x10xf32>
%3 = "stablehlo.constant"() {value = dense<0.0> : tensor<1x10xf32>} : () -> tensor<1x10xf32>
%4 = "stablehlo.maximum"(%2, %3) : (tensor<1x10xf32>, tensor<1x10xf32>) -> tensor<1x10xf32>
"func.return"(%4): (tensor<1x10xf32>) -> ()
}
Expand Down Expand Up @@ -1965,8 +1965,10 @@ semantics change.
```mlir
%results = "stablehlo.composite"(%input0, %input1) {
name = "my_namespace.my_op",
composite_attributes = {
my_attribute = "my_value"
},
decomposition = @my_op,
composite_attributes = { my_attribute = "my_value" },
version = 1 : i32
} : (tensor<f32>, tensor<f32>) -> tensor<f32>
```
Expand Down Expand Up @@ -3871,7 +3873,7 @@ Semantics of `outfeed_config` is implementation-defined.
#### Examples

```mlir
%result = "stablehlo.outfeed"(%inputs0, %token) {
%result = "stablehlo.outfeed"(%input0, %token) {
outfeed_config = ""
} : (tensor<2x2x2xi64>, !stablehlo.token) -> !stablehlo.token
```
Expand Down
8 changes: 5 additions & 3 deletions stablehlo/dialect/StablehloOps.td
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ def StableHLO_OutfeedOp : StableHLO_Op<"outfeed",

Example:
```mlir
%result = "stablehlo.outfeed"(%inputs0, %token) :
%result = "stablehlo.outfeed"(%input0, %token) :
(tensor<2x2x2xi64>, !stablehlo.token) -> !stablehlo.token
```
}];
Expand Down Expand Up @@ -2100,9 +2100,11 @@ def StableHLO_CompositeOp : StableHLO_Op<"composite", [DeclareOpInterfaceMethods

Example:
```mlir
%results = stablehlo.composite "my.op" %arg0, %arg1 {
%results = stablehlo.composite "my.op" %input0, %input1 {
composite_attributes = {
my_attribute = "my_value"
},
decomposition = @my_op,
composite_attributes = { my_attribute = "my_value" },
version = 1 : i32
} : (tensor<f32>, tensor<f32>) -> tensor<f32>
```
Expand Down

0 comments on commit 4f180d3

Please sign in to comment.