Skip to content

feat(operator): add optional detailed dispatch trace - #1006

Merged
voltjia merged 2 commits into
masterfrom
feat/operator-trace-detailed-mode
Oct 23, 2026
Merged

voltjia merged 2 commits into
masterfrom
feat/operator-trace-detailed-mode

Conversation

@zzhfz

@zzhfz zzhfz commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add an optional, off-by-default detailed dispatch trace in src/operator.h.
  • Emit each tensor's index, device, dtype, shape, and strides at operator call entry.
  • Keep the existing INFINI_OPS_TRACE_CALLS output unchanged.

Motivation

The existing operator-call trace reports the operator name, device, and
implementation index, but does not expose tensor metadata needed for
per-operator cost analysis.

The new INFINI_OPS_TRACE_CALLS_DETAILED mode provides this metadata without
reading tensor values, adding device synchronization, or changing operator
computation and scheduling.

No related issue.

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

This change is in the shared operator dispatch path. It is active only when
INFINI_OPS_TRACE_CALLS_DETAILED is enabled.

  • 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

Targeted CPU validation was run with a local pytest script against a CPU smoke
build. The validation script is not included in this commit.

tests/test_trace_calls.py
7 passed in 15.91s

##Validated:

  • trace disabled, basic-only, detailed-only, and both enabled
  • float32, float16, and bfloat16 metadata
  • contiguous and non-contiguous strides
  • concurrent JSON record parsing

Moore / MUSA

Tested on an MTT S5000 with a Moore-only build (WITH_CPU=OFF).

[INFINI_OPS_TRACE_CALLS_DETAILED] {"operator_name": "Add", "implementation": 0, "tensors": [{"index": 0, "device": "moore", "dtype": "float16", "shape": [8], "strides": [1]}, ...]}
ADD_OK=True

[INFINI_OPS_TRACE_CALLS_DETAILED] {"operator_name": "Gemm", "implementation": 0, "tensors": [{"index": 0, "device": "moore", "dtype": "float16", "shape": [4,8], "strides": [8,1]}, ...]}
GEMM_OK=True

@zzhfz
zzhfz requested a review from a team October 22, 2026 06:44
Comment thread src/operator.h Outdated
Comment thread src/operator.h Outdated
@zzhfz
zzhfz requested a review from voltjia October 23, 2026 01:38
@voltjia
voltjia merged commit a850d58 into master Oct 23, 2026
9 of 20 checks passed
@voltjia
voltjia deleted the feat/operator-trace-detailed-mode branch October 23, 2026 01:58
@voltjia
voltjia restored the feat/operator-trace-detailed-mode branch October 23, 2026 02:03
@voltjia
voltjia deleted the feat/operator-trace-detailed-mode branch October 23, 2026 02:03
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.

2 participants