-
Notifications
You must be signed in to change notification settings - Fork 78
feat(l3): Max/Min/Prod reduce ops for allreduce/reduce_scatter kernels #2102
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| /* | ||
| * Copyright (c) PyPTO Contributors. | ||
| * This program is free software, you can redistribute it and/or modify it under the terms and conditions of | ||
| * CANN Open Software License Agreement Version 2.0 (the "License"). | ||
| * Please refer to the License for details. You may not use this file except in compliance with the License. | ||
| * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED, | ||
| * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE. | ||
| * See LICENSE in the root of the software repository for the full text of the License. | ||
| * ----------------------------------------------------------------------------------------------------------- | ||
| */ | ||
| #pragma once | ||
|
|
||
| /// Reduction operator for simpler hand-written collective kernels. | ||
| /// Mirrors pypto's ReduceOp (include/pypto/ir/comm.h) without a cross-repo | ||
| /// include dependency. | ||
| enum class CollectiveReduceOp : int { | ||
| kSum = 0, | ||
| kMax = 1, | ||
| kMin = 2, | ||
| kProd = 3, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,6 +50,7 @@ __attribute__((visibility("default"))) void allreduce_orchestration(const ChipTa | |
| params.add_inout(scratch); | ||
| params.add_scalar(orch_args.scalar(0)); // nranks | ||
| params.add_scalar(orch_args.scalar(1)); // CommContext | ||
| params.add_scalar(orch_args.scalar(2)); // reduce_op | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Set Line 53 adds a third scalar. The task now has three tensors and three scalars. Proposed fix- .expected_arg_count = 5, // 3 tensors + 2 scalars
+ .expected_arg_count = 6, // 3 tensors + 3 scalars🤖 Prompt for AI Agents |
||
| rt_submit_aiv_task(0, params); | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
Report unsupported reduction operations to the caller.
A non-Sum request reaches
pipe_barrier()and returns normally. The kernel does not writeoutput, so the caller can consume stale or uninitialized output as a successful collective result. Reject the request before task submission, or add a shared device-to-host error status that prevents result consumption.tests/st/worker/collectives/allreduce/kernels/aiv/allreduce_bidirectional_ring_kernel.cpp#L99-L102: make non-Sum requests fail through the collective error contract.tests/st/worker/collectives/allreduce/kernels/aiv/allreduce_ibing_kernel.cpp#L135-L138: use the same failure behavior.📍 Affects 2 files
tests/st/worker/collectives/allreduce/kernels/aiv/allreduce_bidirectional_ring_kernel.cpp#L99-L102(this comment)tests/st/worker/collectives/allreduce/kernels/aiv/allreduce_ibing_kernel.cpp#L135-L138🤖 Prompt for AI Agents