Add generic InfiniOps operator performance adapter - #43
Closed
baominghelly wants to merge 1 commit into
Closed
Conversation
baominghelly
force-pushed
the
agent/cambricon-op-performance-adapter
branch
from
August 3, 2026 06:58
0d93f27 to
d131873
Compare
Collaborator
Author
|
GitHub automatically closed this PR when its head branch was renamed to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Supported Operators
add,sub,mul,divcast,catgemm,matmul,mm,linearModel-specific and stateful operators such as flash attention, rotary embedding, and KV cache updates are intentionally deferred. Their optional inputs, mixed dtypes, multiple outputs, and aliasing rules need separate contracts and correctness references.
Why
The source branch implemented each operator with a separate setup method and duplicated platform mappings and JSON field strings throughout the adapter. It also assumed implementation slot
8existed whenever no native implementation was found, which can terminate the InfiniOps C++ dispatcher.The refactored adapter uses four reusable builder families and only invokes implementation indices returned by
active_implementation_indices. Missing runtime implementations become actionable per-test failures instead of process-level aborts.Input generation and result aggregation utilities were split into draft PR #46 so this PR remains focused on adapter integration.
Validation
Software checks:
python3 -m pytest -q tests/test_infiniops_adapter.py tests/test_executor_adapter_response.py tests/test_operator_flops.py: 16 passedpython3 -m compileall -q infinimetrics tests main.py: passedCambricon hardware smoke test:
main.py -> Dispatcher -> Executor -> InfiniOpsAdapterpathadd/sub/div/mm: 12/12 passedPASSand populated latency, TFLOPS, and bandwidth metricsThe latency observations are smoke-test evidence only, not a performance baseline.