Skip to content

Conversation

@anuragsingh-tt
Copy link

  • Add ONNX_MLIR_ENABLE_ONLY_ONNX_DIALECT CMake flag for minimal builds
  • Decouple src/Dialect/Mlir from Compiler and Krnl dependencies
  • Add test-onnx-to-mlir utility for ONNX model import testing
  • Include documentation and CI workflow for minimal build
  • Exclude non-essential interfaces and third-party dependencies

This enables building only the ONNX dialect and essential utilities without the full onnx-mlir compiler stack, useful for projects that only need ONNX dialect IR generation.

Testing:

  • Can build the project with:
    cmake -S . -B build -G Ninja -DMLIR_DIR=llvm-project/build/lib/cmake/mlir -DONNX_MLIR_ENABLE_ONLY_ONNX_DIALECT=ON -DCMAKE_BUILD_TYPE=Release

and run:
build/Release/bin/test-onnx-to-mlir <your_onnx.onnx>

Full build: 1862 targets
"Minimal" build: 620 targets

@jenkins-droid
Copy link
Collaborator

Can one of the admins verify this patch?

@anuragsingh-tt
Copy link
Author

Resolves #1597.

@tungld
Copy link
Collaborator

tungld commented Aug 21, 2025

@jenkins-droid test this please

@anuragsingh-tt anuragsingh-tt force-pushed the anuragsingh/minimal-onnx-dialect branch 2 times, most recently from 77a8c7a to 2450d55 Compare August 24, 2025 04:23
- Add ONNX_MLIR_ENABLE_ONLY_ONNX_DIALECT CMake flag for minimal builds
- Decouple src/Dialect/Mlir from Compiler and Krnl dependencies
- Add test-onnx-to-mlir utility for ONNX model import testing
- Include documentation and CI workflow for minimal build
- Exclude non-essential interfaces and third-party dependencies

This enables building only the ONNX dialect and essential utilities
without the full onnx-mlir compiler stack, useful for projects that
only need ONNX dialect IR generation.

Signed-off-by: Anurag <[email protected]>
@anuragsingh-tt anuragsingh-tt force-pushed the anuragsingh/minimal-onnx-dialect branch from 2450d55 to 452ec52 Compare August 24, 2025 04:31
@tungld tungld requested a review from gongsu832 August 28, 2025 04:41
@chentong319
Copy link
Collaborator

The error in building is related to decomposeOpsInONNX. Do you want to exclude src/ONNX/Transform?

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.

4 participants