fix: preserve compatibility with old-style A2A3 TPipe local slot arg#68
fix: preserve compatibility with old-style A2A3 TPipe local slot arg#68ndleslx wants to merge 1 commit intohw-native-sys:mainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the TPipe template parameters in TPush.hpp to introduce CompatLocalSlotNumOrIsNoSplit, replacing the IsNoSplit boolean. This update allows for more flexible local slot number configurations while maintaining backward compatibility. Feedback was provided to simplify the boolean logic for the IsNoSplit constant to improve code clarity.
| static constexpr bool IsNoSplit = | ||
| CompatLocalSlotNumOrIsNoSplit <= 1 && static_cast<bool>(CompatLocalSlotNumOrIsNoSplit); |
There was a problem hiding this comment.
The logic for IsNoSplit can be simplified. Since CompatLocalSlotNumOrIsNoSplit is a uint32_t, the expression CompatLocalSlotNumOrIsNoSplit <= 1 && static_cast<bool>(CompatLocalSlotNumOrIsNoSplit) is logically equivalent to CompatLocalSlotNumOrIsNoSplit == 1. This is more concise and improves readability while maintaining the same behavior (evaluating to true only when the value is 1).
static constexpr bool IsNoSplit = (CompatLocalSlotNumOrIsNoSplit == 1);
Summary
include/pto/npu/a2a3/TPush.hppaccept both old-style and new-styleTPipetemplate argument layoutsIsNoSplitonly for0/1, otherwise treat it asLocalSlotNumptoas v0.24outputProblem
Current generated code from
ptoas v0.24may emit:but the current A2A3 header declares the 5th template parameter as
bool IsNoSplit, which makes that form fail to compile.Fix
Use a compatibility parameter in the 5th position and derive:
IsNoSplitfrom0/1>1This preserves support for both:
TPipe<..., SlotNum, LocalSlotNum>TPipe<..., SlotNum, IsNoSplit, LocalSlotNum>Validation
hw-native-sys/ptoaslatest release isv0.24hw-native-sys/pto-isa:mainstill had the incompatible A2A3 signatureptoas v0.24generated A2A3 kernelsCloses #67