Repository navigation
[Codegen][CPU] Honor --iree-llvmcpu-skip-intermediate-roundings=false for RVV Zvfhmin f16 inner_tiled MMA - #25125
Conversation
|
|
@Manewing This resolves issue #25058 (reported by @TMahlatini), addressing your feedback from #25000 (comment). All checks have passed, could you take a look? |
|
@liuyalong I will take a look at the PR shortly. Sorry for the delayed review. |
AGindinson
left a comment
There was a problem hiding this comment.
Thanks for the fix! I understand the idea with the lossy_roundtrip attribute, but to my mind this overcomplicates things and forces too much plumbing for a conceptually simple change.
|
For new version, the command still works, it just produces the new materialized form now, not the old iree.lossy_roundtrip form. I can use the command to capture both IR and diagnostics and stop at the function boundary(when skip-intermediate-roundings=false): Current output shows the same key property, but with the distributed f16 accumulator carried explicitly: So extf/truncf are still inside the K loop. What is gone is {iree.lossy_roundtrip} and the “not hoisted or cancelled” remark, because the rounding is now materialized in CPU lowering instead of being communicated through IR. |
|
| flag | accumulation | extf/truncf | semantics |
|---|---|---|---|
true |
f32 across K | hoisted out of loop | skips intermediate f16 rounding |
false |
f16 each iteration | inside loop | strict per-K f16 rounding |
Keeping the accumulator in f32 is usually more numerically precise, but it
does not match strict f16 round-per-iteration semantics — which is why the
option exists. The hoisted form is not a bug when true.
6241ae8 to
b7a25e0
Compare
b7a25e0 to
e9e7b4a
Compare
|
@AGindinson I rebase the code onto origin:main, could you please re-kick off it? |
@AGindinson Thanks for kicking off the CI again. All the latest CI results have passed. |
AGindinson
left a comment
There was a problem hiding this comment.
Sorry for another delay @liuyalong. Generally LGTM with a couple suggestions
e9e7b4a to
5464c8c
Compare
|
@AGindinson Thanks for kick off the newest CI. The |
… for RVV Zvfhmin f16 inner_tiled MMA Zvfhmin lacks native f16 MAC, so f16 MMA widens accumulator to f32 then truncates back. These extf/truncf pairs were marked as invertible and hoisted out of K loop, dropping per-K rounding and producing wrong answers. The skip-intermediate-roundings flag was not plumbed into lowering at all. Propagate skipIntermediateRoundings through inner tile lowering and the LLVMCPU vector pipelines. When we need to preserve roundings (widenF16Acc && !skipIntermediateRoundings), materialize the f16 -> f32 -> f16 round-trip directly around each MA step in emitIntrinsic, and drop the hoistable distribute/reassemble accumulator pair. Add tests covering both keep-rounding and skip-rounding modes. Fixes: iree-org#25058 Assisted-by: Claude Code, Doubao, DeepSeek Signed-off-by: Yalong <[email protected]>
5464c8c to
e9e7b4a
Compare
e9e7b4a to
ea38807
Compare
Zvfhmin lacks native f16 MAC, so f16 MMA widens accumulator to f32
then truncates back. These extf/truncf pairs were marked as invertible
and hoisted out of K loop, dropping per-K rounding and producing wrong
answers. The skip-intermediate-roundings flag was not plumbed into
lowering at all.
Propagate skipIntermediateRoundings through inner tile lowering and the
LLVMCPU vector pipelines. When we need to preserve roundings (widenF16Acc
&& !skipIntermediateRoundings), materialize the f16 -> f32 -> f16
round-trip directly around each MA step in emitIntrinsic, and drop the
hoistable distribute/reassemble accumulator pair.
Add tests covering both keep-rounding and skip-rounding modes.
Fixes: #25058
Assisted-by: Claude Code, Doubao, DeepSeek