Skip to content

mlir: extract MlirCpuTarget base for the shared CPU codegen driver - #122

Merged
qaco merged 1 commit into
xtc-tools:mainfrom
qaco:hugo/cpu_codegen
Aug 31, 2026
Merged

mlir: extract MlirCpuTarget base for the shared CPU codegen driver#122
qaco merged 1 commit into
xtc-tools:mainfrom
qaco:hugo/cpu_codegen

Conversation

@qaco

@qaco qaco commented Aug 29, 2026

Copy link
Copy Markdown
Contributor

Motivation

MlirLLVMTarget and MlirCTarget carried a ~80%-identical generate_code_for_target (dump-file setup, print_assembly, shared-lib/executable build, cleanup) plus byte-identical helpers (cmd_cc, shared_libs, shared_path, _save_temp, execute_command, ...), differing only in the lower + translate + compile-to-object step.

Description

Hoist the shared driver into a new MlirCpuTarget base as a template method with a _lower_and_compile_object() hook, and move the identical helpers there too. Each CPU target now only implements its own toolchain step (mlir-translate/opt/llc vs xtc-translate/cc).

@qaco
qaco requested a review from guillon August 29, 2026 12:47
@qaco qaco self-assigned this Aug 29, 2026
@qaco
qaco force-pushed the hugo/cpu_codegen branch from 4dac6d1 to 03e3fb7 Compare August 29, 2026 15:20
@codecov

codecov Bot commented Aug 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.65217% with 28 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/xtc/backends/mlir/MlirTarget/MlirCpuTarget.py 73.07% 19 Missing and 9 partials ⚠️

📢 Thoughts on this report? Let us know!

@guillon
guillon requested a review from ElectrikSpace August 30, 2026 22:44
@guillon guillon assigned ElectrikSpace and unassigned qaco Aug 30, 2026
@qaco
qaco force-pushed the hugo/cpu_codegen branch from 03e3fb7 to 4d95b3e Compare August 31, 2026 06:02
@qaco
qaco force-pushed the hugo/cpu_codegen branch from 4d95b3e to f8edd02 Compare August 31, 2026 09:23
@qaco
qaco merged commit aae2e2a into xtc-tools:main Aug 31, 2026
5 checks passed
@qaco
qaco deleted the hugo/cpu_codegen branch August 31, 2026 09:59
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