Skip to content

[KB] Enable dynamo plugin for KB tests#157

Open
rengolin wants to merge 3 commits into
llvm:mainfrom
rengolin:kb_bench
Open

[KB] Enable dynamo plugin for KB tests#157
rengolin wants to merge 3 commits into
llvm:mainfrom
rengolin:kb_bench

Conversation

@rengolin
Copy link
Copy Markdown
Member

This PR enables a new mode in kernel_bench that allows one to use the Torch Dynamo compiler plugin (CPU only for now). This is similar to the previous imported module: it runs the same pipeline, compiles the same MLIR modules and yield the same results.

Major changes:

  • Factoring some code around import & pipeline
    • import_module extracted in lh.ingress.torch
    • make_function_callable an external helper now
  • Make kernel_bench import the Torch model first
    • Run torch eager to gather the reference output
    • import to MLIR or run with torch.compile
    • reuse the same pipeline on both cases
    • Compare outputs instead of printing output
  • Allowing empty input/output shapes for torch-compile
    • For Dynamo this can be fetched from model and used
    • Import can probably also, but for a later PR

Torch Compile mode enabled in CI with the previous tests.

Note: This is not the default yet due to benchmark not enabled on this mode yet. A follow up PR will add support and enable it by default.

This PR enables a new mode in kernel_bench that allows one to use the
Torch Dynamo compiler plugin (CPU only for now). This is similar to the
previous imported module: it runs the same pipeline, compiles the same
MLIR modules and yield the same results.

Major changes:
 * Factoring some code around import & pipeline
   - import_module extracted in lh.ingress.torch
   - make_function_callable an external helper now
 * Make kernel_bench import the Torch model first
   - Run torch eager to gather the reference output
   - import to MLIR or run with torch.compile
   - reuse the same pipeline on both cases
   - Compare outputs instead of printing output
 * Allowing empty input/output shapes for torch-compile
   - For Dynamo this can be fetched from model and used
   - Import can probably also, but for a later PR

Torch Compile mode enabled in CI with the previous tests.

Note: This is not the default yet due to benchmark not enabled on this
mode yet. A follow up PR will add support and enable it by default.
@rengolin rengolin requested a review from adam-smnk May 21, 2026 15:20
rengolin added 2 commits May 21, 2026 18:28
so that we know they're always correct

you can still override in kernel_bench, this just makes the smoke test much easier

CI wants to be fast, so we allow to pass the shapes by cmd line
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.

1 participant