Issue 146760
Summary [mlir][amdgpu][docs] Add op examples to dialect docs
Labels mlir
Assignees
Reporter kuhar
    The amdgpu dialect docs contain op description and auto-generated syntax but not actual examples. We should improve dialect documentation by adding an example(s) for each op.

Other dialects like [arith](https://mlir.llvm.org/docs/Dialects/ArithOps/) or [SPIR-V](https://mlir.llvm.org/docs/Dialects/SPIR-V/) can be referenced for inspiration on how to provide examples, e.g.:

> Example:
> ```mlir
> // Scalar addition.
> %a = arith.addi %b, %c : i64
> 
> // Scalar addition with overflow flags.
> %a = arith.addi %b, %c overflow<nsw, nuw> : i64
> 
> // SIMD vector element-wise addition.
> %f = arith.addi %g, %h : vector<4xi32>
> 
> // Tensor element-wise addition.
> %x = arith.addi %y, %z : tensor<4x?xi8>
> ```

We should be able to extract examples by looking at op tests in https://github.com/llvm/llvm-project/blob/main/mlir/test/Dialect/AMDGPU/ops.mlir
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to