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

[GPU][DT] Materialize encodings for GPU targets #17185

Open
Tracked by #17181 ...
hanhanW opened this issue Apr 25, 2024 · 2 comments
Open
Tracked by #17181 ...

[GPU][DT] Materialize encodings for GPU targets #17185

hanhanW opened this issue Apr 25, 2024 · 2 comments
Assignees
Labels
codegen/hip ROCm code generation compiler backend

Comments

@hanhanW
Copy link
Contributor

hanhanW commented Apr 25, 2024

IMO, the pass would look at IREE::GPU::MmaInterfaceAttr attribute to enumerate tile sizes and set up encoding configs for each role. It gives us the set of supported intrinsics. E.g.,

auto mmaAttrs =
llvm::to_vector(mmaKinds->getAsRange<IREE::GPU::MmaInterfaceAttr>());
SmallVector<GPUMatmulShapeType> intrinsics;
intrinsics.reserve(mmaKinds->size());
for (auto mma : mmaAttrs) {
auto [mSize, nSize, kSize] = mma.getMNKShape();
auto [aType, bType, cType] = mma.getABCElementTypes();
if (mma.getSubgroupSize() != targetSubgroupSize)
continue;
intrinsics.emplace_back(mSize, nSize, kSize, aType, bType, cType);
}

I think as an initial step, we can set inner tile sizes to intrinsic sizes and increase them (for better unrolling) later. As discussed today, let's use linalg.generic to represent the mmt4d-like op for now.

@hanhanW
Copy link
Contributor Author

hanhanW commented May 2, 2024

Putting an additional resource here before I forget it. We can review it together when we're discussing details.

Here is an upstream method which has very helpful logics. Ideally, we should refactor the method, and create a new method to return the packed generic op. We can't use the method directly in the materialization pass because it also generates pack/unpack ops. What we need is getting the linalg op in the materialization pattern; replace the contraction op with it.

https://github.com/llvm/llvm-project/blob/4b75fcf0a50f4be955b611e8e20d84d90ea133c8/mlir/include/mlir/Dialect/Linalg/Transforms/Transforms.h#L1120-L1130

@hanhanW
Copy link
Contributor Author

hanhanW commented Jun 21, 2024

Use the issue because it already has some context. E.g., the upstream method that we can use in the work. In the recent LLVMGPUTileAndFuse pipeline (pipeline_test), we already generates some pack/unpack ops in matmul codegen. This is what we want to do in GPU data-tiling.

The goal now is moving those packs to the materialization of set/unset encodings.

@hanhanW hanhanW added the codegen/hip ROCm code generation compiler backend label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codegen/hip ROCm code generation compiler backend
Projects
None yet
Development

No branches or pull requests

2 participants