Skip to content

Conversation

@sramasit
Copy link
Contributor

@sramasit sramasit commented May 15, 2025

Based on the following discussion:
https://llvm.discourse.group/t/declarative-assembly-format-requirement-for-type-presence/4399

Relax checks in OperationParser - it allows to skip value type specification, if the value was already defined in the same block.

Differential Revision: https://reviews.llvm.org/D111650

Summary

This PR ports several custom VPUX plugin changes from npu/release/19.x to npu/release/20.x to maintain consistency across both branches and enable smoother compiler integration with LLVM 20.x.
Some cherry-picked changes did not apply cleanly or introduced runtime/test failures due to differences in LLVM 20.x APIs and dialect behaviors. Fixes for these issues have been squashed into the corresponding commits, so certain commits in this PR may differ slightly from their original versions in npu/release/19.x.

JIRA ticket

Related PR in NPU Compiler and/or OpenVINO repository with sub-module update

Other related tickets

List tickets for additional work, eg, something was found during review but you agreed to address it in another Jira

  • E-xxxxx

@sramasit sramasit force-pushed the sramasit/20.x branch 5 times, most recently from c6d1bc0 to 1b1f99c Compare May 29, 2025 04:52
@sramasit sramasit force-pushed the sramasit/20.x branch 2 times, most recently from ee8aadd to ecbf209 Compare June 12, 2025 00:44
@sramasit sramasit force-pushed the sramasit/20.x branch 6 times, most recently from 783b49c to 9ef830b Compare June 27, 2025 22:52
@andrey-golubev
Copy link
Contributor

andrey-golubev commented Jun 30, 2025

I think you need to cherry-pick a couple more patches (see the current state of 19.x):

Copy link
Contributor

@ZoranZomborat ZoranZomborat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ported changes for Quant dialect seem fine

@sramasit sramasit force-pushed the sramasit/20.x branch 5 times, most recently from 2307dd8 to b3d3082 Compare July 15, 2025 06:24
@sramasit sramasit changed the title Port custom changes from 19.x to 20.x [EISW-165337] Port custom changes from 19.x to 20.x Jul 15, 2025
@sramasit sramasit changed the title [EISW-165337] Port custom changes from 19.x to 20.x [EISW-165337] Port and Adapt Custom VPUx Changes for LLVM 20.x Integration Jul 15, 2025
@andrey-golubev
Copy link
Contributor

On the patches,

  • Why do we need b3d3082 once again? I'd imagine that "standard" LLVM clang-format / pr-code-format should be enough. After all, this is a "fork" repository.
  • What is this needed for: 1ed9846? (Maybe I've missed the discussion) Also, as far as I see, this is a "revert" of 561395e -- which was also added by us?! -> Can we just delete these two commits completely then?
  • Could these three: a1793a8, 8a923ae, 13bf57c be moved to the tip of the HEAD? I don't see them in 19.x at all also.

Other than that, I don't see c7caf07 being ported but I think we've discussed this before with @ArtemySkrebkov and the consensus is that we don't need it.

DariaMityagina and others added 22 commits October 6, 2025 12:24
* Fix <anonymous> declared here

* Fix Ubuntu24 (intel#33)
* Expanding Quant dialect with Quantile Quantized type

* Adding quantile mlir tests

* Adding check on quantiles array size and updated mlir tests
Bumps [certifi](https://github.com/certifi/python-certifi) from 2024.6.2 to 2024.7.4.
- [Commits](certifi/python-certifi@2024.06.02...2024.07.04)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [cryptography](https://github.com/pyca/cryptography) from 42.0.4 to 43.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@42.0.4...43.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* relax negative scale conditions
* adapt tests now handling negative scales
* Adding missing check in QuantileQuantizedPerAxisType::verify
* Adding minor test for illegal quantile array size for per axis type
This reverses partially changed in commit 2c1ae80
Update pr-code-format.yml from llvm-project
* Bump cryptography from 43.0.1 to 44.0.1 in /llvm/utils/git

Bumps [cryptography](https://github.com/pyca/cryptography) from 43.0.1 to 44.0.1.
- [Changelog](https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst)
- [Commits](pyca/cryptography@43.0.1...44.0.1)

---
updated-dependencies:
- dependency-name: cryptography
  dependency-version: 44.0.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump tar-fs from 2.1.1 to 2.1.2 in /mlir/utils/vscode

Bumps [tar-fs](https://github.com/mafintosh/tar-fs) from 2.1.1 to 2.1.2.
- [Commits](mafintosh/tar-fs@v2.1.1...v2.1.2)

---
updated-dependencies:
- dependency-name: tar-fs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump tar-fs from 2.1.1 to 2.1.2 in /lldb/tools/lldb-dap

Bumps [tar-fs](https://github.com/mafintosh/tar-fs) from 2.1.1 to 2.1.2.
- [Commits](mafintosh/tar-fs@v2.1.1...v2.1.2)

---
updated-dependencies:
- dependency-name: tar-fs
  dependency-version: 2.1.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump jinja2 from 3.1.4 to 3.1.6 in /llvm/docs

Bumps [jinja2](https://github.com/pallets/jinja) from 3.1.4 to 3.1.6.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/main/CHANGES.rst)
- [Commits](pallets/jinja@3.1.4...3.1.6)

---
updated-dependencies:
- dependency-name: jinja2
  dependency-version: 3.1.6
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump llvm/utils/git/requirements.txt cryptography

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…and-line parser reset

When LLVM TableGen flags are globally appended, mlir-src-sharder fails with an unknown argument error because its command-line parser is reset during execution and does not retain the inherited flags.
…ck) (intel#142)

Add a new API to access all blobs that are stored in the blob manager.
The main purpose (as of now) is to allow users of dialect resources to
iterate over all blobs, especially when the blobs are no longer used in
IR (e.g. the operation that uses the blob is deleted) and thus cannot be
easily accessed without manual tracking of keys.
* Bump requests from 2.32.3 to 2.32.4 in /llvm/docs

Bumps [requests](https://github.com/psf/requests) from 2.32.3 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.3...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump requests from 2.32.2 to 2.32.4 in /llvm/utils/git

Bumps [requests](https://github.com/psf/requests) from 2.32.2 to 2.32.4.
- [Release notes](https://github.com/psf/requests/releases)
- [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md)
- [Commits](psf/requests@v2.32.2...v2.32.4)

---
updated-dependencies:
- dependency-name: requests
  dependency-version: 2.32.4
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* Bump brace-expansion from 2.0.1 to 2.0.2 in /mlir/utils/tree-sitter-mlir

Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 2.0.1 to 2.0.2.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](juliangruber/brace-expansion@v2.0.1...v2.0.2)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 2.0.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* Update README badges

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This is an implementation for [RFC: Supporting Sub-Channel Quantization
in
MLIR](https://discourse.llvm.org/t/rfc-supporting-sub-channel-quantization-in-mlir/82694).

In order to make the review process easier, the PR has been divided into
the following commit labels:

1. **Add implementation for sub-channel type:** Includes the class
design for `UniformQuantizedSubChannelType`, printer/parser and bytecode
read/write support. The existing types (per-tensor and per-axis) are
unaltered.
2. **Add implementation for sub-channel type:** Lowering of
`quant.qcast` and `quant.dcast` operations to Linalg operations.
3. **Adding C/Python Apis:** We first define he C-APIs and build the
Python-APIs on top of those.
4. **Add pass to normalize generic ....:** This pass normalizes
sub-channel quantized types to per-tensor per-axis types, if possible.

A  design note:
- **Explicitly storing the `quantized_dimensions`, even when they can be
derived for ranked tensor.**
While it's possible to infer quantized dimensions from the static shape
of the scales (or zero-points) tensor for ranked
data tensors
([ref](https://discourse.llvm.org/t/rfc-supporting-sub-channel-quantization-in-mlir/82694/3)
for background), there are cases where this can lead to ambiguity and
issues with round-tripping.

```
Consider the example: tensor<2x4x!quant.uniform<i8:f32:{0:2, 0:2}, {{s00:z00, s01:z01}}>>
```

The shape of the scales tensor is [1, 2], which might suggest that only
axis 1 is quantized. While this inference is technically correct, as the
block size for axis 0 is a degenerate case (equal to the dimension
size), it can cause problems with round-tripping. Therefore, even for
ranked tensors, we are explicitly storing the quantized dimensions.
Suggestions welcome!

PS: I understand that the upcoming holidays may impact your schedule, so
please take your time with the review. There's no rush.
sramasit and others added 3 commits October 6, 2025 12:49
This commit introduces several CMake options to conditionally enable or disable specific dialects and conversions.

This allows for a more modular build and helps resolve build failures in configurations where certain dialects are not needed or are causing issues.

Part-of: EISW-163563, EISW-170058, EISW-163564
mlir-tblgen fails to generate doc for IRDL because while parsing IRDL.td
it also finds the definition of the builtin dialect and cannot determine
what dialect to generate documentation for. This is because IRDL.td
includes IRDLOps.td which includes BuiltinAttributes.td which in turns
includes BuiltinDialect.td.
@sramasit sramasit merged commit 0ad3ee1 into intel:npu/release/20.x Oct 7, 2025
9 checks passed
@nikita-kud
Copy link
Contributor

The PR should not have been merged because we had not finished the discussion. I did not revert the PR, but dropped last commit: Fix APInt call

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.