-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[NFC][MLIR][TableGen] Drop namespace around static Op constraint functions #162120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Op constraints are emitted as uniqued static standalone funtions and need not be surrounded by the Op's C++ namespace.
59df1df to
ed233e1
Compare
|
@llvm/pr-subscribers-mlir @llvm/pr-subscribers-mlir-gpu Author: Rahul Joshi (jurahul) ChangesOp constraints are emitted as uniqued static standalone funtions and need not be surrounded by the Op's C++ namespace. Full diff: https://github.com/llvm/llvm-project/pull/162120.diff 4 Files Affected:
diff --git a/mlir/include/mlir/TableGen/CodeGenHelpers.h b/mlir/include/mlir/TableGen/CodeGenHelpers.h
index 252da21419b6e..997aef26bdc01 100644
--- a/mlir/include/mlir/TableGen/CodeGenHelpers.h
+++ b/mlir/include/mlir/TableGen/CodeGenHelpers.h
@@ -88,7 +88,7 @@ class StaticVerifierFunctionEmitter {
///
/// Constraints that do not meet the restriction that they can only reference
/// `$_self` and `$_op` are not uniqued.
- void emitOpConstraints(ArrayRef<const llvm::Record *> opDefs);
+ void emitOpConstraints();
/// Unique all compatible type and attribute constraints from a pattern file
/// and emit them at the top of the generated file.
diff --git a/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp b/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
index 81b5788d0b9b4..e0a8ac40648e0 100644
--- a/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
+++ b/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
@@ -20,8 +20,8 @@
#define DEBUG_TYPE "xegpu"
-namespace mlir {
-namespace xegpu {
+using namespace mlir;
+using namespace mlir::xegpu;
static bool isSharedMemory(const MemRefType &memrefTy) {
Attribute attr = memrefTy.getMemorySpace();
@@ -1133,9 +1133,6 @@ LogicalResult MemDescSubviewOp::verify() {
return success();
}
-} // namespace xegpu
-} // namespace mlir
-
namespace mlir {
#include <mlir/Dialect/XeGPU/IR/XeGPUAttrInterface.cpp.inc>
} // namespace mlir
diff --git a/mlir/lib/TableGen/CodeGenHelpers.cpp b/mlir/lib/TableGen/CodeGenHelpers.cpp
index cb90ef82c1c39..d52d5e769ee6d 100644
--- a/mlir/lib/TableGen/CodeGenHelpers.cpp
+++ b/mlir/lib/TableGen/CodeGenHelpers.cpp
@@ -49,9 +49,7 @@ StaticVerifierFunctionEmitter::StaticVerifierFunctionEmitter(
raw_ostream &os, const RecordKeeper &records, StringRef tag)
: os(os), uniqueOutputLabel(getUniqueOutputLabel(records, tag)) {}
-void StaticVerifierFunctionEmitter::emitOpConstraints(
- ArrayRef<const Record *> opDefs) {
- NamespaceEmitter namespaceEmitter(os, Operator(*opDefs[0]).getCppNamespace());
+void StaticVerifierFunctionEmitter::emitOpConstraints() {
emitTypeConstraints();
emitAttrConstraints();
emitPropConstraints();
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 2ddb07de48a76..f6cfe74729be0 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -4871,7 +4871,7 @@ static void emitOpClassDefs(const RecordKeeper &records,
constraintPrefix);
os << formatv(opCommentHeader, "Local Utility Method", "Definitions");
staticVerifierEmitter.collectOpConstraints(defs);
- staticVerifierEmitter.emitOpConstraints(defs);
+ staticVerifierEmitter.emitOpConstraints();
// Emit the classes.
emitOpClasses(records, defs, os, staticVerifierEmitter,
|
|
@llvm/pr-subscribers-mlir-core Author: Rahul Joshi (jurahul) ChangesOp constraints are emitted as uniqued static standalone funtions and need not be surrounded by the Op's C++ namespace. Full diff: https://github.com/llvm/llvm-project/pull/162120.diff 4 Files Affected:
diff --git a/mlir/include/mlir/TableGen/CodeGenHelpers.h b/mlir/include/mlir/TableGen/CodeGenHelpers.h
index 252da21419b6e..997aef26bdc01 100644
--- a/mlir/include/mlir/TableGen/CodeGenHelpers.h
+++ b/mlir/include/mlir/TableGen/CodeGenHelpers.h
@@ -88,7 +88,7 @@ class StaticVerifierFunctionEmitter {
///
/// Constraints that do not meet the restriction that they can only reference
/// `$_self` and `$_op` are not uniqued.
- void emitOpConstraints(ArrayRef<const llvm::Record *> opDefs);
+ void emitOpConstraints();
/// Unique all compatible type and attribute constraints from a pattern file
/// and emit them at the top of the generated file.
diff --git a/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp b/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
index 81b5788d0b9b4..e0a8ac40648e0 100644
--- a/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
+++ b/mlir/lib/Dialect/XeGPU/IR/XeGPUOps.cpp
@@ -20,8 +20,8 @@
#define DEBUG_TYPE "xegpu"
-namespace mlir {
-namespace xegpu {
+using namespace mlir;
+using namespace mlir::xegpu;
static bool isSharedMemory(const MemRefType &memrefTy) {
Attribute attr = memrefTy.getMemorySpace();
@@ -1133,9 +1133,6 @@ LogicalResult MemDescSubviewOp::verify() {
return success();
}
-} // namespace xegpu
-} // namespace mlir
-
namespace mlir {
#include <mlir/Dialect/XeGPU/IR/XeGPUAttrInterface.cpp.inc>
} // namespace mlir
diff --git a/mlir/lib/TableGen/CodeGenHelpers.cpp b/mlir/lib/TableGen/CodeGenHelpers.cpp
index cb90ef82c1c39..d52d5e769ee6d 100644
--- a/mlir/lib/TableGen/CodeGenHelpers.cpp
+++ b/mlir/lib/TableGen/CodeGenHelpers.cpp
@@ -49,9 +49,7 @@ StaticVerifierFunctionEmitter::StaticVerifierFunctionEmitter(
raw_ostream &os, const RecordKeeper &records, StringRef tag)
: os(os), uniqueOutputLabel(getUniqueOutputLabel(records, tag)) {}
-void StaticVerifierFunctionEmitter::emitOpConstraints(
- ArrayRef<const Record *> opDefs) {
- NamespaceEmitter namespaceEmitter(os, Operator(*opDefs[0]).getCppNamespace());
+void StaticVerifierFunctionEmitter::emitOpConstraints() {
emitTypeConstraints();
emitAttrConstraints();
emitPropConstraints();
diff --git a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
index 2ddb07de48a76..f6cfe74729be0 100644
--- a/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpDefinitionsGen.cpp
@@ -4871,7 +4871,7 @@ static void emitOpClassDefs(const RecordKeeper &records,
constraintPrefix);
os << formatv(opCommentHeader, "Local Utility Method", "Definitions");
staticVerifierEmitter.collectOpConstraints(defs);
- staticVerifierEmitter.emitOpConstraints(defs);
+ staticVerifierEmitter.emitOpConstraints();
// Emit the classes.
emitOpClasses(records, defs, os, staticVerifierEmitter,
|
|
To clarify what this does, currently This code is generated by |
|
The new code is: |
joker-eph
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems fine, even though I'm not sure I understand all the implications. We can land and follow-up on any potential fallout.
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820713725
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820836649
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820836649
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820836649
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820836649
…ons, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. PiperOrigin-RevId: 820836649
|
For the record, this did cause a bit of an integration headache for StableHLO since we don't allow |
Imported from GitHub PR google-ai-edge/LiteRT#4268 Copybara import of the project: -- aa6b7593f695f7f7886822c52b3a23354ec5ad90 by Majid Dadashi <[email protected]>: Add a pattern to push DRQ FQ forward through pad This CL adds a new rewrite pattern, PushForwardDrqFQ, to push a DRQ fake quant op forward through a pad op. This pattern transforms the graph from: drq_fake_quant(input) -> pad -> consumer to: input -> pad -> drq_fake_quant -> consumer This enables the DRQ fake quant op to be fused with its consuming op (e.g., a convolution), leading to a more efficient quantized model. LiteRT-Converter-PiperOrigin-RevId: 798286947 -- d62008b0a4cc981060dbee12371c8ae216d7ce12 by Majid Dadashi <[email protected]>: Fuse L2 normalization patterns using Mul and a keep_dims Reshape. This adds new patterns to the TFLite converter to fuse more forms of L2 normalization. These patterns handle models where L2 normalization is constructed using operations that are functionally equivalent to the standard form but use different ops. The new patterns fuse subgraphs that: Use Mul(x, x) instead of Square(x). Use a Reshape op to add a trailing dimension of size 1 after the Sum reduction, which emulates the keep_dims=true behavior. A new C++ helper IsL2NormalizationKeepDimsReshape is added to check for this specific case. Include an Add or Maximum op with a small constant for numerical stability. New tests are added to verify these fusion patterns work correctly. LiteRT-Converter-PiperOrigin-RevId: 798338534 -- ee88539b38f354dcfeb88e6de972ea612509eb14 by Majid Dadashi <[email protected]>: Allow propagation of per-tensor quantization parameters across tfl.broadcast_to. This enables the prepare-quantize pass to move Quantize/Dequantize operations (QDQs) through broadcast ops. This is valid for per-tensor quantization as broadcasting doesn't change the range of tensor values. A test case is added to verify the propagation. LiteRT-Converter-PiperOrigin-RevId: 798375402 -- 84e5f19693e77300e2d747453f37dece8a5d2f00 by Tommy Chiang <[email protected]>: Update flatbuffers to 25.2.10 No longer need to specify version by git commit. Use normal release version. LiteRT-Converter-PiperOrigin-RevId: 799253783 -- d07f930ead5ad41d383b8c59cedcd42d3d92b9d5 by Robert David <[email protected]>: Add constant folding for `tfl.ceil` on `f32` tensors. Code and tests are copied from `tfl.floor`, replacing `std::floor` with `std::ceil` in the code. LiteRT-Converter-PiperOrigin-RevId: 799784759 -- da44d499f5b965d80e67d03527de000dd95f2472 by Google AI Edge <[email protected]>: Grant tf_tfl_translate visibility to fix oss build error, as litert/build_common/tf_model_gen.bzl requires it LiteRT-Converter-PiperOrigin-RevId: 802191710 -- e00067573d56b6b6279ecc34b4567aa3d0371e82 by Majid Dadashi <[email protected]>: Relax the tflite folding size constraints This is to unblock some foldings that are expected but not happening at the moment. A potential longer term improvement would be to make these thresholds configurable. LiteRT-Converter-PiperOrigin-RevId: 802238463 -- 27219aa5e43eb15dba439d920a715e465010d32c by Weiyi Wang <[email protected]>: No public description LiteRT-Converter-PiperOrigin-RevId: 802279248 -- aa4c391cb7cb274568a910f97fd3def2c0c2c073 by Majid Dadashi <[email protected]>: Expand TFL FullyConnected constant folding to support batched inputs. The constant folding logic for `tfl.fully_connected` is updated to handle inputs with a batch dimension. Previously, only 1D inputs were fully supported. LiteRT-Converter-PiperOrigin-RevId: 804503563 -- 3141cead2543178594cb7a5fc767f50ae97247b5 by Kevin Chen <[email protected]>: Use add output type for fallback bias type in FuseFullyConnectedAndAdd Previously, the filter element type was used as the fallback type if the bias is of NoneType. If the filter type does not match the add type, this can lead to an unbroadcastable type for `new_bias` and downstream segfaults from empty/invalid types. Instead, let's just use the add output type. LiteRT-Converter-PiperOrigin-RevId: 804550625 -- e2d2ce3fbbc578b37ace8ef498564d9c46afd534 by Jun Jiang <[email protected]>: Relax tfl.div op check to allow 6d broadcastable inputs. LiteRT-Converter-PiperOrigin-RevId: 804657332 -- deaa95baf6b540c39ecf4d220c5623bbf91b16ce by Jun Jiang <[email protected]>: Relax tfl.slice and strided_slice op check to allow 6D inputs. LiteRT-Converter-PiperOrigin-RevId: 805891454 -- a20478938617dfdf94db51d20b522b6bc7383a12 by Majid Dadashi <[email protected]>: Add a FuseQDQPass to the TFLite quantization pipeline. This pass is designed to fuse dequantize and quantize operations into their surrounding ops, effectively creating quantized versions of those ops. The pass includes several rewrite patterns to handle different scenarios: - FuseQDQ: The primary pattern for fusing QDQ chains. - PushForwardDrqFQ: Pushes dynamic-range fake-quant ops through padding ops to increase fusion opportunities. - RemoveUnusedFQ: Cleans up unused fake-quant ops. - QuantizeConstPattern: Folds quantize ops on constants into QConstOps. - Patterns for requantization (FuseDqQToRequant, FuseQQToRequant). The pass can distinguish between static-range, dynamic-range, and weight-only quantization to apply the correct fusion logic. New tests have been added to verify the pass's behavior in these different scenarios. LiteRT-Converter-PiperOrigin-RevId: 806457443 -- 3eca5097562b850d4bd80a6e0667f3a4454fcc6e by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 806588730 -- 5802252c9a931a6a6bd1ba7aa07f97b09d4998cf by Google AI Edge <[email protected]>: Check if the operands are constant foldable before fusing `tfl.add` into `tfl.fully_connected` The `FuseAddAndFullyConnected` optimization pattern fuses an `add` operation into the bias of a subsequent `fully_connected`. This change adds checks to ensure this fusion only happens if the `add`'s right-hand side, and the `fully_connected`'s filter and bias are constant. This prevents issues where the fused bias would not be a single constant vector, for example, when the filter comes from a dequantize operation. LiteRT-Converter-PiperOrigin-RevId: 807067198 -- e9f2b6b7c9142c1a6b4293225e55f5aaba305da9 by Maria Lyubimtseva <[email protected]>: Add int16x8 kernel support for equal and not_equal ops LiteRT-Converter-PiperOrigin-RevId: 807869896 -- b63dc7d7dfaff2ba66772c978ece76fcb84f3868 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808040499 -- 972dd8883dc4d959907280e290239938d325f728 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808402450 -- 77841e191460749571b30ee60a7194ffb3d95b99 by Google AI Edge <[email protected]>: Integrate LLVM at llvm/llvm-project@f3b712f6e4e9 Updates LLVM usage to match [f3b712f6e4e9](llvm/llvm-project@f3b712f6e4e9) LiteRT-Converter-PiperOrigin-RevId: 808676531 -- 2dda700c6badafd89c286cc2c2d6315b867145c4 by Byungchul Kim <[email protected]>: Add an option for mmap allocation with MAP_PRIVATE & PROT_WRITE LiteRT-Converter-PiperOrigin-RevId: 809264177 -- c1f9b7b50ec207d2fc91ab98baab86af58925094 by Majid Dadashi <[email protected]>: Update LowerQuantAnnotationsPass to use greedy rewriter In addition, the rewrite pattern responsible for rewriting the fake quant composite now explicitly replaces the fake quant composite op instead of relying on the driver to kill the trivially dead op after all its uses replaced. LiteRT-Converter-PiperOrigin-RevId: 809268429 -- e8df160ab992becb94c0ab3370ec3af634db20e0 by Jing Pu <[email protected]>: Disable MHLO->TF ConvOp Pattern for Int8 input/parameter because the data type is not supported by TF ConvOp. LiteRT-Converter-PiperOrigin-RevId: 810183072 -- 3230fb9d66754a160ebbefb37690c7a3f3114951 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810299873 -- 943940b7f2b16aa2f5b6e54c410d702cd56a3df7 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810340288 -- 3655db1799458130d1370150514d0a1a6c7e0990 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810523749 -- 5e6cbff4e8ca078642edd9f7575352519477da72 by Renjie Wu <[email protected]>: Add support for kTfLiteInt4 output in the Quantize kernel. LiteRT-Converter-PiperOrigin-RevId: 811592774 -- 392a7a7a7db2a97edefbf123475bd6b7f1286793 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 811606924 -- ba03b95ab45377bd3774c54e8d01f534743308e3 by Elen Kalda <[email protected]>: PR #94375: [mlir][tflite][tosa] Disable TFL GatherOp folding for quantized tensors Imported from GitHub PR #94375 --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Copybara import of the project: -- 5c8c23b by Elen Kalda <[email protected]>: [tflite][tosa] Disable TFL GatherOp folding for quantized tensors --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Signed-off-by: Elen Kalda <[email protected]> Merging this change closes #94375 LiteRT-Converter-PiperOrigin-RevId: 812780818 -- d3a22594dce4c5b60845cf02adebd8e8aa724108 by Fergus Henderson <[email protected]>: Update from flatbuffers 25.2.10 to 25.9.23. LiteRT-Converter-PiperOrigin-RevId: 813955553 -- a70c348f4e6b05692a9e4c08e8069b4bf5986637 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 814093030 -- df6cf337d18e22fa509192cf76db07366bc70186 by Fergus Henderson <[email protected]>: Update flatbuffer_compatibility_test to test compatibility of the current schema with schema_v3c.fbs rather than compatibility with schema_v3b.fbs. Since v3c is compatible with v3b, compatibility of the current schema with v3c implies compatibility of the current schema with v3b, so this makes the test strictly more stringent than before. LiteRT-Converter-PiperOrigin-RevId: 814628352 -- 74c2e3e8c414b5e27b65bc34cec0a305b5ad30e0 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 816064324 -- 371e9020b939c2a144b351b420dd31920f956d58 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 817008734 -- 53d2e7c6ee4cd05bfa49c7f5e9b623e030e0ebed by Jacques Pienaar <[email protected]>: Convert to nanobind. This just converts but doesn't rename to enable cleaner diff. LiteRT-Converter-PiperOrigin-RevId: 819018201 -- ded4426f89e84e697dc8f51a4c46ef5323f6c5b1 by Google AI Edge <[email protected]>: Use `size_t` for byte and element counts Changes `bytes_len` and `elem_count` to `size_t` to match the return type of `bytes.size()` and handle potentially large sizes correctly. LiteRT-Converter-PiperOrigin-RevId: 819560782 -- d82a85781b58e0ed2daff36051c890a89d030720 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 type export/import. This change introduces a new `kTfLiteInt2` type to the TFLite schema and MLIR converter. It includes: - Adding `INT2` to the flatbuffer schema. - Mapping `TensorType_INT2` to `kTfLiteInt2` in flatbuffer conversions. - Updating `tflite_types.h` to include `kTfLiteInt2`. - Modifying `flatbuffer_export.cc` to handle 2-bit integer types from MLIR and pack them densely. - Generalizing low-bit utility functions (`PackLowBitValuesDensely`, `UnpackDenseLowBitIntoInt8`) to support both 2-bit and 4-bit values. - Updating type conversion utilities to recognize and handle `kTfLiteInt2`. - Adjusting `util.cc` to correctly report the size and byte requirements for `kTfLiteInt2` tensors, considering their dense packing. LiteRT-Converter-PiperOrigin-RevId: 819821231 -- 8697dbfcb936c53b9aff90b91c5a890863a4acbc by Majid Dadashi <[email protected]>: Add support for int2/int4 in tfl.cast LiteRT-Converter-PiperOrigin-RevId: 820509011 -- 418477d6867402630d796c854a110ca2198605c2 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820517563 -- 2d5f2c0b10262f8eefe6104ece0afa6b1e2e2442 by Majid Dadashi <[email protected]>: Enable lowering from FQ Composite for 2-bit This also adds an additional test for this lowering. LiteRT-Converter-PiperOrigin-RevId: 8205343 -- 6099208a47743ccc876d8bc8ea6a272302569cc1 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820551714 -- 9b29462eea7f0b086e74e6fdc4667dd1a6b2a2ef by Google AI Edge <[email protected]>: llvm/llvm-project#162120 removed some automatic namespace determinations, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820836649 -- af063fa1db9e8e5e240e48d8254f8a98fe47b9ec by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 821973007 -- d13d4bffcc6288d79721e84692bad81da9b57ea7 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 to Dequantize kernels. This change enables the Dequantize and PerChannelDequantize operations to handle 2-bit integer inputs (`kTfLiteInt2`). It includes logic to unpack the packed 2-bit integers into int8_t before performing the dequantization and adds new test cases for both per-tensor and per-channel dequantization with kTfLiteInt2. LiteRT-Converter-PiperOrigin-RevId: 822207279 -- 8afe70b8f6ea724146cadc0e780a7e0f52e0a586 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 (srq) in tfl.fully_connected. LiteRT-Converter-PiperOrigin-RevId: 822405584 -- 433f8603fbc8045908cb258a8ad4eeb376cc8a39 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 822874462 -- 22caf805854b2ab70b83435e8310ec44f302ae2e by Google AI Edge <[email protected]>: Add TensorTypeGetSize to schema_utils. LiteRT-Converter-PiperOrigin-RevId: 824743105 -- f2fe03ebf716bf2bf32e1b6ba6385ae29339e771 by Majid Dadashi <[email protected]>: Add i4 support in tfl.slice LiteRT-Converter-PiperOrigin-RevId: 825217744 -- dd0b99c0f4e4876d69189ccdd4321fb36ca178a9 by Google AI Edge <[email protected]>: Do not legalize mhlo.iota to tf.range when element type is ui8, since tf.range doesn't support ui8. LiteRT-Converter-PiperOrigin-RevId: 825298715 Merging this change closes #4268 FUTURE_COPYBARA_INTEGRATE_REVIEW=google-ai-edge/LiteRT#4268 from akodanka:enable_dma 6a7cc0a53fe3cce7cd4238c53a30e9e95ffe8103 PiperOrigin-RevId: 825450169
…nit time. Imported from GitHub PR google-ai-edge/LiteRT#4227 Summary: - TensorWrapper use weight data from flatbuffer directly. # Test //litert/vendors/qualcomm/core/utils:utils_test [==========] 12 tests from 3 test suites ran. (0 ms total) [ PASSED ] 12 tests. YOU HAVE 2 DISABLED TESTS //litert/vendors/qualcomm/core/backends:qnn_backend_test [==========] 0 tests from 0 test suites ran. (0 ms total) [ PASSED ] 0 tests. YOU HAVE 4 DISABLED TESTS //litert/vendors/qualcomm/core/wrappers/tests:op_wrapper_test [==========] 7 tests from 1 test suite ran. (0 ms total) [ PASSED ] 7 tests. //litert/vendors/qualcomm/core/wrappers/tests:tensor_wrapper_test [==========] 18 tests from 1 test suite ran. (0 ms total) [ PASSED ] 18 tests. //litert/vendors/qualcomm/core/wrappers/tests:param_wrapper_test [==========] 16 tests from 2 test suites ran. (0 ms total) [ PASSED ] 16 tests. //litert/vendors/qualcomm/core/wrappers/tests:quantize_params_wrapper_test [==========] 13 tests from 3 test suites ran. (0 ms total) [ PASSED ] 13 tests. //litert/vendors/qualcomm/core:common_test [==========] 13 tests from 1 test suite ran. (0 ms total) [ PASSED ] 13 tests. //litert/vendors/qualcomm/core:tensor_pool_test [==========] 8 tests from 1 test suite ran. (0 ms total) [ PASSED ] 8 tests. //litert/vendors/qualcomm:qnn_manager_test [==========] 3 tests from 1 test suite ran. (228 ms total) [ PASSED ] 3 tests. //litert/c/options:litert_qualcomm_options_test [==========] 17 tests from 2 test suites ran. (0 ms total) [ PASSED ] 17 tests. //litert/c:litert_op_options_test [==========] 36 tests from 1 test suite ran. (0 ms total) [ PASSED ] 36 tests. //litert/tools/flags/vendors:qualcomm_flags_test [==========] 8 tests from 5 test suites ran. (0 ms total) [ PASSED ] 8 tests. //litert/vendors/qualcomm/compiler:qnn_compiler_plugin_test [==========] 232 tests from 4 test suites ran. (51844 ms total) [ PASSED ] 232 tests. //litert/vendors/qualcomm/core/transformation:graph_to_graph_test [==========] 5 tests from 3 test suites ran. (1 ms total) [ PASSED ] 5 tests. //litert/vendors/qualcomm/core/dump:dump_graph_test [==========] 5 tests from 1 test suite ran. (0 ms total) [ PASSED ] 5 tests. Copybara import of the project: -- aa6b7593f695f7f7886822c52b3a23354ec5ad90 by Majid Dadashi <[email protected]>: Add a pattern to push DRQ FQ forward through pad This CL adds a new rewrite pattern, PushForwardDrqFQ, to push a DRQ fake quant op forward through a pad op. This pattern transforms the graph from: drq_fake_quant(input) -> pad -> consumer to: input -> pad -> drq_fake_quant -> consumer This enables the DRQ fake quant op to be fused with its consuming op (e.g., a convolution), leading to a more efficient quantized model. LiteRT-Converter-PiperOrigin-RevId: 798286947 -- d62008b0a4cc981060dbee12371c8ae216d7ce12 by Majid Dadashi <[email protected]>: Fuse L2 normalization patterns using Mul and a keep_dims Reshape. This adds new patterns to the TFLite converter to fuse more forms of L2 normalization. These patterns handle models where L2 normalization is constructed using operations that are functionally equivalent to the standard form but use different ops. The new patterns fuse subgraphs that: Use Mul(x, x) instead of Square(x). Use a Reshape op to add a trailing dimension of size 1 after the Sum reduction, which emulates the keep_dims=true behavior. A new C++ helper IsL2NormalizationKeepDimsReshape is added to check for this specific case. Include an Add or Maximum op with a small constant for numerical stability. New tests are added to verify these fusion patterns work correctly. LiteRT-Converter-PiperOrigin-RevId: 798338534 -- ee88539b38f354dcfeb88e6de972ea612509eb14 by Majid Dadashi <[email protected]>: Allow propagation of per-tensor quantization parameters across tfl.broadcast_to. This enables the prepare-quantize pass to move Quantize/Dequantize operations (QDQs) through broadcast ops. This is valid for per-tensor quantization as broadcasting doesn't change the range of tensor values. A test case is added to verify the propagation. LiteRT-Converter-PiperOrigin-RevId: 798375402 -- 84e5f19693e77300e2d747453f37dece8a5d2f00 by Tommy Chiang <[email protected]>: Update flatbuffers to 25.2.10 No longer need to specify version by git commit. Use normal release version. LiteRT-Converter-PiperOrigin-RevId: 799253783 -- d07f930ead5ad41d383b8c59cedcd42d3d92b9d5 by Robert David <[email protected]>: Add constant folding for `tfl.ceil` on `f32` tensors. Code and tests are copied from `tfl.floor`, replacing `std::floor` with `std::ceil` in the code. LiteRT-Converter-PiperOrigin-RevId: 799784759 -- da44d499f5b965d80e67d03527de000dd95f2472 by Google AI Edge <[email protected]>: Grant tf_tfl_translate visibility to fix oss build error, as litert/build_common/tf_model_gen.bzl requires it LiteRT-Converter-PiperOrigin-RevId: 802191710 -- e00067573d56b6b6279ecc34b4567aa3d0371e82 by Majid Dadashi <[email protected]>: Relax the tflite folding size constraints This is to unblock some foldings that are expected but not happening at the moment. A potential longer term improvement would be to make these thresholds configurable. LiteRT-Converter-PiperOrigin-RevId: 802238463 -- 27219aa5e43eb15dba439d920a715e465010d32c by Weiyi Wang <[email protected]>: No public description LiteRT-Converter-PiperOrigin-RevId: 802279248 -- aa4c391cb7cb274568a910f97fd3def2c0c2c073 by Majid Dadashi <[email protected]>: Expand TFL FullyConnected constant folding to support batched inputs. The constant folding logic for `tfl.fully_connected` is updated to handle inputs with a batch dimension. Previously, only 1D inputs were fully supported. LiteRT-Converter-PiperOrigin-RevId: 804503563 -- 3141cead2543178594cb7a5fc767f50ae97247b5 by Kevin Chen <[email protected]>: Use add output type for fallback bias type in FuseFullyConnectedAndAdd Previously, the filter element type was used as the fallback type if the bias is of NoneType. If the filter type does not match the add type, this can lead to an unbroadcastable type for `new_bias` and downstream segfaults from empty/invalid types. Instead, let's just use the add output type. LiteRT-Converter-PiperOrigin-RevId: 804550625 -- e2d2ce3fbbc578b37ace8ef498564d9c46afd534 by Jun Jiang <[email protected]>: Relax tfl.div op check to allow 6d broadcastable inputs. LiteRT-Converter-PiperOrigin-RevId: 804657332 -- deaa95baf6b540c39ecf4d220c5623bbf91b16ce by Jun Jiang <[email protected]>: Relax tfl.slice and strided_slice op check to allow 6D inputs. LiteRT-Converter-PiperOrigin-RevId: 805891454 -- a20478938617dfdf94db51d20b522b6bc7383a12 by Majid Dadashi <[email protected]>: Add a FuseQDQPass to the TFLite quantization pipeline. This pass is designed to fuse dequantize and quantize operations into their surrounding ops, effectively creating quantized versions of those ops. The pass includes several rewrite patterns to handle different scenarios: - FuseQDQ: The primary pattern for fusing QDQ chains. - PushForwardDrqFQ: Pushes dynamic-range fake-quant ops through padding ops to increase fusion opportunities. - RemoveUnusedFQ: Cleans up unused fake-quant ops. - QuantizeConstPattern: Folds quantize ops on constants into QConstOps. - Patterns for requantization (FuseDqQToRequant, FuseQQToRequant). The pass can distinguish between static-range, dynamic-range, and weight-only quantization to apply the correct fusion logic. New tests have been added to verify the pass's behavior in these different scenarios. LiteRT-Converter-PiperOrigin-RevId: 806457443 -- 3eca5097562b850d4bd80a6e0667f3a4454fcc6e by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 806588730 -- 5802252c9a931a6a6bd1ba7aa07f97b09d4998cf by Google AI Edge <[email protected]>: Check if the operands are constant foldable before fusing `tfl.add` into `tfl.fully_connected` The `FuseAddAndFullyConnected` optimization pattern fuses an `add` operation into the bias of a subsequent `fully_connected`. This change adds checks to ensure this fusion only happens if the `add`'s right-hand side, and the `fully_connected`'s filter and bias are constant. This prevents issues where the fused bias would not be a single constant vector, for example, when the filter comes from a dequantize operation. LiteRT-Converter-PiperOrigin-RevId: 807067198 -- e9f2b6b7c9142c1a6b4293225e55f5aaba305da9 by Maria Lyubimtseva <[email protected]>: Add int16x8 kernel support for equal and not_equal ops LiteRT-Converter-PiperOrigin-RevId: 807869896 -- b63dc7d7dfaff2ba66772c978ece76fcb84f3868 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808040499 -- 972dd8883dc4d959907280e290239938d325f728 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808402450 -- 77841e191460749571b30ee60a7194ffb3d95b99 by Google AI Edge <[email protected]>: Integrate LLVM at llvm/llvm-project@f3b712f6e4e9 Updates LLVM usage to match [f3b712f6e4e9](llvm/llvm-project@f3b712f6e4e9) LiteRT-Converter-PiperOrigin-RevId: 808676531 -- 2dda700c6badafd89c286cc2c2d6315b867145c4 by Byungchul Kim <[email protected]>: Add an option for mmap allocation with MAP_PRIVATE & PROT_WRITE LiteRT-Converter-PiperOrigin-RevId: 809264177 -- c1f9b7b50ec207d2fc91ab98baab86af58925094 by Majid Dadashi <[email protected]>: Update LowerQuantAnnotationsPass to use greedy rewriter In addition, the rewrite pattern responsible for rewriting the fake quant composite now explicitly replaces the fake quant composite op instead of relying on the driver to kill the trivially dead op after all its uses replaced. LiteRT-Converter-PiperOrigin-RevId: 809268429 -- e8df160ab992becb94c0ab3370ec3af634db20e0 by Jing Pu <[email protected]>: Disable MHLO->TF ConvOp Pattern for Int8 input/parameter because the data type is not supported by TF ConvOp. LiteRT-Converter-PiperOrigin-RevId: 810183072 -- 3230fb9d66754a160ebbefb37690c7a3f3114951 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810299873 -- 943940b7f2b16aa2f5b6e54c410d702cd56a3df7 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810340288 -- 3655db1799458130d1370150514d0a1a6c7e0990 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810523749 -- 5e6cbff4e8ca078642edd9f7575352519477da72 by Renjie Wu <[email protected]>: Add support for kTfLiteInt4 output in the Quantize kernel. LiteRT-Converter-PiperOrigin-RevId: 811592774 -- 392a7a7a7db2a97edefbf123475bd6b7f1286793 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 811606924 -- ba03b95ab45377bd3774c54e8d01f534743308e3 by Elen Kalda <[email protected]>: PR #94375: [mlir][tflite][tosa] Disable TFL GatherOp folding for quantized tensors Imported from GitHub PR #94375 --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Copybara import of the project: -- 5c8c23b by Elen Kalda <[email protected]>: [tflite][tosa] Disable TFL GatherOp folding for quantized tensors --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Signed-off-by: Elen Kalda <[email protected]> Merging this change closes #94375 LiteRT-Converter-PiperOrigin-RevId: 812780818 -- d3a22594dce4c5b60845cf02adebd8e8aa724108 by Fergus Henderson <[email protected]>: Update from flatbuffers 25.2.10 to 25.9.23. LiteRT-Converter-PiperOrigin-RevId: 813955553 -- a70c348f4e6b05692a9e4c08e8069b4bf5986637 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 814093030 -- df6cf337d18e22fa509192cf76db07366bc70186 by Fergus Henderson <[email protected]>: Update flatbuffer_compatibility_test to test compatibility of the current schema with schema_v3c.fbs rather than compatibility with schema_v3b.fbs. Since v3c is compatible with v3b, compatibility of the current schema with v3c implies compatibility of the current schema with v3b, so this makes the test strictly more stringent than before. LiteRT-Converter-PiperOrigin-RevId: 814628352 -- 74c2e3e8c414b5e27b65bc34cec0a305b5ad30e0 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 816064324 -- 371e9020b939c2a144b351b420dd31920f956d58 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 817008734 -- 53d2e7c6ee4cd05bfa49c7f5e9b623e030e0ebed by Jacques Pienaar <[email protected]>: Convert to nanobind. This just converts but doesn't rename to enable cleaner diff. LiteRT-Converter-PiperOrigin-RevId: 819018201 -- ded4426f89e84e697dc8f51a4c46ef5323f6c5b1 by Google AI Edge <[email protected]>: Use `size_t` for byte and element counts Changes `bytes_len` and `elem_count` to `size_t` to match the return type of `bytes.size()` and handle potentially large sizes correctly. LiteRT-Converter-PiperOrigin-RevId: 819560782 -- d82a85781b58e0ed2daff36051c890a89d030720 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 type export/import. This change introduces a new `kTfLiteInt2` type to the TFLite schema and MLIR converter. It includes: - Adding `INT2` to the flatbuffer schema. - Mapping `TensorType_INT2` to `kTfLiteInt2` in flatbuffer conversions. - Updating `tflite_types.h` to include `kTfLiteInt2`. - Modifying `flatbuffer_export.cc` to handle 2-bit integer types from MLIR and pack them densely. - Generalizing low-bit utility functions (`PackLowBitValuesDensely`, `UnpackDenseLowBitIntoInt8`) to support both 2-bit and 4-bit values. - Updating type conversion utilities to recognize and handle `kTfLiteInt2`. - Adjusting `util.cc` to correctly report the size and byte requirements for `kTfLiteInt2` tensors, considering their dense packing. LiteRT-Converter-PiperOrigin-RevId: 819821231 -- 8697dbfcb936c53b9aff90b91c5a890863a4acbc by Majid Dadashi <[email protected]>: Add support for int2/int4 in tfl.cast LiteRT-Converter-PiperOrigin-RevId: 820509011 -- 418477d6867402630d796c854a110ca2198605c2 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820517563 -- 2d5f2c0b10262f8eefe6104ece0afa6b1e2e2442 by Majid Dadashi <[email protected]>: Enable lowering from FQ Composite for 2-bit This also adds an additional test for this lowering. LiteRT-Converter-PiperOrigin-RevId: 8205343 -- 6099208a47743ccc876d8bc8ea6a272302569cc1 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820551714 -- 9b29462eea7f0b086e74e6fdc4667dd1a6b2a2ef by Google AI Edge <[email protected]>: llvm/llvm-project#162120 removed some automatic namespace determinations, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820836649 -- af063fa1db9e8e5e240e48d8254f8a98fe47b9ec by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 821973007 -- d13d4bffcc6288d79721e84692bad81da9b57ea7 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 to Dequantize kernels. This change enables the Dequantize and PerChannelDequantize operations to handle 2-bit integer inputs (`kTfLiteInt2`). It includes logic to unpack the packed 2-bit integers into int8_t before performing the dequantization and adds new test cases for both per-tensor and per-channel dequantization with kTfLiteInt2. LiteRT-Converter-PiperOrigin-RevId: 822207279 -- 8afe70b8f6ea724146cadc0e780a7e0f52e0a586 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 (srq) in tfl.fully_connected. LiteRT-Converter-PiperOrigin-RevId: 822405584 -- 433f8603fbc8045908cb258a8ad4eeb376cc8a39 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 822874462 -- 22caf805854b2ab70b83435e8310ec44f302ae2e by Google AI Edge <[email protected]>: Add TensorTypeGetSize to schema_utils. LiteRT-Converter-PiperOrigin-RevId: 824743105 Merging this change closes #4227 FUTURE_COPYBARA_INTEGRATE_REVIEW=google-ai-edge/LiteRT#4227 from graham0824:dev/chunhsue/no_copy_weight 2b63b0f978ddd902c6169b775a88471daf2cb8e7 PiperOrigin-RevId: 825735113
Imported from GitHub PR google-ai-edge/LiteRT#4272 Summary: - Add typename to avoid cmake failure Test Result: ======================== Test Summary ======================== //litert/vendors/qualcomm/core/utils:utils_test [==========] 12 tests from 3 test suites ran. (0 ms total) [ PASSED ] 12 tests. YOU HAVE 2 DISABLED TESTS //litert/vendors/qualcomm/core/backends:qnn_backend_test [==========] 0 tests from 0 test suites ran. (0 ms total) [ PASSED ] 0 tests. YOU HAVE 4 DISABLED TESTS //litert/vendors/qualcomm/core/wrappers/tests:op_wrapper_test [==========] 7 tests from 1 test suite ran. (0 ms total) [ PASSED ] 7 tests. //litert/vendors/qualcomm/core/wrappers/tests:tensor_wrapper_test [==========] 18 tests from 1 test suite ran. (0 ms total) [ PASSED ] 18 tests. //litert/vendors/qualcomm/core/wrappers/tests:param_wrapper_test [==========] 16 tests from 2 test suites ran. (0 ms total) [ PASSED ] 16 tests. //litert/vendors/qualcomm/core/wrappers/tests:quantize_params_wrapper_test [==========] 13 tests from 3 test suites ran. (0 ms total) [ PASSED ] 13 tests. //litert/vendors/qualcomm/core:common_test [==========] 13 tests from 1 test suite ran. (0 ms total) [ PASSED ] 13 tests. //litert/vendors/qualcomm/core:tensor_pool_test [==========] 8 tests from 1 test suite ran. (0 ms total) [ PASSED ] 8 tests. //litert/vendors/qualcomm:qnn_manager_test [==========] 3 tests from 1 test suite ran. (259 ms total) [ PASSED ] 3 tests. //litert/c/options:litert_qualcomm_options_test [==========] 17 tests from 2 test suites ran. (0 ms total) [ PASSED ] 17 tests. //litert/c:litert_op_options_test //litert/tools/flags/vendors:qualcomm_flags_test [==========] 8 tests from 5 test suites ran. (0 ms total) [ PASSED ] 8 tests. //litert/vendors/qualcomm/compiler:qnn_compiler_plugin_test [==========] 232 tests from 4 test suites ran. (61193 ms total) [ PASSED ] 232 tests. Copybara import of the project: -- aa6b7593f695f7f7886822c52b3a23354ec5ad90 by Majid Dadashi <[email protected]>: Add a pattern to push DRQ FQ forward through pad This CL adds a new rewrite pattern, PushForwardDrqFQ, to push a DRQ fake quant op forward through a pad op. This pattern transforms the graph from: drq_fake_quant(input) -> pad -> consumer to: input -> pad -> drq_fake_quant -> consumer This enables the DRQ fake quant op to be fused with its consuming op (e.g., a convolution), leading to a more efficient quantized model. LiteRT-Converter-PiperOrigin-RevId: 798286947 -- d62008b0a4cc981060dbee12371c8ae216d7ce12 by Majid Dadashi <[email protected]>: Fuse L2 normalization patterns using Mul and a keep_dims Reshape. This adds new patterns to the TFLite converter to fuse more forms of L2 normalization. These patterns handle models where L2 normalization is constructed using operations that are functionally equivalent to the standard form but use different ops. The new patterns fuse subgraphs that: Use Mul(x, x) instead of Square(x). Use a Reshape op to add a trailing dimension of size 1 after the Sum reduction, which emulates the keep_dims=true behavior. A new C++ helper IsL2NormalizationKeepDimsReshape is added to check for this specific case. Include an Add or Maximum op with a small constant for numerical stability. New tests are added to verify these fusion patterns work correctly. LiteRT-Converter-PiperOrigin-RevId: 798338534 -- ee88539b38f354dcfeb88e6de972ea612509eb14 by Majid Dadashi <[email protected]>: Allow propagation of per-tensor quantization parameters across tfl.broadcast_to. This enables the prepare-quantize pass to move Quantize/Dequantize operations (QDQs) through broadcast ops. This is valid for per-tensor quantization as broadcasting doesn't change the range of tensor values. A test case is added to verify the propagation. LiteRT-Converter-PiperOrigin-RevId: 798375402 -- 84e5f19693e77300e2d747453f37dece8a5d2f00 by Tommy Chiang <[email protected]>: Update flatbuffers to 25.2.10 No longer need to specify version by git commit. Use normal release version. LiteRT-Converter-PiperOrigin-RevId: 799253783 -- d07f930ead5ad41d383b8c59cedcd42d3d92b9d5 by Robert David <[email protected]>: Add constant folding for `tfl.ceil` on `f32` tensors. Code and tests are copied from `tfl.floor`, replacing `std::floor` with `std::ceil` in the code. LiteRT-Converter-PiperOrigin-RevId: 799784759 -- da44d499f5b965d80e67d03527de000dd95f2472 by Google AI Edge <[email protected]>: Grant tf_tfl_translate visibility to fix oss build error, as litert/build_common/tf_model_gen.bzl requires it LiteRT-Converter-PiperOrigin-RevId: 802191710 -- e00067573d56b6b6279ecc34b4567aa3d0371e82 by Majid Dadashi <[email protected]>: Relax the tflite folding size constraints This is to unblock some foldings that are expected but not happening at the moment. A potential longer term improvement would be to make these thresholds configurable. LiteRT-Converter-PiperOrigin-RevId: 802238463 -- 27219aa5e43eb15dba439d920a715e465010d32c by Weiyi Wang <[email protected]>: No public description LiteRT-Converter-PiperOrigin-RevId: 802279248 -- aa4c391cb7cb274568a910f97fd3def2c0c2c073 by Majid Dadashi <[email protected]>: Expand TFL FullyConnected constant folding to support batched inputs. The constant folding logic for `tfl.fully_connected` is updated to handle inputs with a batch dimension. Previously, only 1D inputs were fully supported. LiteRT-Converter-PiperOrigin-RevId: 804503563 -- 3141cead2543178594cb7a5fc767f50ae97247b5 by Kevin Chen <[email protected]>: Use add output type for fallback bias type in FuseFullyConnectedAndAdd Previously, the filter element type was used as the fallback type if the bias is of NoneType. If the filter type does not match the add type, this can lead to an unbroadcastable type for `new_bias` and downstream segfaults from empty/invalid types. Instead, let's just use the add output type. LiteRT-Converter-PiperOrigin-RevId: 804550625 -- e2d2ce3fbbc578b37ace8ef498564d9c46afd534 by Jun Jiang <[email protected]>: Relax tfl.div op check to allow 6d broadcastable inputs. LiteRT-Converter-PiperOrigin-RevId: 804657332 -- deaa95baf6b540c39ecf4d220c5623bbf91b16ce by Jun Jiang <[email protected]>: Relax tfl.slice and strided_slice op check to allow 6D inputs. LiteRT-Converter-PiperOrigin-RevId: 805891454 -- a20478938617dfdf94db51d20b522b6bc7383a12 by Majid Dadashi <[email protected]>: Add a FuseQDQPass to the TFLite quantization pipeline. This pass is designed to fuse dequantize and quantize operations into their surrounding ops, effectively creating quantized versions of those ops. The pass includes several rewrite patterns to handle different scenarios: - FuseQDQ: The primary pattern for fusing QDQ chains. - PushForwardDrqFQ: Pushes dynamic-range fake-quant ops through padding ops to increase fusion opportunities. - RemoveUnusedFQ: Cleans up unused fake-quant ops. - QuantizeConstPattern: Folds quantize ops on constants into QConstOps. - Patterns for requantization (FuseDqQToRequant, FuseQQToRequant). The pass can distinguish between static-range, dynamic-range, and weight-only quantization to apply the correct fusion logic. New tests have been added to verify the pass's behavior in these different scenarios. LiteRT-Converter-PiperOrigin-RevId: 806457443 -- 3eca5097562b850d4bd80a6e0667f3a4454fcc6e by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 806588730 -- 5802252c9a931a6a6bd1ba7aa07f97b09d4998cf by Google AI Edge <[email protected]>: Check if the operands are constant foldable before fusing `tfl.add` into `tfl.fully_connected` The `FuseAddAndFullyConnected` optimization pattern fuses an `add` operation into the bias of a subsequent `fully_connected`. This change adds checks to ensure this fusion only happens if the `add`'s right-hand side, and the `fully_connected`'s filter and bias are constant. This prevents issues where the fused bias would not be a single constant vector, for example, when the filter comes from a dequantize operation. LiteRT-Converter-PiperOrigin-RevId: 807067198 -- e9f2b6b7c9142c1a6b4293225e55f5aaba305da9 by Maria Lyubimtseva <[email protected]>: Add int16x8 kernel support for equal and not_equal ops LiteRT-Converter-PiperOrigin-RevId: 807869896 -- b63dc7d7dfaff2ba66772c978ece76fcb84f3868 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808040499 -- 972dd8883dc4d959907280e290239938d325f728 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808402450 -- 77841e191460749571b30ee60a7194ffb3d95b99 by Google AI Edge <[email protected]>: Integrate LLVM at llvm/llvm-project@f3b712f6e4e9 Updates LLVM usage to match [f3b712f6e4e9](llvm/llvm-project@f3b712f6e4e9) LiteRT-Converter-PiperOrigin-RevId: 808676531 -- 2dda700c6badafd89c286cc2c2d6315b867145c4 by Byungchul Kim <[email protected]>: Add an option for mmap allocation with MAP_PRIVATE & PROT_WRITE LiteRT-Converter-PiperOrigin-RevId: 809264177 -- c1f9b7b50ec207d2fc91ab98baab86af58925094 by Majid Dadashi <[email protected]>: Update LowerQuantAnnotationsPass to use greedy rewriter In addition, the rewrite pattern responsible for rewriting the fake quant composite now explicitly replaces the fake quant composite op instead of relying on the driver to kill the trivially dead op after all its uses replaced. LiteRT-Converter-PiperOrigin-RevId: 809268429 -- e8df160ab992becb94c0ab3370ec3af634db20e0 by Jing Pu <[email protected]>: Disable MHLO->TF ConvOp Pattern for Int8 input/parameter because the data type is not supported by TF ConvOp. LiteRT-Converter-PiperOrigin-RevId: 810183072 -- 3230fb9d66754a160ebbefb37690c7a3f3114951 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810299873 -- 943940b7f2b16aa2f5b6e54c410d702cd56a3df7 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810340288 -- 3655db1799458130d1370150514d0a1a6c7e0990 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810523749 -- 5e6cbff4e8ca078642edd9f7575352519477da72 by Renjie Wu <[email protected]>: Add support for kTfLiteInt4 output in the Quantize kernel. LiteRT-Converter-PiperOrigin-RevId: 811592774 -- 392a7a7a7db2a97edefbf123475bd6b7f1286793 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 811606924 -- ba03b95ab45377bd3774c54e8d01f534743308e3 by Elen Kalda <[email protected]>: PR #94375: [mlir][tflite][tosa] Disable TFL GatherOp folding for quantized tensors Imported from GitHub PR #94375 --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Copybara import of the project: -- 5c8c23b by Elen Kalda <[email protected]>: [tflite][tosa] Disable TFL GatherOp folding for quantized tensors --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Signed-off-by: Elen Kalda <[email protected]> Merging this change closes #94375 LiteRT-Converter-PiperOrigin-RevId: 812780818 -- d3a22594dce4c5b60845cf02adebd8e8aa724108 by Fergus Henderson <[email protected]>: Update from flatbuffers 25.2.10 to 25.9.23. LiteRT-Converter-PiperOrigin-RevId: 813955553 -- a70c348f4e6b05692a9e4c08e8069b4bf5986637 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 814093030 -- df6cf337d18e22fa509192cf76db07366bc70186 by Fergus Henderson <[email protected]>: Update flatbuffer_compatibility_test to test compatibility of the current schema with schema_v3c.fbs rather than compatibility with schema_v3b.fbs. Since v3c is compatible with v3b, compatibility of the current schema with v3c implies compatibility of the current schema with v3b, so this makes the test strictly more stringent than before. LiteRT-Converter-PiperOrigin-RevId: 814628352 -- 74c2e3e8c414b5e27b65bc34cec0a305b5ad30e0 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 816064324 -- 371e9020b939c2a144b351b420dd31920f956d58 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 817008734 -- 53d2e7c6ee4cd05bfa49c7f5e9b623e030e0ebed by Jacques Pienaar <[email protected]>: Convert to nanobind. This just converts but doesn't rename to enable cleaner diff. LiteRT-Converter-PiperOrigin-RevId: 819018201 -- ded4426f89e84e697dc8f51a4c46ef5323f6c5b1 by Google AI Edge <[email protected]>: Use `size_t` for byte and element counts Changes `bytes_len` and `elem_count` to `size_t` to match the return type of `bytes.size()` and handle potentially large sizes correctly. LiteRT-Converter-PiperOrigin-RevId: 819560782 -- d82a85781b58e0ed2daff36051c890a89d030720 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 type export/import. This change introduces a new `kTfLiteInt2` type to the TFLite schema and MLIR converter. It includes: - Adding `INT2` to the flatbuffer schema. - Mapping `TensorType_INT2` to `kTfLiteInt2` in flatbuffer conversions. - Updating `tflite_types.h` to include `kTfLiteInt2`. - Modifying `flatbuffer_export.cc` to handle 2-bit integer types from MLIR and pack them densely. - Generalizing low-bit utility functions (`PackLowBitValuesDensely`, `UnpackDenseLowBitIntoInt8`) to support both 2-bit and 4-bit values. - Updating type conversion utilities to recognize and handle `kTfLiteInt2`. - Adjusting `util.cc` to correctly report the size and byte requirements for `kTfLiteInt2` tensors, considering their dense packing. LiteRT-Converter-PiperOrigin-RevId: 819821231 -- 8697dbfcb936c53b9aff90b91c5a890863a4acbc by Majid Dadashi <[email protected]>: Add support for int2/int4 in tfl.cast LiteRT-Converter-PiperOrigin-RevId: 820509011 -- 418477d6867402630d796c854a110ca2198605c2 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820517563 -- 2d5f2c0b10262f8eefe6104ece0afa6b1e2e2442 by Majid Dadashi <[email protected]>: Enable lowering from FQ Composite for 2-bit This also adds an additional test for this lowering. LiteRT-Converter-PiperOrigin-RevId: 8205343 -- 6099208a47743ccc876d8bc8ea6a272302569cc1 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820551714 -- 9b29462eea7f0b086e74e6fdc4667dd1a6b2a2ef by Google AI Edge <[email protected]>: llvm/llvm-project#162120 removed some automatic namespace determinations, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820836649 -- af063fa1db9e8e5e240e48d8254f8a98fe47b9ec by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 821973007 -- d13d4bffcc6288d79721e84692bad81da9b57ea7 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 to Dequantize kernels. This change enables the Dequantize and PerChannelDequantize operations to handle 2-bit integer inputs (`kTfLiteInt2`). It includes logic to unpack the packed 2-bit integers into int8_t before performing the dequantization and adds new test cases for both per-tensor and per-channel dequantization with kTfLiteInt2. LiteRT-Converter-PiperOrigin-RevId: 822207279 -- 8afe70b8f6ea724146cadc0e780a7e0f52e0a586 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 (srq) in tfl.fully_connected. LiteRT-Converter-PiperOrigin-RevId: 822405584 Merging this change closes #4272 FUTURE_COPYBARA_INTEGRATE_REVIEW=google-ai-edge/LiteRT#4272 from graham0824:dev/chuntl/fix_bug_for_cmake_build 57e7429920d1950d635b29c4f8a18ccd51ade496 PiperOrigin-RevId: 825735341
Imported from GitHub PR google-ai-edge/LiteRT#4268 When running gemma3 model using LiteRT-LM, the pipeline shows a huge latency in the cache update model execution. Since ov::RemoteTensor is currently disabled for AHWB, there was buffer copy involved. DMA buffer(uses ov::RemoteTensor) helps improve this, but LiteRT throws the error "buffer type is not supported" when the dispatch plugin sets DMA as the default. This PR adds support for DMA buffer in LiteRT, and sets it as the default from the intel_openvino dispatch delegate. Copybara import of the project: -- aa6b7593f695f7f7886822c52b3a23354ec5ad90 by Majid Dadashi <[email protected]>: Add a pattern to push DRQ FQ forward through pad This CL adds a new rewrite pattern, PushForwardDrqFQ, to push a DRQ fake quant op forward through a pad op. This pattern transforms the graph from: drq_fake_quant(input) -> pad -> consumer to: input -> pad -> drq_fake_quant -> consumer This enables the DRQ fake quant op to be fused with its consuming op (e.g., a convolution), leading to a more efficient quantized model. LiteRT-Converter-PiperOrigin-RevId: 798286947 -- d62008b0a4cc981060dbee12371c8ae216d7ce12 by Majid Dadashi <[email protected]>: Fuse L2 normalization patterns using Mul and a keep_dims Reshape. This adds new patterns to the TFLite converter to fuse more forms of L2 normalization. These patterns handle models where L2 normalization is constructed using operations that are functionally equivalent to the standard form but use different ops. The new patterns fuse subgraphs that: Use Mul(x, x) instead of Square(x). Use a Reshape op to add a trailing dimension of size 1 after the Sum reduction, which emulates the keep_dims=true behavior. A new C++ helper IsL2NormalizationKeepDimsReshape is added to check for this specific case. Include an Add or Maximum op with a small constant for numerical stability. New tests are added to verify these fusion patterns work correctly. LiteRT-Converter-PiperOrigin-RevId: 798338534 -- ee88539b38f354dcfeb88e6de972ea612509eb14 by Majid Dadashi <[email protected]>: Allow propagation of per-tensor quantization parameters across tfl.broadcast_to. This enables the prepare-quantize pass to move Quantize/Dequantize operations (QDQs) through broadcast ops. This is valid for per-tensor quantization as broadcasting doesn't change the range of tensor values. A test case is added to verify the propagation. LiteRT-Converter-PiperOrigin-RevId: 798375402 -- 84e5f19693e77300e2d747453f37dece8a5d2f00 by Tommy Chiang <[email protected]>: Update flatbuffers to 25.2.10 No longer need to specify version by git commit. Use normal release version. LiteRT-Converter-PiperOrigin-RevId: 799253783 -- d07f930ead5ad41d383b8c59cedcd42d3d92b9d5 by Robert David <[email protected]>: Add constant folding for `tfl.ceil` on `f32` tensors. Code and tests are copied from `tfl.floor`, replacing `std::floor` with `std::ceil` in the code. LiteRT-Converter-PiperOrigin-RevId: 799784759 -- da44d499f5b965d80e67d03527de000dd95f2472 by Google AI Edge <[email protected]>: Grant tf_tfl_translate visibility to fix oss build error, as litert/build_common/tf_model_gen.bzl requires it LiteRT-Converter-PiperOrigin-RevId: 802191710 -- e00067573d56b6b6279ecc34b4567aa3d0371e82 by Majid Dadashi <[email protected]>: Relax the tflite folding size constraints This is to unblock some foldings that are expected but not happening at the moment. A potential longer term improvement would be to make these thresholds configurable. LiteRT-Converter-PiperOrigin-RevId: 802238463 -- 27219aa5e43eb15dba439d920a715e465010d32c by Weiyi Wang <[email protected]>: No public description LiteRT-Converter-PiperOrigin-RevId: 802279248 -- aa4c391cb7cb274568a910f97fd3def2c0c2c073 by Majid Dadashi <[email protected]>: Expand TFL FullyConnected constant folding to support batched inputs. The constant folding logic for `tfl.fully_connected` is updated to handle inputs with a batch dimension. Previously, only 1D inputs were fully supported. LiteRT-Converter-PiperOrigin-RevId: 804503563 -- 3141cead2543178594cb7a5fc767f50ae97247b5 by Kevin Chen <[email protected]>: Use add output type for fallback bias type in FuseFullyConnectedAndAdd Previously, the filter element type was used as the fallback type if the bias is of NoneType. If the filter type does not match the add type, this can lead to an unbroadcastable type for `new_bias` and downstream segfaults from empty/invalid types. Instead, let's just use the add output type. LiteRT-Converter-PiperOrigin-RevId: 804550625 -- e2d2ce3fbbc578b37ace8ef498564d9c46afd534 by Jun Jiang <[email protected]>: Relax tfl.div op check to allow 6d broadcastable inputs. LiteRT-Converter-PiperOrigin-RevId: 804657332 -- deaa95baf6b540c39ecf4d220c5623bbf91b16ce by Jun Jiang <[email protected]>: Relax tfl.slice and strided_slice op check to allow 6D inputs. LiteRT-Converter-PiperOrigin-RevId: 805891454 -- a20478938617dfdf94db51d20b522b6bc7383a12 by Majid Dadashi <[email protected]>: Add a FuseQDQPass to the TFLite quantization pipeline. This pass is designed to fuse dequantize and quantize operations into their surrounding ops, effectively creating quantized versions of those ops. The pass includes several rewrite patterns to handle different scenarios: - FuseQDQ: The primary pattern for fusing QDQ chains. - PushForwardDrqFQ: Pushes dynamic-range fake-quant ops through padding ops to increase fusion opportunities. - RemoveUnusedFQ: Cleans up unused fake-quant ops. - QuantizeConstPattern: Folds quantize ops on constants into QConstOps. - Patterns for requantization (FuseDqQToRequant, FuseQQToRequant). The pass can distinguish between static-range, dynamic-range, and weight-only quantization to apply the correct fusion logic. New tests have been added to verify the pass's behavior in these different scenarios. LiteRT-Converter-PiperOrigin-RevId: 806457443 -- 3eca5097562b850d4bd80a6e0667f3a4454fcc6e by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 806588730 -- 5802252c9a931a6a6bd1ba7aa07f97b09d4998cf by Google AI Edge <[email protected]>: Check if the operands are constant foldable before fusing `tfl.add` into `tfl.fully_connected` The `FuseAddAndFullyConnected` optimization pattern fuses an `add` operation into the bias of a subsequent `fully_connected`. This change adds checks to ensure this fusion only happens if the `add`'s right-hand side, and the `fully_connected`'s filter and bias are constant. This prevents issues where the fused bias would not be a single constant vector, for example, when the filter comes from a dequantize operation. LiteRT-Converter-PiperOrigin-RevId: 807067198 -- e9f2b6b7c9142c1a6b4293225e55f5aaba305da9 by Maria Lyubimtseva <[email protected]>: Add int16x8 kernel support for equal and not_equal ops LiteRT-Converter-PiperOrigin-RevId: 807869896 -- b63dc7d7dfaff2ba66772c978ece76fcb84f3868 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808040499 -- 972dd8883dc4d959907280e290239938d325f728 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808402450 -- 77841e191460749571b30ee60a7194ffb3d95b99 by Google AI Edge <[email protected]>: Integrate LLVM at llvm/llvm-project@f3b712f6e4e9 Updates LLVM usage to match [f3b712f6e4e9](llvm/llvm-project@f3b712f6e4e9) LiteRT-Converter-PiperOrigin-RevId: 808676531 -- 2dda700c6badafd89c286cc2c2d6315b867145c4 by Byungchul Kim <[email protected]>: Add an option for mmap allocation with MAP_PRIVATE & PROT_WRITE LiteRT-Converter-PiperOrigin-RevId: 809264177 -- c1f9b7b50ec207d2fc91ab98baab86af58925094 by Majid Dadashi <[email protected]>: Update LowerQuantAnnotationsPass to use greedy rewriter In addition, the rewrite pattern responsible for rewriting the fake quant composite now explicitly replaces the fake quant composite op instead of relying on the driver to kill the trivially dead op after all its uses replaced. LiteRT-Converter-PiperOrigin-RevId: 809268429 -- e8df160ab992becb94c0ab3370ec3af634db20e0 by Jing Pu <[email protected]>: Disable MHLO->TF ConvOp Pattern for Int8 input/parameter because the data type is not supported by TF ConvOp. LiteRT-Converter-PiperOrigin-RevId: 810183072 -- 3230fb9d66754a160ebbefb37690c7a3f3114951 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810299873 -- 943940b7f2b16aa2f5b6e54c410d702cd56a3df7 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810340288 -- 3655db1799458130d1370150514d0a1a6c7e0990 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810523749 -- 5e6cbff4e8ca078642edd9f7575352519477da72 by Renjie Wu <[email protected]>: Add support for kTfLiteInt4 output in the Quantize kernel. LiteRT-Converter-PiperOrigin-RevId: 811592774 -- 392a7a7a7db2a97edefbf123475bd6b7f1286793 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 811606924 -- ba03b95ab45377bd3774c54e8d01f534743308e3 by Elen Kalda <[email protected]>: PR #94375: [mlir][tflite][tosa] Disable TFL GatherOp folding for quantized tensors Imported from GitHub PR #94375 --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Copybara import of the project: -- 5c8c23b by Elen Kalda <[email protected]>: [tflite][tosa] Disable TFL GatherOp folding for quantized tensors --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Signed-off-by: Elen Kalda <[email protected]> Merging this change closes #94375 LiteRT-Converter-PiperOrigin-RevId: 812780818 -- d3a22594dce4c5b60845cf02adebd8e8aa724108 by Fergus Henderson <[email protected]>: Update from flatbuffers 25.2.10 to 25.9.23. LiteRT-Converter-PiperOrigin-RevId: 813955553 -- a70c348f4e6b05692a9e4c08e8069b4bf5986637 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 814093030 -- df6cf337d18e22fa509192cf76db07366bc70186 by Fergus Henderson <[email protected]>: Update flatbuffer_compatibility_test to test compatibility of the current schema with schema_v3c.fbs rather than compatibility with schema_v3b.fbs. Since v3c is compatible with v3b, compatibility of the current schema with v3c implies compatibility of the current schema with v3b, so this makes the test strictly more stringent than before. LiteRT-Converter-PiperOrigin-RevId: 814628352 -- 74c2e3e8c414b5e27b65bc34cec0a305b5ad30e0 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 816064324 -- 371e9020b939c2a144b351b420dd31920f956d58 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 817008734 -- 53d2e7c6ee4cd05bfa49c7f5e9b623e030e0ebed by Jacques Pienaar <[email protected]>: Convert to nanobind. This just converts but doesn't rename to enable cleaner diff. LiteRT-Converter-PiperOrigin-RevId: 819018201 -- ded4426f89e84e697dc8f51a4c46ef5323f6c5b1 by Google AI Edge <[email protected]>: Use `size_t` for byte and element counts Changes `bytes_len` and `elem_count` to `size_t` to match the return type of `bytes.size()` and handle potentially large sizes correctly. LiteRT-Converter-PiperOrigin-RevId: 819560782 -- d82a85781b58e0ed2daff36051c890a89d030720 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 type export/import. This change introduces a new `kTfLiteInt2` type to the TFLite schema and MLIR converter. It includes: - Adding `INT2` to the flatbuffer schema. - Mapping `TensorType_INT2` to `kTfLiteInt2` in flatbuffer conversions. - Updating `tflite_types.h` to include `kTfLiteInt2`. - Modifying `flatbuffer_export.cc` to handle 2-bit integer types from MLIR and pack them densely. - Generalizing low-bit utility functions (`PackLowBitValuesDensely`, `UnpackDenseLowBitIntoInt8`) to support both 2-bit and 4-bit values. - Updating type conversion utilities to recognize and handle `kTfLiteInt2`. - Adjusting `util.cc` to correctly report the size and byte requirements for `kTfLiteInt2` tensors, considering their dense packing. LiteRT-Converter-PiperOrigin-RevId: 819821231 -- 8697dbfcb936c53b9aff90b91c5a890863a4acbc by Majid Dadashi <[email protected]>: Add support for int2/int4 in tfl.cast LiteRT-Converter-PiperOrigin-RevId: 820509011 -- 418477d6867402630d796c854a110ca2198605c2 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820517563 -- 2d5f2c0b10262f8eefe6104ece0afa6b1e2e2442 by Majid Dadashi <[email protected]>: Enable lowering from FQ Composite for 2-bit This also adds an additional test for this lowering. LiteRT-Converter-PiperOrigin-RevId: 8205343 -- 6099208a47743ccc876d8bc8ea6a272302569cc1 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820551714 -- 9b29462eea7f0b086e74e6fdc4667dd1a6b2a2ef by Google AI Edge <[email protected]>: llvm/llvm-project#162120 removed some automatic namespace determinations, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820836649 -- af063fa1db9e8e5e240e48d8254f8a98fe47b9ec by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 821973007 -- d13d4bffcc6288d79721e84692bad81da9b57ea7 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 to Dequantize kernels. This change enables the Dequantize and PerChannelDequantize operations to handle 2-bit integer inputs (`kTfLiteInt2`). It includes logic to unpack the packed 2-bit integers into int8_t before performing the dequantization and adds new test cases for both per-tensor and per-channel dequantization with kTfLiteInt2. LiteRT-Converter-PiperOrigin-RevId: 822207279 -- 8afe70b8f6ea724146cadc0e780a7e0f52e0a586 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 (srq) in tfl.fully_connected. LiteRT-Converter-PiperOrigin-RevId: 822405584 -- 433f8603fbc8045908cb258a8ad4eeb376cc8a39 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 822874462 -- 22caf805854b2ab70b83435e8310ec44f302ae2e by Google AI Edge <[email protected]>: Add TensorTypeGetSize to schema_utils. LiteRT-Converter-PiperOrigin-RevId: 824743105 -- f2fe03ebf716bf2bf32e1b6ba6385ae29339e771 by Majid Dadashi <[email protected]>: Add i4 support in tfl.slice LiteRT-Converter-PiperOrigin-RevId: 825217744 -- dd0b99c0f4e4876d69189ccdd4321fb36ca178a9 by Google AI Edge <[email protected]>: Do not legalize mhlo.iota to tf.range when element type is ui8, since tf.range doesn't support ui8. LiteRT-Converter-PiperOrigin-RevId: 825298715 Merging this change closes #4268 FUTURE_COPYBARA_INTEGRATE_REVIEW=google-ai-edge/LiteRT#4268 from akodanka:enable_dma 6a7cc0a53fe3cce7cd4238c53a30e9e95ffe8103 PiperOrigin-RevId: 825450169
…orer. Imported from GitHub PR google-ai-edge/LiteRT#4074 Summary: - Integrate TfliteNodeNamespaceHeuristic from Google Model Explorer. - Replace incomplete namespace matching function with TfliteNodeNamespaceHeuristic. ======================== Test Summary ======================== //litert/vendors/qualcomm/core/utils:utils_test [==========] 12 tests from 3 test suites ran. (0 ms total) [ PASSED ] 12 tests. YOU HAVE 2 DISABLED TESTS //litert/vendors/qualcomm/core/backends:qnn_backend_test [==========] 0 tests from 0 test suites ran. (0 ms total) [ PASSED ] 0 tests. YOU HAVE 4 DISABLED TESTS //litert/vendors/qualcomm/core/wrappers/tests:op_wrapper_test [==========] 8 tests from 1 test suite ran. (0 ms total) [ PASSED ] 8 tests. //litert/vendors/qualcomm/core/wrappers/tests:tensor_wrapper_test [==========] 18 tests from 1 test suite ran. (0 ms total) [ PASSED ] 18 tests. //litert/vendors/qualcomm/core/wrappers/tests:param_wrapper_test [==========] 16 tests from 2 test suites ran. (0 ms total) [ PASSED ] 16 tests. //litert/vendors/qualcomm/core/wrappers/tests:quantize_params_wrapper_test [==========] 13 tests from 3 test suites ran. (0 ms total) [ PASSED ] 13 tests. //litert/vendors/qualcomm/core:common_test [==========] 13 tests from 1 test suite ran. (0 ms total) [ PASSED ] 13 tests. //litert/vendors/qualcomm/core:tensor_pool_test [==========] 8 tests from 1 test suite ran. (0 ms total) [ PASSED ] 8 tests. //litert/vendors/qualcomm:qnn_manager_test [==========] 3 tests from 1 test suite ran. (225 ms total) [ PASSED ] 3 tests. //litert/c/options:litert_qualcomm_options_test [==========] 17 tests from 2 test suites ran. (0 ms total) [ PASSED ] 17 tests. //litert/c:litert_op_options_test [==========] 36 tests from 1 test suite ran. (0 ms total) [ PASSED ] 36 tests. //litert/tools/flags/vendors:qualcomm_flags_test [==========] 8 tests from 5 test suites ran. (0 ms total) [ PASSED ] 8 tests. //litert/vendors/qualcomm/compiler:qnn_compiler_plugin_test [==========] 232 tests from 4 test suites ran. (34887 ms total) [ PASSED ] 232 tests. //litert/vendors/qualcomm/core/transformation:graph_to_graph_test [==========] 5 tests from 3 test suites ran. (2 ms total) [ PASSED ] 5 tests. //litert/vendors/qualcomm/core/dump:dump_graph_test [==========] 5 tests from 1 test suite ran. (0 ms total) [ PASSED ] 5 tests. Copybara import of the project: -- aa6b7593f695f7f7886822c52b3a23354ec5ad90 by Majid Dadashi <[email protected]>: Add a pattern to push DRQ FQ forward through pad This CL adds a new rewrite pattern, PushForwardDrqFQ, to push a DRQ fake quant op forward through a pad op. This pattern transforms the graph from: drq_fake_quant(input) -> pad -> consumer to: input -> pad -> drq_fake_quant -> consumer This enables the DRQ fake quant op to be fused with its consuming op (e.g., a convolution), leading to a more efficient quantized model. LiteRT-Converter-PiperOrigin-RevId: 798286947 -- d62008b0a4cc981060dbee12371c8ae216d7ce12 by Majid Dadashi <[email protected]>: Fuse L2 normalization patterns using Mul and a keep_dims Reshape. This adds new patterns to the TFLite converter to fuse more forms of L2 normalization. These patterns handle models where L2 normalization is constructed using operations that are functionally equivalent to the standard form but use different ops. The new patterns fuse subgraphs that: Use Mul(x, x) instead of Square(x). Use a Reshape op to add a trailing dimension of size 1 after the Sum reduction, which emulates the keep_dims=true behavior. A new C++ helper IsL2NormalizationKeepDimsReshape is added to check for this specific case. Include an Add or Maximum op with a small constant for numerical stability. New tests are added to verify these fusion patterns work correctly. LiteRT-Converter-PiperOrigin-RevId: 798338534 -- ee88539b38f354dcfeb88e6de972ea612509eb14 by Majid Dadashi <[email protected]>: Allow propagation of per-tensor quantization parameters across tfl.broadcast_to. This enables the prepare-quantize pass to move Quantize/Dequantize operations (QDQs) through broadcast ops. This is valid for per-tensor quantization as broadcasting doesn't change the range of tensor values. A test case is added to verify the propagation. LiteRT-Converter-PiperOrigin-RevId: 798375402 -- 84e5f19693e77300e2d747453f37dece8a5d2f00 by Tommy Chiang <[email protected]>: Update flatbuffers to 25.2.10 No longer need to specify version by git commit. Use normal release version. LiteRT-Converter-PiperOrigin-RevId: 799253783 -- d07f930ead5ad41d383b8c59cedcd42d3d92b9d5 by Robert David <[email protected]>: Add constant folding for `tfl.ceil` on `f32` tensors. Code and tests are copied from `tfl.floor`, replacing `std::floor` with `std::ceil` in the code. LiteRT-Converter-PiperOrigin-RevId: 799784759 -- da44d499f5b965d80e67d03527de000dd95f2472 by Google AI Edge <[email protected]>: Grant tf_tfl_translate visibility to fix oss build error, as litert/build_common/tf_model_gen.bzl requires it LiteRT-Converter-PiperOrigin-RevId: 802191710 -- e00067573d56b6b6279ecc34b4567aa3d0371e82 by Majid Dadashi <[email protected]>: Relax the tflite folding size constraints This is to unblock some foldings that are expected but not happening at the moment. A potential longer term improvement would be to make these thresholds configurable. LiteRT-Converter-PiperOrigin-RevId: 802238463 -- 27219aa5e43eb15dba439d920a715e465010d32c by Weiyi Wang <[email protected]>: No public description LiteRT-Converter-PiperOrigin-RevId: 802279248 -- aa4c391cb7cb274568a910f97fd3def2c0c2c073 by Majid Dadashi <[email protected]>: Expand TFL FullyConnected constant folding to support batched inputs. The constant folding logic for `tfl.fully_connected` is updated to handle inputs with a batch dimension. Previously, only 1D inputs were fully supported. LiteRT-Converter-PiperOrigin-RevId: 804503563 -- 3141cead2543178594cb7a5fc767f50ae97247b5 by Kevin Chen <[email protected]>: Use add output type for fallback bias type in FuseFullyConnectedAndAdd Previously, the filter element type was used as the fallback type if the bias is of NoneType. If the filter type does not match the add type, this can lead to an unbroadcastable type for `new_bias` and downstream segfaults from empty/invalid types. Instead, let's just use the add output type. LiteRT-Converter-PiperOrigin-RevId: 804550625 -- e2d2ce3fbbc578b37ace8ef498564d9c46afd534 by Jun Jiang <[email protected]>: Relax tfl.div op check to allow 6d broadcastable inputs. LiteRT-Converter-PiperOrigin-RevId: 804657332 -- deaa95baf6b540c39ecf4d220c5623bbf91b16ce by Jun Jiang <[email protected]>: Relax tfl.slice and strided_slice op check to allow 6D inputs. LiteRT-Converter-PiperOrigin-RevId: 805891454 -- a20478938617dfdf94db51d20b522b6bc7383a12 by Majid Dadashi <[email protected]>: Add a FuseQDQPass to the TFLite quantization pipeline. This pass is designed to fuse dequantize and quantize operations into their surrounding ops, effectively creating quantized versions of those ops. The pass includes several rewrite patterns to handle different scenarios: - FuseQDQ: The primary pattern for fusing QDQ chains. - PushForwardDrqFQ: Pushes dynamic-range fake-quant ops through padding ops to increase fusion opportunities. - RemoveUnusedFQ: Cleans up unused fake-quant ops. - QuantizeConstPattern: Folds quantize ops on constants into QConstOps. - Patterns for requantization (FuseDqQToRequant, FuseQQToRequant). The pass can distinguish between static-range, dynamic-range, and weight-only quantization to apply the correct fusion logic. New tests have been added to verify the pass's behavior in these different scenarios. LiteRT-Converter-PiperOrigin-RevId: 806457443 -- 3eca5097562b850d4bd80a6e0667f3a4454fcc6e by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 806588730 -- 5802252c9a931a6a6bd1ba7aa07f97b09d4998cf by Google AI Edge <[email protected]>: Check if the operands are constant foldable before fusing `tfl.add` into `tfl.fully_connected` The `FuseAddAndFullyConnected` optimization pattern fuses an `add` operation into the bias of a subsequent `fully_connected`. This change adds checks to ensure this fusion only happens if the `add`'s right-hand side, and the `fully_connected`'s filter and bias are constant. This prevents issues where the fused bias would not be a single constant vector, for example, when the filter comes from a dequantize operation. LiteRT-Converter-PiperOrigin-RevId: 807067198 -- e9f2b6b7c9142c1a6b4293225e55f5aaba305da9 by Maria Lyubimtseva <[email protected]>: Add int16x8 kernel support for equal and not_equal ops LiteRT-Converter-PiperOrigin-RevId: 807869896 -- b63dc7d7dfaff2ba66772c978ece76fcb84f3868 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808040499 -- 972dd8883dc4d959907280e290239938d325f728 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 808402450 -- 77841e191460749571b30ee60a7194ffb3d95b99 by Google AI Edge <[email protected]>: Integrate LLVM at llvm/llvm-project@f3b712f6e4e9 Updates LLVM usage to match [f3b712f6e4e9](llvm/llvm-project@f3b712f6e4e9) LiteRT-Converter-PiperOrigin-RevId: 808676531 -- 2dda700c6badafd89c286cc2c2d6315b867145c4 by Byungchul Kim <[email protected]>: Add an option for mmap allocation with MAP_PRIVATE & PROT_WRITE LiteRT-Converter-PiperOrigin-RevId: 809264177 -- c1f9b7b50ec207d2fc91ab98baab86af58925094 by Majid Dadashi <[email protected]>: Update LowerQuantAnnotationsPass to use greedy rewriter In addition, the rewrite pattern responsible for rewriting the fake quant composite now explicitly replaces the fake quant composite op instead of relying on the driver to kill the trivially dead op after all its uses replaced. LiteRT-Converter-PiperOrigin-RevId: 809268429 -- e8df160ab992becb94c0ab3370ec3af634db20e0 by Jing Pu <[email protected]>: Disable MHLO->TF ConvOp Pattern for Int8 input/parameter because the data type is not supported by TF ConvOp. LiteRT-Converter-PiperOrigin-RevId: 810183072 -- 3230fb9d66754a160ebbefb37690c7a3f3114951 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810299873 -- 943940b7f2b16aa2f5b6e54c410d702cd56a3df7 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810340288 -- 3655db1799458130d1370150514d0a1a6c7e0990 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 810523749 -- 5e6cbff4e8ca078642edd9f7575352519477da72 by Renjie Wu <[email protected]>: Add support for kTfLiteInt4 output in the Quantize kernel. LiteRT-Converter-PiperOrigin-RevId: 811592774 -- 392a7a7a7db2a97edefbf123475bd6b7f1286793 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 811606924 -- ba03b95ab45377bd3774c54e8d01f534743308e3 by Elen Kalda <[email protected]>: PR #94375: [mlir][tflite][tosa] Disable TFL GatherOp folding for quantized tensors Imported from GitHub PR #94375 --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Copybara import of the project: -- 5c8c23b by Elen Kalda <[email protected]>: [tflite][tosa] Disable TFL GatherOp folding for quantized tensors --tfl-to-tosa-pipeline will try to use TFL folders for constants. If the params tensor in GatherOp is quantized (e.g. quantized tosa.const), the folder will lose the quantization information, causing type mismatch failures in later checks. Signed-off-by: Elen Kalda <[email protected]> Merging this change closes #94375 LiteRT-Converter-PiperOrigin-RevId: 812780818 -- d3a22594dce4c5b60845cf02adebd8e8aa724108 by Fergus Henderson <[email protected]>: Update from flatbuffers 25.2.10 to 25.9.23. LiteRT-Converter-PiperOrigin-RevId: 813955553 -- a70c348f4e6b05692a9e4c08e8069b4bf5986637 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 814093030 -- df6cf337d18e22fa509192cf76db07366bc70186 by Fergus Henderson <[email protected]>: Update flatbuffer_compatibility_test to test compatibility of the current schema with schema_v3c.fbs rather than compatibility with schema_v3b.fbs. Since v3c is compatible with v3b, compatibility of the current schema with v3c implies compatibility of the current schema with v3b, so this makes the test strictly more stringent than before. LiteRT-Converter-PiperOrigin-RevId: 814628352 -- 74c2e3e8c414b5e27b65bc34cec0a305b5ad30e0 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 816064324 -- 371e9020b939c2a144b351b420dd31920f956d58 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 817008734 -- 53d2e7c6ee4cd05bfa49c7f5e9b623e030e0ebed by Jacques Pienaar <[email protected]>: Convert to nanobind. This just converts but doesn't rename to enable cleaner diff. LiteRT-Converter-PiperOrigin-RevId: 819018201 -- ded4426f89e84e697dc8f51a4c46ef5323f6c5b1 by Google AI Edge <[email protected]>: Use `size_t` for byte and element counts Changes `bytes_len` and `elem_count` to `size_t` to match the return type of `bytes.size()` and handle potentially large sizes correctly. LiteRT-Converter-PiperOrigin-RevId: 819560782 -- d82a85781b58e0ed2daff36051c890a89d030720 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 type export/import. This change introduces a new `kTfLiteInt2` type to the TFLite schema and MLIR converter. It includes: - Adding `INT2` to the flatbuffer schema. - Mapping `TensorType_INT2` to `kTfLiteInt2` in flatbuffer conversions. - Updating `tflite_types.h` to include `kTfLiteInt2`. - Modifying `flatbuffer_export.cc` to handle 2-bit integer types from MLIR and pack them densely. - Generalizing low-bit utility functions (`PackLowBitValuesDensely`, `UnpackDenseLowBitIntoInt8`) to support both 2-bit and 4-bit values. - Updating type conversion utilities to recognize and handle `kTfLiteInt2`. - Adjusting `util.cc` to correctly report the size and byte requirements for `kTfLiteInt2` tensors, considering their dense packing. LiteRT-Converter-PiperOrigin-RevId: 819821231 -- 8697dbfcb936c53b9aff90b91c5a890863a4acbc by Majid Dadashi <[email protected]>: Add support for int2/int4 in tfl.cast LiteRT-Converter-PiperOrigin-RevId: 820509011 -- 418477d6867402630d796c854a110ca2198605c2 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820517563 -- 2d5f2c0b10262f8eefe6104ece0afa6b1e2e2442 by Majid Dadashi <[email protected]>: Enable lowering from FQ Composite for 2-bit This also adds an additional test for this lowering. LiteRT-Converter-PiperOrigin-RevId: 8205343 -- 6099208a47743ccc876d8bc8ea6a272302569cc1 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 820551714 -- 9b29462eea7f0b086e74e6fdc4667dd1a6b2a2ef by Google AI Edge <[email protected]>: llvm/llvm-project#162120 removed some automatic namespace determinations, so we need to explicitly specify some namespaces now. This is needed for the LLVM integrate. LiteRT-Converter-PiperOrigin-RevId: 820836649 -- af063fa1db9e8e5e240e48d8254f8a98fe47b9ec by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 821973007 -- d13d4bffcc6288d79721e84692bad81da9b57ea7 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 to Dequantize kernels. This change enables the Dequantize and PerChannelDequantize operations to handle 2-bit integer inputs (`kTfLiteInt2`). It includes logic to unpack the packed 2-bit integers into int8_t before performing the dequantization and adds new test cases for both per-tensor and per-channel dequantization with kTfLiteInt2. LiteRT-Converter-PiperOrigin-RevId: 822207279 -- 8afe70b8f6ea724146cadc0e780a7e0f52e0a586 by Majid Dadashi <[email protected]>: Add support for kTfLiteInt2 (srq) in tfl.fully_connected. LiteRT-Converter-PiperOrigin-RevId: 822405584 -- 433f8603fbc8045908cb258a8ad4eeb376cc8a39 by Google AI Edge <[email protected]>: Automated Code Change LiteRT-Converter-PiperOrigin-RevId: 822874462 -- 22caf805854b2ab70b83435e8310ec44f302ae2e by Google AI Edge <[email protected]>: Add TensorTypeGetSize to schema_utils. LiteRT-Converter-PiperOrigin-RevId: 824743105 -- f2fe03ebf716bf2bf32e1b6ba6385ae29339e771 by Majid Dadashi <[email protected]>: Add i4 support in tfl.slice LiteRT-Converter-PiperOrigin-RevId: 825217744 -- dd0b99c0f4e4876d69189ccdd4321fb36ca178a9 by Google AI Edge <[email protected]>: Do not legalize mhlo.iota to tf.range when element type is ui8, since tf.range doesn't support ui8. LiteRT-Converter-PiperOrigin-RevId: 825298715 -- 692c9c05c26dec493312e56c4e805544511b69d3 by Google AI Edge <[email protected]>: Integrate LLVM at llvm/llvm-project@028bfa255e90 Updates LLVM usage to match [028bfa255e90](llvm/llvm-project@028bfa255e90) LiteRT-Converter-PiperOrigin-RevId: 825670183 Merging this change closes #4074 FUTURE_COPYBARA_INTEGRATE_REVIEW=google-ai-edge/LiteRT#4074 from graham0824:dev/jiunkaiy/namespace 1d54ab636e0e7edadd950528726de4716b31058c PiperOrigin-RevId: 826096883
Op constraints are emitted as static standalone functions and need not be surrounded by the Dialect's C++ namespace. Currently they are, and this change stops emitting a namespace around these static functions.