<feed xmlns='http://www.w3.org/2005/Atom'>
<title>llvm-project.git/mlir/python, branch users/matthias-springer/fix_scf_for_parser</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] Python: Parse ModuleOp from file path (#126572)</title>
<updated>2025-02-12T22:02:41+00:00</updated>
<author>
<name>Nikhil Kalra</name>
<email>nkalra@apple.com</email>
</author>
<published>2025-02-12T22:02:41+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=65ed4fa57e6293f8e059a368ac52e2a57b1f78e4'/>
<id>65ed4fa57e6293f8e059a368ac52e2a57b1f78e4</id>
<content type='text'>
For extremely large models, it may be inefficient to load the model into
memory in Python prior to passing it to the MLIR C APIs for
deserialization. This change adds an API to parse a ModuleOp directly
from a file path.

Re-lands
[4e14b8a](https://github.com/llvm/llvm-project/commit/4e14b8afb44af58ab7073bb8c0b52875599b0ae1).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For extremely large models, it may be inefficient to load the model into
memory in Python prior to passing it to the MLIR C APIs for
deserialization. This change adds an API to parse a ModuleOp directly
from a file path.

Re-lands
[4e14b8a](https://github.com/llvm/llvm-project/commit/4e14b8afb44af58ab7073bb8c0b52875599b0ae1).</pre>
</div>
</content>
</entry>
<entry>
<title>[MLIR][Linalg] Expose linalg.matmul and linalg.contract via Python API (#126377)</title>
<updated>2025-02-10T12:05:13+00:00</updated>
<author>
<name>Rolf Morel</name>
<email>rolf.morel@intel.com</email>
</author>
<published>2025-02-10T12:05:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f796bc622a7725708b8ffbe0c7a684a8557e77a3'/>
<id>f796bc622a7725708b8ffbe0c7a684a8557e77a3</id>
<content type='text'>
Now that linalg.matmul is in tablegen, "hand write" the Python wrapper
that OpDSL used to derive. Similarly, add a Python wrapper for the new
linalg.contract op.

Required following misc. fixes:
1) make linalg.matmul's parsing and printing consistent w.r.t. whether
indexing_maps occurs before or after operands, i.e. per the tests cases
it comes _before_.
2) tablegen for linalg.contract did not state it accepted an optional
cast attr.
3) In ODS's C++-generating code, expand partial support for `$_builder`
access in `Attr::defaultValue` to full support. This enables access to
the current `MlirContext` when constructing the default value (as is
required when the default value consists of affine maps).</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Now that linalg.matmul is in tablegen, "hand write" the Python wrapper
that OpDSL used to derive. Similarly, add a Python wrapper for the new
linalg.contract op.

Required following misc. fixes:
1) make linalg.matmul's parsing and printing consistent w.r.t. whether
indexing_maps occurs before or after operands, i.e. per the tests cases
it comes _before_.
2) tablegen for linalg.contract did not state it accepted an optional
cast attr.
3) In ODS's C++-generating code, expand partial support for `$_builder`
access in `Attr::defaultValue` to full support. This enables access to
the current `MlirContext` when constructing the default value (as is
required when the default value consists of affine maps).</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "[mlir] Python: Parse ModuleOp from file path" (#126482)</title>
<updated>2025-02-10T08:09:58+00:00</updated>
<author>
<name>Mehdi Amini</name>
<email>joker.eph@gmail.com</email>
</author>
<published>2025-02-10T08:09:58+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=67b7a2590f39ad9ff5413adb9af162220972833e'/>
<id>67b7a2590f39ad9ff5413adb9af162220972833e</id>
<content type='text'>
Reverts llvm/llvm-project#125736

The gcc7 Bot is broken at the moment.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reverts llvm/llvm-project#125736

The gcc7 Bot is broken at the moment.</pre>
</div>
</content>
</entry>
<entry>
<title>[MLIR][Linalg] Introduce broadcast/transpose semantic to batch_matmul (#122275)</title>
<updated>2025-02-06T19:08:50+00:00</updated>
<author>
<name>Md Asghar Ahmad Shahid</name>
<email>md.asghar.ahmad.shahid@intel.com</email>
</author>
<published>2025-02-06T19:08:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f2bca9e3856bd070320473a016f706bf84a5dd5e'/>
<id>f2bca9e3856bd070320473a016f706bf84a5dd5e</id>
<content type='text'>
Goals:
1. To add syntax and semantic to 'batch_matmul' without changing any of
the existing syntax expectations for current usage. batch_matmul is
still just batch_matmul.

2. Move the definition of batch_matmul from linalg OpDsl to tablegen ODS
infra.

Scope of this patch:
To expose broadcast and transpose semantics on the 'batch_matmul'.

The broadcast and transpose semantic are as follows:

By default, 'linalg.batch_matmul' behavior will remain as is. Broadcast
and Transpose semantics can be applied by specifying the explicit
attribute 'indexing_maps' as shown below. This is a list attribute, so
the list must include all the maps if specified.

    Example Transpose:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d3, d1)&gt;, //transpose
                   affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d3, d2)&gt;,
                   affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d1, d2)&gt;
                   ]
ins (%arg0, %arg1: memref&lt;2x5x3xf32&gt;,memref&lt;2x5x7xf32&gt;)
                   outs (%arg2: memref&lt;2x3x7xf32&gt;)
    ```

    Example Broadcast:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map&lt; (d0, d1, d2, d3) -&gt; (d3)&gt;, //broadcast
                       affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d3, d2)&gt;,
                       affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d1, d2)&gt;
                     ]
                     ins (%arg0, %arg1: memref&lt;5xf32&gt;,memref&lt;2x5x7xf32&gt;)
                     outs (%arg2: memref&lt;2x3x7xf32&gt;)
    ```

    Example Broadcast and transpose:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map&lt; (d0, d1, d2, d3) -&gt; (d1, d3)&gt;, //broadcast
affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d2, d3)&gt;, //transpose
                       affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d1, d2)&gt;
                     ]
ins (%arg0, %arg1: memref&lt;3x5xf32&gt;, memref&lt;2x7x5xf32&gt;)
                     outs (%arg2: memref&lt;2x3x7xf32&gt;)
    ```

RFCs and related PR:

https://discourse.llvm.org/t/rfc-linalg-opdsl-constant-list-attribute-definition/80149
https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863
https://discourse.llvm.org/t/rfc-mlir-linalg-operation-tree/83586
https://github.com/llvm/llvm-project/pull/115319</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Goals:
1. To add syntax and semantic to 'batch_matmul' without changing any of
the existing syntax expectations for current usage. batch_matmul is
still just batch_matmul.

2. Move the definition of batch_matmul from linalg OpDsl to tablegen ODS
infra.

Scope of this patch:
To expose broadcast and transpose semantics on the 'batch_matmul'.

The broadcast and transpose semantic are as follows:

By default, 'linalg.batch_matmul' behavior will remain as is. Broadcast
and Transpose semantics can be applied by specifying the explicit
attribute 'indexing_maps' as shown below. This is a list attribute, so
the list must include all the maps if specified.

    Example Transpose:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d3, d1)&gt;, //transpose
                   affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d3, d2)&gt;,
                   affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d1, d2)&gt;
                   ]
ins (%arg0, %arg1: memref&lt;2x5x3xf32&gt;,memref&lt;2x5x7xf32&gt;)
                   outs (%arg2: memref&lt;2x3x7xf32&gt;)
    ```

    Example Broadcast:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map&lt; (d0, d1, d2, d3) -&gt; (d3)&gt;, //broadcast
                       affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d3, d2)&gt;,
                       affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d1, d2)&gt;
                     ]
                     ins (%arg0, %arg1: memref&lt;5xf32&gt;,memref&lt;2x5x7xf32&gt;)
                     outs (%arg2: memref&lt;2x3x7xf32&gt;)
    ```

    Example Broadcast and transpose:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map&lt; (d0, d1, d2, d3) -&gt; (d1, d3)&gt;, //broadcast
affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d2, d3)&gt;, //transpose
                       affine_map&lt; (d0, d1, d2, d3) -&gt; (d0, d1, d2)&gt;
                     ]
ins (%arg0, %arg1: memref&lt;3x5xf32&gt;, memref&lt;2x7x5xf32&gt;)
                     outs (%arg2: memref&lt;2x3x7xf32&gt;)
    ```

RFCs and related PR:

https://discourse.llvm.org/t/rfc-linalg-opdsl-constant-list-attribute-definition/80149
https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863
https://discourse.llvm.org/t/rfc-mlir-linalg-operation-tree/83586
https://github.com/llvm/llvm-project/pull/115319</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir] Python: Parse ModuleOp from file path (#125736)</title>
<updated>2025-02-05T19:48:37+00:00</updated>
<author>
<name>Nikhil Kalra</name>
<email>nkalra@apple.com</email>
</author>
<published>2025-02-05T19:48:37+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=4e14b8afb44af58ab7073bb8c0b52875599b0ae1'/>
<id>4e14b8afb44af58ab7073bb8c0b52875599b0ae1</id>
<content type='text'>
For extremely large models, it may be inefficient to load the model into
memory in Python prior to passing it to the MLIR C APIs for
deserialization. This change adds an API to parse a ModuleOp directly
from a file path.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
For extremely large models, it may be inefficient to load the model into
memory in Python prior to passing it to the MLIR C APIs for
deserialization. This change adds an API to parse a ModuleOp directly
from a file path.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir][python] implement GenericOp bindings (#124496)</title>
<updated>2025-01-28T17:02:26+00:00</updated>
<author>
<name>Maksim Levental</name>
<email>maksim.levental@gmail.com</email>
</author>
<published>2025-01-28T17:02:26+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=1bc5fe669f5477eadd84270e971591a718693bba'/>
<id>1bc5fe669f5477eadd84270e971591a718693bba</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir:python] Compute get_op_result_or_value in PyOpView's constructor. (#123953)</title>
<updated>2025-01-24T14:26:28+00:00</updated>
<author>
<name>Peter Hawkins</name>
<email>phawkins@google.com</email>
</author>
<published>2025-01-24T14:26:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=acde3f722ff3766f6f793884108d342b78623fe4'/>
<id>acde3f722ff3766f6f793884108d342b78623fe4</id>
<content type='text'>
This logic is in the critical path for constructing an operation from
Python. It is faster to compute this in C++ than it is in Python, and it
is a minor change to do this.

This change also alters the API contract of
_ods_common.get_op_results_or_values to avoid calling
get_op_result_or_value on each element of a sequence, since the C++ code
will now do this.

Most of the diff here is simply reordering the code in IRCore.cpp.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This logic is in the critical path for constructing an operation from
Python. It is faster to compute this in C++ than it is in Python, and it
is a minor change to do this.

This change also alters the API contract of
_ods_common.get_op_results_or_values to avoid calling
get_op_result_or_value on each element of a sequence, since the C++ code
will now do this.

Most of the diff here is simply reordering the code in IRCore.cpp.</pre>
</div>
</content>
</entry>
<entry>
<title>[mlir:python] Small optimization to get_op_result_or_results. (#123866)</title>
<updated>2025-01-22T13:41:31+00:00</updated>
<author>
<name>Peter Hawkins</name>
<email>phawkins@google.com</email>
</author>
<published>2025-01-22T13:41:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=ff0f1dd341cb2fdc1281a14413b3aa93bf9a20c7'/>
<id>ff0f1dd341cb2fdc1281a14413b3aa93bf9a20c7</id>
<content type='text'>
* We can call .results without figuring out whether we have an Operation
or an OpView, and that's likely the common case anyway.
* If we have one or more results, we can return them directly, with no
need for a call to get_op_result_or_value. We're guaranteed that
.results returns a PyOpResultList, so we have either an OpResult or
sequence of OpResults, just as the API expects.

This saves a few 100ms during IR construction in an LLM JAX benchmark.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* We can call .results without figuring out whether we have an Operation
or an OpView, and that's likely the common case anyway.
* If we have one or more results, we can return them directly, with no
need for a call to get_op_result_or_value. We're guaranteed that
.results returns a PyOpResultList, so we have either an OpResult or
sequence of OpResults, just as the API expects.

This saves a few 100ms during IR construction in an LLM JAX benchmark.</pre>
</div>
</content>
</entry>
<entry>
<title>Enabled freethreading support in MLIR python bindings (#122684)</title>
<updated>2025-01-13T11:00:31+00:00</updated>
<author>
<name>vfdev</name>
<email>vfdev.5@gmail.com</email>
</author>
<published>2025-01-13T11:00:31+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=f136c800b60dbfacdbb645e7e92acba52e2f279f'/>
<id>f136c800b60dbfacdbb645e7e92acba52e2f279f</id>
<content type='text'>
Reland reverted https://github.com/llvm/llvm-project/pull/107103 with
the fixes for Python 3.8

cc @jpienaar

Co-authored-by: Peter Hawkins &lt;phawkins@google.com&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Reland reverted https://github.com/llvm/llvm-project/pull/107103 with
the fixes for Python 3.8

cc @jpienaar

Co-authored-by: Peter Hawkins &lt;phawkins@google.com&gt;</pre>
</div>
</content>
</entry>
<entry>
<title>Revert "Added free-threading CPython mode support in MLIR Python bindings (#107103)"</title>
<updated>2025-01-12T18:30:42+00:00</updated>
<author>
<name>Jacques Pienaar</name>
<email>jpienaar@google.com</email>
</author>
<published>2025-01-12T18:30:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.belthelziquor.com/llvm-project.git/commit/?id=3f1486f08e0dd64136fb7f50e38cd618dd0255d2'/>
<id>3f1486f08e0dd64136fb7f50e38cd618dd0255d2</id>
<content type='text'>
Breaks on 3.8, rolling back to avoid breakage while fixing.

This reverts commit 9dee7c44491635ec9037b90050bcdbd3d5291e38.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Breaks on 3.8, rolling back to avoid breakage while fixing.

This reverts commit 9dee7c44491635ec9037b90050bcdbd3d5291e38.
</pre>
</div>
</content>
</entry>
</feed>
