Skip to content

[ingress][mlir-gen] Merge gpu payload generation methods to mlir-gen#61

Open
tkarna wants to merge 8 commits intollvm:mainfrom
tkarna:merge-mlir-gen
Open

[ingress][mlir-gen] Merge gpu payload generation methods to mlir-gen#61
tkarna wants to merge 8 commits intollvm:mainfrom
tkarna:merge-mlir-gen

Conversation

@tkarna
Copy link
Contributor

@tkarna tkarna commented Mar 4, 2026

Merges "gpu" payload generation methods to mlir-gen.

  • Moved ingress/gpu/* files to ingress/mlir_gen/ and refactored code to use shared methods.
  • Removed value/tensortype dualism from mlir_gen op generation functions.
  • Gpu matmul payload generator uses mlp payload generator directly.
  • Changed mlp payload function argument order to: output, input, weights, [biases].



def convert_datatype(input, output):
in_width = input.type.element_type.width
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe assert that truncf/extf are valid, or rename the func so that it doesn't sound as if it can do arbitrary conversion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated


@func.func(memref_dyn_t, name="gpu_dealloc_" + suffix)
def dealloc_func(memref):
@func_cif(memref_dyn_t, name="gpu_dealloc_" + suffix)
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we can come up with a less fragile way of relying on the generated function name. The payload function name is parametrizable, this here (as well as other util funcs) are hard-coded here and "guessed" on usage. Not a show-stopper, but the current approach is not very nice (same in the mlp-mpi example and probably others).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I agree. At least when with respect to alloc/dealloc functions I hope a MemoryManager abstraction will fix this. The manager creates the helper funcs and also calls them, so the naming scheme is defined in one single place.

Copy link
Member

@adam-smnk adam-smnk left a comment

Choose a reason for hiding this comment

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

Good reorg, perfectly fits the mlir-gen module.

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