Skip to content

feat(build): select operator implementations from ops.json - #931

Draft
voltjia wants to merge 1 commit into
masterfrom
feat/operator-implementation-selection
Draft

feat(build): select operator implementations from ops.json#931
voltjia wants to merge 1 commit into
masterfrom
feat/operator-implementation-selection

Conversation

@voltjia

@voltjia voltjia commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Extends INFINI_OPS_OPS so it accepts a user-owned ops.json that selects exact implementation slots per operator.
  • Uses one normalized selection for wrapper generation, linked dependency resolution, and generated Torch operators.
  • Preserves the existing comma-separated operator allowlist and legacy external header-list JSON format.
  • Removes the need for a separate INFINI_OPS_LINKED_OPS configuration surface.

Example:

{
  "add": {"implementations": [0]},
  "argmax": {"implementations": [8]},
  "top_k_top_p_sampling_from_logits": {"implementations": [16]}
}

Motivation

Operator names alone cannot express builds that need one implementation while excluding another provider of the same operator. Selecting by the existing implementation slot keeps native, generated Torch, and linked providers under the same configuration model and avoids resolving or linking unselected external dependencies.

Compatibility

  • -DINFINI_OPS_OPS=add,gemm retains its current operator-level behavior.
  • -DINFINI_OPS_OPS=/absolute/path/ops.json enables slot selection.
  • A repository-root user ops.json remains supported when the CMake option is unset.
  • The repository does not ship a default ops.json; the file is a consumer-owned build input.
  • Slot arrays are sets, not priority lists. Runtime default selection remains the first active slot.

Validation

  • Ruff format/check passed.
  • Focused parser/resolver tests: 50 passed. Wrapper and Torch codegen tests: 59 passed; the remaining packaged-ATen test requires torchgen, which is covered by the hosted NVIDIA build.
  • Concrete CMake configurations covered inline precedence, JSON slot filtering, missing external providers, and linked slot resolution.
  • Hosted build, Ruff, clang-format, and NVIDIA unit checks passed on the exact commit; remaining platform/shadow checks are still running.
  • The selector commit is based directly on master and does not contain feat(nvidia): add top-k top-p sampling provider #922.

Notes

This replaces #923, which GitHub automatically closed when its head branch was renamed to align the branch type with the feat(build) title.

The FlashInfer sampling provider remains a separate stacked change in #930.

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