<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/mlir/lib/Dialect/MemRef/Transforms/ComposeSubView.cpp, branch main</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.
</subtitle>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/'/>
<entry>
<title>[mlir][memref] Support test-compose-subview dynamic size (#146881)</title>
<updated>2025-07-28T08:58:45+00:00</updated>
<author>
<name>lonely eagle</name>
<email>2020382038@qq.com</email>
</author>
<published>2025-07-28T08:58:45+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2adbf9e92b75fb6db9e98334419e1ae192f3575b'/>
<id>2adbf9e92b75fb6db9e98334419e1ae192f3575b</id>
<content type='text'>
Supports the case where the sizes of the subview op is dynamic.When
there are more for loops in the tile algorithm, multiple subviews are
performed and test-compose-subview does not work when the size operand
of the subview ops is dynamic value.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Supports the case where the sizes of the subview op is dynamic.When
there are more for loops in the tile algorithm, multiple subviews are
performed and test-compose-subview does not work when the size operand
of the subview ops is dynamic value.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][NFC] update `mlir/Dialect` create APIs (18/n) (#149925)</title>
<updated>2025-07-24T20:38:30+00:00</updated>
<author>
<name>Maksim Levental</name>
<email>maksim.levental@gmail.com</email>
</author>
<published>2025-07-24T20:38:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a636b7bfdd1d8304b78e8b42ec900a21736d4afb'/>
<id>a636b7bfdd1d8304b78e8b42ec900a21736d4afb</id>
<content type='text'>
See https://github.com/llvm/llvm-project/pull/147168 for more info.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
See https://github.com/llvm/llvm-project/pull/147168 for more info.</pre>
</div>
</content>
</entry>
<entry>
<title>[llvm] Remove unused includes (NFC) (#148342)</title>
<updated>2025-07-12T18:28:55+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2025-07-12T18:28:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=d5def016b6ee3dcf4e1848ba39aba07e80714b75'/>
<id>d5def016b6ee3dcf4e1848ba39aba07e80714b75</id>
<content type='text'>
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These are identified by misc-include-cleaner.  I've filtered out those
that break builds.  Also, I'm staying away from llvm-config.h,
config.h, and Compiler.h, which likely cause platform- or
compiler-specific build failures.</pre>
</div>
</content>
</entry>
<entry>
<title>[MemRef] Migrate away from PointerUnion::{is,get} (NFC) (#120202)</title>
<updated>2024-12-17T17:07:47+00:00</updated>
<author>
<name>Kazu Hirata</name>
<email>kazu@google.com</email>
</author>
<published>2024-12-17T17:07:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=30916b6942371fc314f3ce1bfa4042cae3e6ff28'/>
<id>30916b6942371fc314f3ce1bfa4042cae3e6ff28</id>
<content type='text'>
Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //        isa&lt;T&gt;, cast&lt;T&gt; and the llvm::dyn_cast&lt;T&gt;

I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Note that PointerUnion::{is,get} have been soft deprecated in
PointerUnion.h:

  // FIXME: Replace the uses of is(), get() and dyn_cast() with
  //        isa&lt;T&gt;, cast&lt;T&gt; and the llvm::dyn_cast&lt;T&gt;

I'm not touching PointerUnion::dyn_cast for now because it's a bit
complicated; we could blindly migrate it to dyn_cast_if_present, but
we should probably use dyn_cast when the operand is known to be
non-null.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir]Fix compose subview (#80551)</title>
<updated>2024-02-07T19:49:27+00:00</updated>
<author>
<name>lonely eagle</name>
<email>2020382038@qq.com</email>
</author>
<published>2024-02-07T19:49:27+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=2ecf608829252d7d5b530a03b87817cd948a3386'/>
<id>2ecf608829252d7d5b530a03b87817cd948a3386</id>
<content type='text'>
I found a bug in `test-compose-subview`,You can see the example I gave.
```
#map = affine_map&lt;() -&gt; ()&gt;
module {
  func.func private @fun(%arg0: memref&lt;10x10xf32&gt;, %arg1: memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt; {
    %c0 = arith.constant 0 : index
    %c5 = arith.constant 5 : index
    %c1 = arith.constant 1 : index
    %subview = memref.subview %arg0[0, 0] [5, 5] [1, 1] : memref&lt;10x10xf32&gt; to memref&lt;5x5xf32, strided&lt;[10, 1]&gt;&gt;
    %alloc = memref.alloc() : memref&lt;5x5xf32&gt;
    scf.for %arg2 = %c0 to %c5 step %c1 {
      scf.for %arg3 = %c0 to %c5 step %c1 {
        %subview_0 = memref.subview %subview[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32, strided&lt;[10, 1]&gt;&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        %subview_1 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        %alloc_2 = memref.alloc() : memref&lt;f32&gt;
        linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%subview_0, %subview_1 : memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;) outs(%alloc_2 : memref&lt;f32&gt;) {
        ^bb0(%in: f32, %in_4: f32, %out: f32):
          %0 = arith.addf %in, %in_4 : f32
          linalg.yield %0 : f32
        }
        %subview_3 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        memref.copy %alloc_2, %subview_3 : memref&lt;f32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      }
    }
    return %alloc : memref&lt;5x5xf32&gt;
  }
  func.func @test(%arg0: memref&lt;10x10xf32&gt;, %arg1: memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt; {
    %0 = call @fun(%arg0, %arg1) : (memref&lt;10x10xf32&gt;, memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt;
    return %0 : memref&lt;5x5xf32&gt;
  }
}
```
When I run `mlir-opt test.mlir ---test-compose-subview`.
```
test.mlir:14:9: error: 'linalg.generic' op expected operand rank (2) to match the result rank of indexing_map #0 (0)
        linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%subview_0, %subview_1 : memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;) outs(%alloc_2 : memref&lt;f32&gt;) {
        ^
test1.mlir:14:9: note: see current operation: 
"linalg.generic"(%4, %5, %6) &lt;{indexing_maps = [affine_map&lt;() -&gt; ()&gt;, affine_map&lt;() -&gt; ()&gt;, affine_map&lt;() -&gt; ()&gt;], iterator_types = [], operandSegmentSizes = array&lt;i32: 2, 1&gt;}&gt; ({
^bb0(%arg4: f32, %arg5: f32, %arg6: f32):
  %8 = "arith.addf"(%arg4, %arg5) &lt;{fastmath = #arith.fastmath&lt;none&gt;}&gt; : (f32, f32) -&gt; f32
  "linalg.yield"(%8) : (f32) -&gt; ()
}) : (memref&lt;1x1xf32, strided&lt;[10, 1], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32&gt;) -&gt; ()
```
This PR fixes that.In the meantime I've extended this PR to handle cases
where stride is greater than 1.
```
func.func private @Unknown0(%arg0: memref&lt;10x10xf32&gt;, %arg1: memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt; {
  %c0 = arith.constant 0 : index
  %c5 = arith.constant 5 : index
  %c1 = arith.constant 1 : index
  %subview = memref.subview %arg0[0, 0] [5, 5] [2, 2] : memref&lt;10x10xf32&gt; to memref&lt;5x5xf32, strided&lt;[20, 2]&gt;&gt;
  %alloc = memref.alloc() : memref&lt;5x5xf32&gt;
  scf.for %arg2 = %c0 to %c5 step %c1 {
    scf.for %arg3 = %c0 to %c5 step %c1 {
      %subview_0 = memref.subview %subview[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32, strided&lt;[20, 2]&gt;&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      %subview_1 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      %alloc_2 = memref.alloc() : memref&lt;f32&gt;
      linalg.generic {indexing_maps = [affine_map&lt;() -&gt; ()&gt;, affine_map&lt;() -&gt; ()&gt;, affine_map&lt;() -&gt; ()&gt;], iterator_types = []} ins(%subview_0, %subview_1 : memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;) outs(%alloc_2 : memref&lt;f32&gt;) {
      ^bb0(%in: f32, %in_4: f32, %out: f32):
        %0 = arith.addf %in, %in_4 : f32
        linalg.yield %0 : f32
      }
      %subview_3 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      memref.copy %alloc_2, %subview_3 : memref&lt;f32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
    }
  }
  return %alloc : memref&lt;5x5xf32&gt;
}
$ mlir-opt test.mlir -test-compose-subview
#map = affine_map&lt;()[s0] -&gt; (s0 * 2)&gt;
#map1 = affine_map&lt;() -&gt; ()&gt;
module {
  func.func private @Unknown0(%arg0: memref&lt;10x10xf32&gt;, %arg1: memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt;  {
    %c0 = arith.constant 0 : index
    %c5 = arith.constant 5 : index
    %c1 = arith.constant 1 : index
    %alloc = memref.alloc() : memref&lt;5x5xf32&gt;
    scf.for %arg2 = %c0 to %c5 step %c1 {
      scf.for %arg3 = %c0 to %c5 step %c1 {
        %0 = affine.apply #map()[%arg2]
        %1 = affine.apply #map()[%arg3]
        %subview = memref.subview %arg0[%0, %1] [1, 1] [2, 2] : memref&lt;10x10xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        %subview_0 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        %alloc_1 = memref.alloc() : memref&lt;f32&gt;
        linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = []} ins(%subview, %subview_0 : memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;) outs(%alloc_1 : memref&lt;f32&gt;) {
        ^bb0(%in: f32, %in_3: f32, %out: f32):
          %2 = arith.addf %in, %in_3 : f32
          linalg.yield %2 : f32
        }
        %subview_2 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        memref.copy %alloc_1, %subview_2 : memref&lt;f32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      }
    }
    return %alloc : memref&lt;5x5xf32&gt;
  }
}
```</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
I found a bug in `test-compose-subview`,You can see the example I gave.
```
#map = affine_map&lt;() -&gt; ()&gt;
module {
  func.func private @fun(%arg0: memref&lt;10x10xf32&gt;, %arg1: memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt; {
    %c0 = arith.constant 0 : index
    %c5 = arith.constant 5 : index
    %c1 = arith.constant 1 : index
    %subview = memref.subview %arg0[0, 0] [5, 5] [1, 1] : memref&lt;10x10xf32&gt; to memref&lt;5x5xf32, strided&lt;[10, 1]&gt;&gt;
    %alloc = memref.alloc() : memref&lt;5x5xf32&gt;
    scf.for %arg2 = %c0 to %c5 step %c1 {
      scf.for %arg3 = %c0 to %c5 step %c1 {
        %subview_0 = memref.subview %subview[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32, strided&lt;[10, 1]&gt;&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        %subview_1 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        %alloc_2 = memref.alloc() : memref&lt;f32&gt;
        linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%subview_0, %subview_1 : memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;) outs(%alloc_2 : memref&lt;f32&gt;) {
        ^bb0(%in: f32, %in_4: f32, %out: f32):
          %0 = arith.addf %in, %in_4 : f32
          linalg.yield %0 : f32
        }
        %subview_3 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        memref.copy %alloc_2, %subview_3 : memref&lt;f32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      }
    }
    return %alloc : memref&lt;5x5xf32&gt;
  }
  func.func @test(%arg0: memref&lt;10x10xf32&gt;, %arg1: memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt; {
    %0 = call @fun(%arg0, %arg1) : (memref&lt;10x10xf32&gt;, memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt;
    return %0 : memref&lt;5x5xf32&gt;
  }
}
```
When I run `mlir-opt test.mlir ---test-compose-subview`.
```
test.mlir:14:9: error: 'linalg.generic' op expected operand rank (2) to match the result rank of indexing_map #0 (0)
        linalg.generic {indexing_maps = [#map, #map, #map], iterator_types = []} ins(%subview_0, %subview_1 : memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;) outs(%alloc_2 : memref&lt;f32&gt;) {
        ^
test1.mlir:14:9: note: see current operation: 
"linalg.generic"(%4, %5, %6) &lt;{indexing_maps = [affine_map&lt;() -&gt; ()&gt;, affine_map&lt;() -&gt; ()&gt;, affine_map&lt;() -&gt; ()&gt;], iterator_types = [], operandSegmentSizes = array&lt;i32: 2, 1&gt;}&gt; ({
^bb0(%arg4: f32, %arg5: f32, %arg6: f32):
  %8 = "arith.addf"(%arg4, %arg5) &lt;{fastmath = #arith.fastmath&lt;none&gt;}&gt; : (f32, f32) -&gt; f32
  "linalg.yield"(%8) : (f32) -&gt; ()
}) : (memref&lt;1x1xf32, strided&lt;[10, 1], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32&gt;) -&gt; ()
```
This PR fixes that.In the meantime I've extended this PR to handle cases
where stride is greater than 1.
```
func.func private @Unknown0(%arg0: memref&lt;10x10xf32&gt;, %arg1: memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt; {
  %c0 = arith.constant 0 : index
  %c5 = arith.constant 5 : index
  %c1 = arith.constant 1 : index
  %subview = memref.subview %arg0[0, 0] [5, 5] [2, 2] : memref&lt;10x10xf32&gt; to memref&lt;5x5xf32, strided&lt;[20, 2]&gt;&gt;
  %alloc = memref.alloc() : memref&lt;5x5xf32&gt;
  scf.for %arg2 = %c0 to %c5 step %c1 {
    scf.for %arg3 = %c0 to %c5 step %c1 {
      %subview_0 = memref.subview %subview[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32, strided&lt;[20, 2]&gt;&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      %subview_1 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      %alloc_2 = memref.alloc() : memref&lt;f32&gt;
      linalg.generic {indexing_maps = [affine_map&lt;() -&gt; ()&gt;, affine_map&lt;() -&gt; ()&gt;, affine_map&lt;() -&gt; ()&gt;], iterator_types = []} ins(%subview_0, %subview_1 : memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;) outs(%alloc_2 : memref&lt;f32&gt;) {
      ^bb0(%in: f32, %in_4: f32, %out: f32):
        %0 = arith.addf %in, %in_4 : f32
        linalg.yield %0 : f32
      }
      %subview_3 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      memref.copy %alloc_2, %subview_3 : memref&lt;f32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
    }
  }
  return %alloc : memref&lt;5x5xf32&gt;
}
$ mlir-opt test.mlir -test-compose-subview
#map = affine_map&lt;()[s0] -&gt; (s0 * 2)&gt;
#map1 = affine_map&lt;() -&gt; ()&gt;
module {
  func.func private @Unknown0(%arg0: memref&lt;10x10xf32&gt;, %arg1: memref&lt;5x5xf32&gt;) -&gt; memref&lt;5x5xf32&gt;  {
    %c0 = arith.constant 0 : index
    %c5 = arith.constant 5 : index
    %c1 = arith.constant 1 : index
    %alloc = memref.alloc() : memref&lt;5x5xf32&gt;
    scf.for %arg2 = %c0 to %c5 step %c1 {
      scf.for %arg3 = %c0 to %c5 step %c1 {
        %0 = affine.apply #map()[%arg2]
        %1 = affine.apply #map()[%arg3]
        %subview = memref.subview %arg0[%0, %1] [1, 1] [2, 2] : memref&lt;10x10xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        %subview_0 = memref.subview %arg1[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        %alloc_1 = memref.alloc() : memref&lt;f32&gt;
        linalg.generic {indexing_maps = [#map1, #map1, #map1], iterator_types = []} ins(%subview, %subview_0 : memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;, memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;) outs(%alloc_1 : memref&lt;f32&gt;) {
        ^bb0(%in: f32, %in_3: f32, %out: f32):
          %2 = arith.addf %in, %in_3 : f32
          linalg.yield %2 : f32
        }
        %subview_2 = memref.subview %alloc[%arg2, %arg3] [1, 1] [1, 1] : memref&lt;5x5xf32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
        memref.copy %alloc_1, %subview_2 : memref&lt;f32&gt; to memref&lt;f32, strided&lt;[], offset: ?&gt;&gt;
      }
    }
    return %alloc : memref&lt;5x5xf32&gt;
  }
}
```</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Move casting calls from methods to function calls</title>
<updated>2023-05-26T08:29:55+00:00</updated>
<author>
<name>Tres Popp</name>
<email>tpopp@google.com</email>
</author>
<published>2023-05-26T08:17:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=68f58812e3e99e31d77c0c23b6298489444dc0be'/>
<id>68f58812e3e99e31d77c0c23b6298489444dc0be</id>
<content type='text'>
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This patch updates all remaining uses of the deprecated functionality in
mlir/. This was done with clang-tidy as described below and further
modifications to GPUBase.td and OpenMPOpsInterfaces.td.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```

Differential Revision: https://reviews.llvm.org/D151542
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This patch updates all remaining uses of the deprecated functionality in
mlir/. This was done with clang-tidy as described below and further
modifications to GPUBase.td and OpenMPOpsInterfaces.td.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc
```

Differential Revision: https://reviews.llvm.org/D151542
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Move casting calls from methods to function calls</title>
<updated>2023-05-12T09:21:25+00:00</updated>
<author>
<name>Tres Popp</name>
<email>tpopp@google.com</email>
</author>
<published>2023-05-08T14:33:54+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5550c821897ab77e664977121a0e90ad5be1ff59'/>
<id>5550c821897ab77e664977121a0e90ad5be1ff59</id>
<content type='text'>
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Caveats include:
- This clang-tidy script probably has more problems.
- This only touches C++ code, so nothing that is being generated.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This first patch was created with the following steps. The intention is
to only do automated changes at first, so I waste less time if it's
reverted, and so the first mass change is more clear as an example to
other teams that will need to follow similar steps.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.
4. Some changes have been deleted for the following reasons:
   - Some files had a variable also named cast
   - Some files had not included a header file that defines the cast
     functions
   - Some files are definitions of the classes that have the casting
     methods, so the code still refers to the method instead of the
     function without adding a prefix or removing the method declaration
     at the same time.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc

git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\
            mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\
            mlir/lib/**/IR/\
            mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\
            mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\
            mlir/test/lib/Dialect/Test/TestTypes.cpp\
            mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\
            mlir/test/lib/Dialect/Test/TestAttributes.cpp\
            mlir/unittests/TableGen/EnumsGenTest.cpp\
            mlir/test/python/lib/PythonTestCAPI.cpp\
            mlir/include/mlir/IR/
```

Differential Revision: https://reviews.llvm.org/D150123
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The MLIR classes Type/Attribute/Operation/Op/Value support
cast/dyn_cast/isa/dyn_cast_or_null functionality through llvm's doCast
functionality in addition to defining methods with the same name.
This change begins the migration of uses of the method to the
corresponding function call as has been decided as more consistent.

Note that there still exist classes that only define methods directly,
such as AffineExpr, and this does not include work currently to support
a functional cast/isa call.

Caveats include:
- This clang-tidy script probably has more problems.
- This only touches C++ code, so nothing that is being generated.

Context:
- https://mlir.llvm.org/deprecation/ at "Use the free function variants
  for dyn_cast/cast/isa/…"
- Original discussion at https://discourse.llvm.org/t/preferred-casting-style-going-forward/68443

Implementation:
This first patch was created with the following steps. The intention is
to only do automated changes at first, so I waste less time if it's
reverted, and so the first mass change is more clear as an example to
other teams that will need to follow similar steps.

Steps are described per line, as comments are removed by git:
0. Retrieve the change from the following to build clang-tidy with an
   additional check:
   https://github.com/llvm/llvm-project/compare/main...tpopp:llvm-project:tidy-cast-check
1. Build clang-tidy
2. Run clang-tidy over your entire codebase while disabling all checks
   and enabling the one relevant one. Run on all header files also.
3. Delete .inc files that were also modified, so the next build rebuilds
   them to a pure state.
4. Some changes have been deleted for the following reasons:
   - Some files had a variable also named cast
   - Some files had not included a header file that defines the cast
     functions
   - Some files are definitions of the classes that have the casting
     methods, so the code still refers to the method instead of the
     function without adding a prefix or removing the method declaration
     at the same time.

```
ninja -C $BUILD_DIR clang-tidy

run-clang-tidy -clang-tidy-binary=$BUILD_DIR/bin/clang-tidy -checks='-*,misc-cast-functions'\
               -header-filter=mlir/ mlir/* -fix

rm -rf $BUILD_DIR/tools/mlir/**/*.inc

git restore mlir/lib/IR mlir/lib/Dialect/DLTI/DLTI.cpp\
            mlir/lib/Dialect/Complex/IR/ComplexDialect.cpp\
            mlir/lib/**/IR/\
            mlir/lib/Dialect/SparseTensor/Transforms/SparseVectorization.cpp\
            mlir/lib/Dialect/Vector/Transforms/LowerVectorMultiReduction.cpp\
            mlir/test/lib/Dialect/Test/TestTypes.cpp\
            mlir/test/lib/Dialect/Transform/TestTransformDialectExtension.cpp\
            mlir/test/lib/Dialect/Test/TestAttributes.cpp\
            mlir/unittests/TableGen/EnumsGenTest.cpp\
            mlir/test/python/lib/PythonTestCAPI.cpp\
            mlir/include/mlir/IR/
```

Differential Revision: https://reviews.llvm.org/D150123
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][Affine][NFC] Wrap dialect in "affine" namespace</title>
<updated>2023-04-20T02:19:21+00:00</updated>
<author>
<name>Matthias Springer</name>
<email>springerm@google.com</email>
</author>
<published>2023-04-20T02:02:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4c48f016effde67d500fc95290096aec9f3bdb70'/>
<id>4c48f016effde67d500fc95290096aec9f3bdb70</id>
<content type='text'>
This cleanup aligns the affine dialect with all the other dialects.

Differential Revision: https://reviews.llvm.org/D148687
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This cleanup aligns the affine dialect with all the other dialects.

Differential Revision: https://reviews.llvm.org/D148687
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] (NFC) run clang-format on all files</title>
<updated>2022-07-14T20:32:13+00:00</updated>
<author>
<name>Jeff Niu</name>
<email>jeff@modular.com</email>
</author>
<published>2022-07-14T20:31:47+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=b7f93c28096fc8503e4d2d80c43ee2c0ccce480f'/>
<id>b7f93c28096fc8503e4d2d80c43ee2c0ccce480f</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Flip accessors to prefixed form (NFC)</title>
<updated>2022-07-11T04:19:11+00:00</updated>
<author>
<name>Jacques Pienaar</name>
<email>jpienaar@google.com</email>
</author>
<published>2022-07-11T04:19:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=136d746ec7f43584f68c11d3ccc4088db4734d29'/>
<id>136d746ec7f43584f68c11d3ccc4088db4734d29</id>
<content type='text'>
Another mechanical sweep to keep diff small for flip to _Prefixed.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Another mechanical sweep to keep diff small for flip to _Prefixed.
</pre>
</div>
</content>
</entry>
</feed>
