Skip to content

[Enh] Improve macro name robustness#651

Merged
sjfeng1999 merged 2 commits into
mainfrom
pr/enh-backend-macro
Jun 4, 2026
Merged

[Enh] Improve macro name robustness#651
sjfeng1999 merged 2 commits into
mainfrom
pr/enh-backend-macro

Conversation

@sjfeng1999
Copy link
Copy Markdown
Collaborator

Motivation

Technical Details

Test Plan

Test Result

Submission Checklist

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors how FlyDSL iterates over enabled backend stacks at compile time by replacing the FLYDSL_BACKENDS_TUPLE-based preprocessor iteration with a more robust FLYDSL_BACKEND_COUNT + FLYDSL_BACKEND_0..N-1 scheme generated by CMake.

Changes:

  • Introduces include/flydsl/Backend/Backend.h providing FLYDSL_FOR_EACH_BACKEND(...) driven by FLYDSL_BACKEND_COUNT.
  • Updates CMake backend configuration (cmake/FlyDSLBackends.cmake) to emit FLYDSL_BACKEND_COUNT and per-index backend defines instead of FLYDSL_BACKENDS_TUPLE.
  • Updates backend registration call sites (fly-opt and Python registration) and adjusts the unit test accordingly; removes the old ForEachBackend.h.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/fly-opt/fly-opt.cpp Switches backend iteration/registration to FLYDSL_FOR_EACH_BACKEND.
python/mlir_flydsl/FlyRegisterEverything.cpp Switches Python-side backend registration to FLYDSL_FOR_EACH_BACKEND.
cmake/FlyDSLBackends.cmake Emits FLYDSL_BACKEND_COUNT and FLYDSL_BACKEND_<i> defines; adds max-backend guard.
include/flydsl/Backend/Backend.h New preprocessor iteration utility for backends.
include/flydsl/Backend/ForEachBackend.h Removes the old tuple-based backend iteration utility.
tests/unit/test_backend_cmake_defaults.py Updates guardrail assertions to match new CMake compile definitions.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread tools/fly-opt/fly-opt.cpp Outdated
Comment thread cmake/FlyDSLBackends.cmake Outdated
Comment thread include/flydsl/Backend/Backend.h
@sjfeng1999 sjfeng1999 merged commit 4d90356 into main Jun 4, 2026
13 checks passed
@sjfeng1999 sjfeng1999 deleted the pr/enh-backend-macro branch June 4, 2026 07:48
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.

3 participants