Skip to content
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

✨ Migration of MLIR project to the MQT Core project #848

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

BertiFlorea
Copy link
Collaborator

Description

The purpose of this PR is to migrate the functionality of the MQT MLIR project to the MQT Core library. At the moment, the functionality is turned by default to OFF using the CMAKE building method.

if (BUILD_MQT_CORE_MLIR)
  add_subdirectory(mlir)
endif()

Checklist:

  • The pull request only contains commits that are related to it.
  • I have added appropriate tests and documentation.
  • I have made sure that all CI jobs on GitHub pass.
  • The pull request introduces no new warnings and follows the project's style guidelines.

@BertiFlorea BertiFlorea self-assigned this Mar 4, 2025
@BertiFlorea BertiFlorea added Core Anything related to the Core library and IR c++ Anything related to C++ code labels Mar 4, 2025
@burgholzer burgholzer added MLIR Anything related to MLIR feature New feature or request minor Minor version update labels Mar 4, 2025
@burgholzer burgholzer added this to the MLIR Support milestone Mar 4, 2025
Copy link

codecov bot commented Mar 4, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.3%. Comparing base (e1e4515) to head (551f789).
Report is 21 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main    #848     +/-   ##
=======================================
- Coverage   92.3%   92.3%   -0.1%     
=======================================
  Files        127     138     +11     
  Lines      13555   13664    +109     
  Branches    2086    2104     +18     
=======================================
+ Hits       12522   12622    +100     
- Misses      1033    1042      +9     
Flag Coverage Δ
cpp 92.1% <ø> (-0.1%) ⬇️
python 99.7% <ø> (+<0.1%) ⬆️

see 41 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@BertiFlorea BertiFlorea requested a review from burgholzer March 10, 2025 19:57
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

Copy link
Member

@burgholzer burgholzer left a comment

Choose a reason for hiding this comment

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

Hey @BertiFlorea 👋🏼

Thanks for this initial draft for the migration. I just did a very quick and rough pass through the changes. Take everything with a grain of salt 😌

The biggest and most important step for this PR is to actually build the MLIR part of the project in CI and run the tests. Right now, it isn't doing any of that 😅

Copy link
Member

Choose a reason for hiding this comment

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

This can be stripped down considerably. Most of the configured CI workflows here are already running on in the main CI.yml.
You can definitely remove

- cpp-coverage
- cpp-linter
- python-tests
- python-linter
- code-ql
- cd

I am actually pretty sure that we won't be able to use the reusable MQT workflows at first. Simply because they do not install LLVM, so the project won't build.

I'd rather propose to start small here and adapt https://github.com/cda-tum/mqt-workflows/blob/main/.github/workflows/reusable-cpp-tests-ubuntu.yml so that the project properly builds on Ubuntu. Let's take it from there.

Comment on lines +3 to +8
push:
paths:
- "mlir/**"
pull_request:
paths:
- "mlir/**"
Copy link
Member

Choose a reason for hiding this comment

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

probably worth adding a workflow trigger here. so that we can manually start the workflow if necesary

Copy link
Member

Choose a reason for hiding this comment

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

This workflow is also missing a concurrency config

concurrency:
  group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  cancel-in-progress: true

so that in-progress jobs get cancelled when new ones are started.

Comment on lines +8 to +9
# set required cmake version
cmake_minimum_required(VERSION 3.24...3.30)
Copy link
Member

Choose a reason for hiding this comment

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

can be removed as this is no longer the top level project

Comment on lines +16 to +18
set(CMAKE_CXX_STANDARD
17
CACHE STRING "C++ standard to conform to")
Copy link
Member

Choose a reason for hiding this comment

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

can be removed as this is no longer the top level project and this is already set in MQT Core

Comment on lines +20 to +21
# Add path for custom modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Copy link
Member

Choose a reason for hiding this comment

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

This will never add anything because there is no cmake directory here.
can be removed as this is no longer the top level project

Comment on lines +23 to +28
# check if this is the master project or used via add_subdirectory
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
set(MQT_MLIR_MASTER_PROJECT ON)
else()
set(MQT_MLIR_MASTER_PROJECT OFF)
endif()
Copy link
Member

Choose a reason for hiding this comment

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

This will always be FALSE in the current setup, which is also why the current CI runs build nothing.
MQT Core is the master project.
This can be removed.

Comment on lines +30 to +35
option(BUILD_MQT_MLIR_TESTS "Also build tests for the MQT MLIR project" ${MQT_MLIR_MASTER_PROJECT})
option(BUILD_MLIR_DIALECT "Build the MQT MLIR dialect" ${MQT_MLIR_MASTER_PROJECT})

if(BUILD_MLIR_DIALECT)
add_subdirectory(mlir)
endif()
Copy link
Member

Choose a reason for hiding this comment

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

I'd argue that the BUILD_MLIR_DIALECT option can be removed as there already has been an opt-in for building the MLIR components of the project.
BUILD_MQT_MLIR_TESTS is probably also not necessary because we already have BUILD_MQT_CORE_TESTS and I think it is sufficient to simply use that.

Copy link
Member

Choose a reason for hiding this comment

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

I'd argue that this file can either be removed entirely or considerably stripped down and rewritten.

Comment on lines +43 to +47
if(BUILD_MQT_MLIR_TESTS)
enable_testing()
include(GoogleTest)
add_subdirectory(test)
endif()
Copy link
Member

Choose a reason for hiding this comment

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

Just as a reminder that this will require adaptation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Anything related to C++ code Core Anything related to the Core library and IR feature New feature or request minor Minor version update MLIR Anything related to MLIR
Projects
Status: In Progress
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants