Skip to content

fix!: minimize argsort overloads#820

Draft
voltjia wants to merge 1 commit into
masterfrom
fix/minimize-argsort-overloads
Draft

fix!: minimize argsort overloads#820
voltjia wants to merge 1 commit into
masterfrom
fix/minimize-argsort-overloads

Conversation

@voltjia

@voltjia voltjia commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Motivation

#809 corrected the public parameter order but represented each Python default with another C++ overload. That unnecessarily expanded the API surface. C++ callers can pass the Python defaults explicitly while retaining the correct names and order.

This is a follow-up to #809; no standalone issue is associated with it.

Type of Change

  • feat - new feature / new operator / new platform
  • fix - bug fix
  • perf - performance improvement (no behavioral change)
  • refactor - code restructuring without behavior change
  • test - adding or fixing tests only
  • docs - documentation only
  • build / ci - build system or CI configuration
  • chore - tooling, formatting, or other non-code changes
  • Breaking change

Platforms Affected

  • CPU (WITH_CPU)
  • NVIDIA (WITH_NVIDIA)
  • Iluvatar (WITH_ILUVATAR)
  • MetaX (WITH_METAX)
  • Cambricon (WITH_CAMBRICON)
  • Moore (WITH_MOORE)
  • Ascend (WITH_ASCEND)
  • PyTorch C++ bindings (WITH_TORCH)
  • Build system / CMake / CI
  • Python bindings / user-facing API

Smoke Test Result

Host: ssh nvidia
Image: accelerator-dev/nvidia:latest
PyTorch: 2.10.0a0+b4e4ee8

cmake ... -DWITH_CPU=ON -DWITH_NVIDIA=ON -DWITH_TORCH=ON \
  -DINFINI_OPS_OPS=argsort -DINFINI_OPS_TORCH_OPS=argsort
cmake --build build-nvidia --target ops -j 16
Build passed; codegen emitted 1 ATen implementation overload.

python -m pytest tests/test_generate_wrappers.py -q
13 passed

python -m pytest tests/test_argsort.py --devices cpu nvidia -q
10 passed

Test Results on Supported Platforms

Platform Affected Build / Smoke Result Full Result / Notes
CPU Yes targeted build passed Primary and deprecated paths passed
NVIDIA Yes targeted build passed Primary and deprecated paths passed
Iluvatar No N/A - not affected N/A - not affected
MetaX No N/A - not affected N/A - not affected
Cambricon No N/A - not affected N/A - not affected
Moore No N/A - not affected N/A - not affected
Ascend No N/A - not affected N/A - not affected

Benchmark / Performance Impact

N/A. This only removes convenience routing; the ATen implementation is unchanged.

Notes for Reviewers

API alignment

Interface Signature Alignment basis
InfiniOps primary argsort(input, dim, descending, stable, out) PyTorch parameters in Python order; explicit out remains last per CONTRIBUTING.md.
PyTorch public API torch.argsort(input, dim=-1, descending=False, stable=False, *, out=None) Pinned PyTorch source
Deprecated compatibility argsort(input, stable, dim, descending, out) Preserves the pre-#809 interface for migration.
  • C++ callers pass -1, false, and false explicitly when they want PyTorch defaults.
  • Ruff 0.15.22 and clang-format 21.1.8 checks passed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant