<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/mlir/test/lib/Dialect/Test/TestDialectInterfaces.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][NFC] update `mlir/Dialect` create APIs (28/n) (#150641)</title>
<updated>2025-07-25T16:48:00+00:00</updated>
<author>
<name>Maksim Levental</name>
<email>maksim.levental@gmail.com</email>
</author>
<published>2025-07-25T16:48:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=258d04c810ab10f101324cbf1fe3c7be65eb1938'/>
<id>258d04c810ab10f101324cbf1fe3c7be65eb1938</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>[mlir] Allow trailing digit for alias in AsmPrinter (#127993)</title>
<updated>2025-03-06T16:35:00+00:00</updated>
<author>
<name>Hongren Zheng</name>
<email>i@zenithal.me</email>
</author>
<published>2025-03-06T16:35:00+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=5ae19fad3f1a73577cb8446b2b88eea5b3d0c8f0'/>
<id>5ae19fad3f1a73577cb8446b2b88eea5b3d0c8f0</id>
<content type='text'>
When generating aliases from `OpAsm{Dialect,Type,Attr}Interface`, the
result would be sanitized and if the alias provided by the interface has
a trailing digit, AsmPrinter would attach an underscore to it to
presumably prevent confliction.

#### Motivation

There are two reasons to motivate the change from the old behavior to
the proposed behavior

1. If the type/attribute can generate unique alias from its content,
then the extra trailing underscore added by AsmPrinter will be strange

```mlir
  func.func @add(%ct: !ct_L0_) -&gt; !ct_L0_
    %ct_0 = bgv.add %ct, %ct : (!ct_L0_, !ct_L0_) -&gt; !ct_L0_
    %ct_1 = bgv.add %ct_0, %ct_0 : (!ct_L0_, !ct_L0_) -&gt; !ct_L0_
    %ct_2 = bgv.add %ct_1, %ct_1 : (!ct_L0_, !ct_L0_) -&gt; !ct_L0_
    return %ct_2 : !ct_L0_
  }
```

Which aesthetically would be better if we have `(!ct_L0, !ct_L0) -&gt;
!ct_L0`

2. The Value name behavior is that, for the first instance, use no
suffix `_N`, which can be similarly applied to alias name. See the IR
above where the first one is called `%ct` and others are called `%ct_N`.
See `uniqueValueName` for detail.

#### Conflict detection


```mlir
!test.type&lt;a = 3&gt; // suggest !name0
!test.type&lt;a = 4&gt; // suggest !name0
!test.another&lt;b = 3&gt; // suggest !name0_
!test.another&lt;b = 4&gt; // suggest !name0_
```

The conflict detection is based on `nameCounts` in `initializeAliases`,
where

In the original way, the first two will get sanitized to `!name0_` and
`initializeAlias` can assign unique id `0, 1, 2, 3` to them.

In the current way, the `initializeAlias` uses `usedAliases` to track
which name has been used, and use such information to generate a suffix
id that will make the printed alias name unique.

The result for the above example is `!name0, !name0_1, !name0_,
!name0_2` now.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When generating aliases from `OpAsm{Dialect,Type,Attr}Interface`, the
result would be sanitized and if the alias provided by the interface has
a trailing digit, AsmPrinter would attach an underscore to it to
presumably prevent confliction.

#### Motivation

There are two reasons to motivate the change from the old behavior to
the proposed behavior

1. If the type/attribute can generate unique alias from its content,
then the extra trailing underscore added by AsmPrinter will be strange

```mlir
  func.func @add(%ct: !ct_L0_) -&gt; !ct_L0_
    %ct_0 = bgv.add %ct, %ct : (!ct_L0_, !ct_L0_) -&gt; !ct_L0_
    %ct_1 = bgv.add %ct_0, %ct_0 : (!ct_L0_, !ct_L0_) -&gt; !ct_L0_
    %ct_2 = bgv.add %ct_1, %ct_1 : (!ct_L0_, !ct_L0_) -&gt; !ct_L0_
    return %ct_2 : !ct_L0_
  }
```

Which aesthetically would be better if we have `(!ct_L0, !ct_L0) -&gt;
!ct_L0`

2. The Value name behavior is that, for the first instance, use no
suffix `_N`, which can be similarly applied to alias name. See the IR
above where the first one is called `%ct` and others are called `%ct_N`.
See `uniqueValueName` for detail.

#### Conflict detection


```mlir
!test.type&lt;a = 3&gt; // suggest !name0
!test.type&lt;a = 4&gt; // suggest !name0
!test.another&lt;b = 3&gt; // suggest !name0_
!test.another&lt;b = 4&gt; // suggest !name0_
```

The conflict detection is based on `nameCounts` in `initializeAliases`,
where

In the original way, the first two will get sanitized to `!name0_` and
`initializeAlias` can assign unique id `0, 1, 2, 3` to them.

In the current way, the `initializeAlias` uses `usedAliases` to track
which name has been used, and use such information to generate a suffix
id that will make the printed alias name unique.

The result for the above example is `!name0, !name0_1, !name0_,
!name0_2` now.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Sanitize identifiers with leading symbol. (#94795)</title>
<updated>2024-06-11T00:12:34+00:00</updated>
<author>
<name>Will Dietz</name>
<email>will.dietz@sifive.com</email>
</author>
<published>2024-06-11T00:12:34+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=46e41c8631bd6c1a6c91d6cc4a5e4f1671078ccd'/>
<id>46e41c8631bd6c1a6c91d6cc4a5e4f1671078ccd</id>
<content type='text'>
Presently, if name starts with a symbol it's converted to hex which may
cause the result to be invalid by starting with a digit.

Address this and add a small test.

Co-authored-by: Will Dietz &lt;w@wdtz.org&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Presently, if name starts with a symbol it's converted to hex which may
cause the result to be invalid by starting with a digit.

Address this and add a small test.

Co-authored-by: Will Dietz &lt;w@wdtz.org&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][test] Reorganize the test dialect (#89424)</title>
<updated>2024-04-22T20:42:05+00:00</updated>
<author>
<name>Jeff Niu</name>
<email>jeff@modular.com</email>
</author>
<published>2024-04-22T20:42:05+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=e95e94adc6bb748de015ac3053e7f0786b65f351'/>
<id>e95e94adc6bb748de015ac3053e7f0786b65f351</id>
<content type='text'>
This PR massively reorganizes the Test dialect's source files. It moves
manually-written op hooks into `TestOpDefs.cpp`, moves format custom
directive parsers and printers into `TestFormatUtils`, adds missing
comment blocks, and moves around where generated source files are
included for types, attributes, enums, etc. into their own source file.

This will hopefully help navigate the test dialect source code, but also
speeds up compile time of the test dialect by putting generated source
files into separate compilation units.

This also sets up the test dialect to shard its op definitions, done in
the next PR.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This PR massively reorganizes the Test dialect's source files. It moves
manually-written op hooks into `TestOpDefs.cpp`, moves format custom
directive parsers and printers into `TestFormatUtils`, adds missing
comment blocks, and moves around where generated source files are
included for types, attributes, enums, etc. into their own source file.

This will hopefully help navigate the test dialect source code, but also
speeds up compile time of the test dialect by putting generated source
files into separate compilation units.

This also sets up the test dialect to shard its op definitions, done in
the next PR.</pre>
</div>
</content>
</entry>
<entry>
<title>Apply clang-tidy fixes for llvm-namespace-comment in TestDialectInterfaces.cpp (NFC)</title>
<updated>2024-02-17T22:05:03+00:00</updated>
<author>
<name>Mehdi Amini</name>
<email>joker.eph@gmail.com</email>
</author>
<published>2023-10-20T19:30:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=a6df3472feeb618513877ec136db38f4746142fb'/>
<id>a6df3472feeb618513877ec136db38f4746142fb</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Make MLIR Value more consistent in terms of `const` "correctness" (NFC) (#72765)</title>
<updated>2023-11-21T04:52:15+00:00</updated>
<author>
<name>Mehdi Amini</name>
<email>joker.eph@gmail.com</email>
</author>
<published>2023-11-21T04:52:15+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=26a0b277369adc31b162b1cc38b1a712bc10c1a0'/>
<id>26a0b277369adc31b162b1cc38b1a712bc10c1a0</id>
<content type='text'>
MLIR can't really be const-correct (it would need a `ConstValue` class
alongside the `Value` class really, like `ArrayRef` and
`MutableArrayRef`). This is however making is more consistent: method
that are directly modifying the Value shouldn't be marked const.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
MLIR can't really be const-correct (it would need a `ConstValue` class
alongside the `Value` class really, like `ArrayRef` and
`MutableArrayRef`). This is however making is more consistent: method
that are directly modifying the Value shouldn't be marked const.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][bytecode] Implements back deployment capability for MLIR dialects (#70724)</title>
<updated>2023-10-31T22:41:29+00:00</updated>
<author>
<name>Matteo Franciolini</name>
<email>m_franciolini@apple.com</email>
</author>
<published>2023-10-31T22:41:29+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=7ad9e9dcf518431a8ecedcc06b09df6c799658ef'/>
<id>7ad9e9dcf518431a8ecedcc06b09df6c799658ef</id>
<content type='text'>
When emitting bytecode, clients can specify a target dialect version to
emit in `BytecodeWriterConfig`. This exposes a target dialect version to
the DialectBytecodeWriter, which can be queried by name and used to
back-deploy attributes, types, and properties.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
When emitting bytecode, clients can specify a target dialect version to
emit in `BytecodeWriterConfig`. This exposes a target dialect version to
the DialectBytecodeWriter, which can be queried by name and used to
back-deploy attributes, types, and properties.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Fix infinite recursion in alias initializer</title>
<updated>2023-08-27T15:31:35+00:00</updated>
<author>
<name>Markus Böck</name>
<email>markus.boeck02@gmail.com</email>
</author>
<published>2023-08-26T14:10:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=de3f7e2f0fb4363c17eec73ce79ca30e221ea844'/>
<id>de3f7e2f0fb4363c17eec73ce79ca30e221ea844</id>
<content type='text'>
The alias initializer keeps a list of child indices around. When an alias is then marked as non-deferrable, all children are also marked non-deferrable.

This is currently done naively which leads to an infinite recursion if using mutable types or attributes containing a cycle.

This patch fixes this by adding an early return if the alias is already marked non-deferrable. Since this function is the only way to mark an alias as non-deferrable, it is guaranteed that if it is marked non-deferrable, all its children are as well, and it is not required to walk all the children.
This incidentally makes the non-deferrable marking also `O(n)` instead of `O(n^2)` (although not performance sensitive obviously).

Differential Revision: https://reviews.llvm.org/D158932
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The alias initializer keeps a list of child indices around. When an alias is then marked as non-deferrable, all children are also marked non-deferrable.

This is currently done naively which leads to an infinite recursion if using mutable types or attributes containing a cycle.

This patch fixes this by adding an early return if the alias is already marked non-deferrable. Since this function is the only way to mark an alias as non-deferrable, it is guaranteed that if it is marked non-deferrable, all its children are as well, and it is not required to walk all the children.
This incidentally makes the non-deferrable marking also `O(n)` instead of `O(n^2)` (although not performance sensitive obviously).

Differential Revision: https://reviews.llvm.org/D158932
</pre>
</div>
</content>
</entry>
<entry>
<title>[NFCI][mlir][Tests] Rename identifiers minor/major to avoid clashes with system headers</title>
<updated>2023-07-31T14:36:35+00:00</updated>
<author>
<name>Roger Ferrer Ibanez</name>
<email>roger.ferrer@bsc.es</email>
</author>
<published>2023-07-31T14:33:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=896aada3b632bd58297acc3745d61fc24904f34e'/>
<id>896aada3b632bd58297acc3745d61fc24904f34e</id>
<content type='text'>
Identifiers major and minor are often already taken in POSIX systems due
to their presence in &lt;sys/types.h&gt; as part of the makedev library
function.

This causes compilation failures on FreeBSD and Linux systems with glibc
&lt;2.28.

This change renames the identifiers to major_/minor_.

Differential Revision: https://reviews.llvm.org/D156683
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Identifiers major and minor are often already taken in POSIX systems due
to their presence in &lt;sys/types.h&gt; as part of the makedev library
function.

This causes compilation failures on FreeBSD and Linux systems with glibc
&lt;2.28.

This change renames the identifiers to major_/minor_.

Differential Revision: https://reviews.llvm.org/D156683
</pre>
</div>
</content>
</entry>
<entry>
<title>Add support for versioning properties in MLIR bytecode</title>
<updated>2023-07-29T02:44:33+00:00</updated>
<author>
<name>Matteo Franciolini</name>
<email>m_franciolini@apple.com</email>
</author>
<published>2023-07-28T19:47:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=cf0e8dca8496660fc18a8bbbb4da765027f2080d'/>
<id>cf0e8dca8496660fc18a8bbbb4da765027f2080d</id>
<content type='text'>
[mlir] Add support for custom readProperties/writeProperties methods.

Currently, operations that opt-in to adopt properties will see auto-generated readProperties/writeProperties methods to emit and parse bytecode. If a dialects opts in to use `usePropertiesForAttributes`, those definitions will be generated for the current definition of the op without the possibility to handle attribute versioning.

The patch adds the capability for an operation to define its own read/write methods for the encoding of properties so that versioned operations can handle upgrading properties encodings.

In addition to this, the patch adds an example showing versioning on NamedProperties through the dialect version API exposed by the reader.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D155340
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
[mlir] Add support for custom readProperties/writeProperties methods.

Currently, operations that opt-in to adopt properties will see auto-generated readProperties/writeProperties methods to emit and parse bytecode. If a dialects opts in to use `usePropertiesForAttributes`, those definitions will be generated for the current definition of the op without the possibility to handle attribute versioning.

The patch adds the capability for an operation to define its own read/write methods for the encoding of properties so that versioned operations can handle upgrading properties encodings.

In addition to this, the patch adds an example showing versioning on NamedProperties through the dialect version API exposed by the reader.

Reviewed By: mehdi_amini

Differential Revision: https://reviews.llvm.org/D155340
</pre>
</div>
</content>
</entry>
</feed>
