Skip to content

Commit f5c950b

Browse files
banach-spacegithub-actions[bot]
authored andcommitted
Automerge: [mlir][Vector] Update VectorEmulateNarrowType.cpp (2/N) (#123527)
This is PR 2 in a series of N patches aimed at improving "VectorEmulateNarrowType.cpp". This is mainly minor refactoring, no major functional changes are made/added. **CHANGE 1** Renames the variable "scale". Note, "scale" could mean either: * "container-elements-per-emulated-type", or * "emulated-elements-per-container-type". While from the context it is clear that it's always the former (original type is always a sub-byte type and the emulated type is usually `i8`), this PR reduces the cognitive load by making this clear. **CHANGE 2** Replaces `isUnalignedEmulation` with `isFullyAligned` Note, `isUnalignedEmulation` is always computed following a "per-element-alignment" condition: ```cpp // Check per-element alignment. if (containerBits % emulatedBits != 0) { return rewriter.notifyMatchFailure( op, "impossible to pack emulated elements into container elements " "(bit-wise misalignment)"); } // (...) bool isUnalignedEmulation = origElements % emulatedPerContainerElem != 0; ``` Given that `isUnalignedEmulation` captures only one of two conditions required for "full alignment", it should be re-named as `isPartiallyUnalignedEmulation`. Instead, I've flipped the condition and renamed it as `isFullyAligned`: ```cpp bool isFullyAligned = origElements % emulatedPerContainerElem == 0; ``` **CHANGE 3** * Unifies various comments throughout the file (for consistency). * Adds new comments throughout the file and adds TODOs where high-level comments are missing. **GitHub issue to track this work**: llvm/llvm-project#123630
2 parents 9ee3907 + 78f690b commit f5c950b

File tree

1 file changed

+107
-78
lines changed

1 file changed

+107
-78
lines changed

0 commit comments

Comments
 (0)