On Tue, 9 Dec 2025 07:11:09 GMT, Quan Anh Mai <[email protected]> wrote:
>> Hi @merykitty , I feel it's better to start the reduction operation from >> `the identity value`, because `firstNonZero`, `min/max`, and `umin/umax` all >> reuse the same template function `gen_reduction_op_func`. If we start from >> `a[idx]` for `umin/umax` (`min/max` is also possible), then we have to >> create a new template function. Considering we've already correctly fixed >> this issue, I think the current approach might be more maintainable. What do >> you think? > > @erifan I don't see why `firstNonZero` cannot do the same and start from > `a[idx]` here? @merykitty I apologize for not being clear. Actually, It's `SUADDReduce` that doesn't allow starting with `a[idx]` because that would result in `a[idx]` being added twice. Specifically, this happens as follows: `gen_saturating_reduction_op` (used to generate `SUADDReduce`) and `gen_reduction_op_func` (used to generate `umin/umax, etc.`) both use the `Unit-Reduction-Scalar-op.template` template. When we modify it, `SUADDReduce` is also affected. Therefore, a new template needs to be defined. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/28692#discussion_r2601494745
