Support VNNI pre-encoded input in AMX lowering. #210
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch allows the use of AMX lowering for input that is preliminary VNNI encoded to have an ability do directly load input data to AMX tile registers for RHS. To enable such a scheme without changes in the front-end, I use VNNI decoding sequence in a kernel right before tl.dot. AMX lowering pass then detects this sequence and uses encoded data instead of emitting a code to VNNI encode RHS. For more convenient usage, the required sequence is available as a function in
tl.extra.cpu
.Blocked matmul tutorial was modified to support FP16, BF16, and INT8 inputs with optional VNNI packing during the layout change. Enabled VNNI encoding provide nice performance improvement: