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

Require expected rank in isInVnniLayout #809

Merged
merged 1 commit into from
Nov 27, 2023
Merged

Conversation

chelini
Copy link
Contributor

@chelini chelini commented Nov 27, 2023

Until we have a better way to express the VNNI layout (see: #563), it is up to the caller to specify the expected rank in the VNNI layout as the rank depends on the operations we are dealing with. The current check for rank < 3 is not correct; this is still ugly, but at least more explicit, as there are not magic assumptions on rank.

@chelini
Copy link
Contributor Author

chelini commented Nov 27, 2023

I don't have good solution at the moment for VNNI. Current checks are not correct. The VNNI ranks depends on the operation we are dealing with (i.e., GEMM may have VNNI layout when memref has rank 3, while BRGEMM 4 for the inputs while 3 for the output).

Copy link
Contributor

@rengolin rengolin left a comment

Choose a reason for hiding this comment

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

I don't have good solution at the moment for VNNI. Current checks are not correct. The VNNI ranks depends on the operation we are dealing with (i.e., GEMM may have VNNI layout when memref has rank 3, while BRGEMM 4 for the inputs while 3 for the output).

The problem with this is that we're passing down to the caller the responsibility to "expect" things. I'd use some enum to hide that like:

enum class VNNISource {
  PACKED = 3,
  GEMM = 3,
  BRGEMM = 4,
  FUSED_BRGEMM = ?
};
bool isInVnniLayout(VNNISource source, MemRefType memref);

Then use isVNNILayout(VNNISource::BRGEMM, memref).

Until we have a better way to express the VNNI layout (see: plaidml#563), it is
up to the callee to specify the expected rank in the VNNI layout as the
rank depends on the operations we are dealing with. The current check
for rank < 3 is not correct; this is still ugly, but at least more
explicit, as there are not magic assumptions on rank.
@chelini chelini force-pushed the imp-vnni branch 2 times, most recently from 6d901d7 to a09c839 Compare November 27, 2023 20:29
@chelini chelini merged commit e228e79 into plaidml:main Nov 27, 2023
2 checks passed
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.

2 participants