| Files | Last commit | Last update |
|---|---|---|
fix(exported_custom_op): Resolve postponed infer_shape annotations and accept String and Float shape attr Co-authored-by: Nikita Larichev<nikita.larichev@h-partners.com> # message auto-generated for no-merge-commit merge: !6886 merge prototype/infer-shape-annotation-3525 into master fix(exported_custom_op): Resolve postponed infer_shape annotations and accept String and Float shape attr Created-by: Nikita17 Commit-by: Nikita Larichev Merged-by: cann-robot Description: Fixes #3525. Two more things were wrong on that path than the report names: - A String value that parses as JSON reached infer_shape as the wrong type: layout="123" arrived as int 123, with no error. - The generated InferShapeGeImpl took no shape attribute but Int / ListInt, so an op fixed on the run path still failed the op-package build. Float, the fourth declarable AttrSpec kind, was refused there too. ## Why only a source string is resolved get_type_hints is not a no-op on an evaluated annotation: it answers from a callable object's **class** namespace, and below Python 3.11 it wraps a None-defaulted parameter in Optional, which the conversion does not recognise. Resolving unconditionally therefore breaks two cases that work today, one of them silently. So it is gated on isinstance(p.annotation, str), and the hints come from the object inspect.signature read. ## Changes 11 files, +447 / -21. Two production files: - common/compile.py — resolve a source annotation, convert a float attr against its declared type, and give every conversion the one actionable message, which now names the annotation. - deploy/codegen.py — accept str and float as shape attributes: InferShapeGeImpl reads them with GetStr / GetFloat into a std::string / float for the pybind wrapper that calls the author's infer_shape. All four AttrSpec kinds now reach it. Same issue as !6851; this adds the two cases that hunk regresses, the deploy half, and tests that separate the three trees. ## Verification of the original published revision 42 cases on 4 interpreters, 3.9 to 3.13: **0 lost**, 6 fixed on each and a 7th from 3.11 up. Both UT suites pass with nothing lost by name, 557 to 578. The new assertions fail 4 on the unpatched package and 6 on !6851's hunk; the emitted InferShapeGeImpl and its wrapper are pinned whole by goldens, which cannot even be built on the base tree. On a 910B3 box with CANN 9.2.0, from a fresh build_ci.py install: an op whose output width is picked by a String attribute builds its .so, reaches ATC run success, and GE records output 0: shape:[1,8,1,32] for a [1,8,1,64] input — the attribute's answer, not the C++ default. The same artifact on the base tools/ tree fails at codegen.py:828. ## Current publication update Corrects stale supported-attribute descriptions and emits compilable integral Float defaults such as 1.0f. Single commit in this update: - a2e8c48e7f4c — fix(exported_custom_op): Resolve postponed infer_shape annotations and accept String and Float shape attr This is a history-only squash of the previously published head a18ca0198b5f. The final source tree and the PR's own aggregate diff are unchanged; no dependency changes are included. The exact outgoing source tree passed 145 focused host cases, with zero failures or skips. The squashed commit has the same final source tree as the tested revision; these results are reused by exact tree identity, not reported as a fresh test run. Applicable configured local checks passed. The agent-backed log hook was skipped; the retained manual log review is unchanged. The wider local scanner is not a server CodeCheck result. Combined wave-0 nested and String/Float ATC receipts passed on the recorded CANN 9.3.0 snapshot with core 00b22b75…. That core predates the current target. These receipts do not establish current-target compiled-core or merge qualification. Required server CI/CodeCheck and current-target integration remain merge gates. The actual generated Float declaration also passed all seven compiler probes, including the integral default. Related Issues: [#3525](https://gitcode.com/cann/pypto/issues/3525) See merge request: cann/pypto!6886 | 1 month ago |