Repository navigation
Conversation
Adds GatherZeroDimsLayerTestCPU with four instantiations exercising Gather where the data or the indices tensor has a zero dim, across negative and positive axis, const and parameter indices, and static and dynamic input shapes. The expected values follow the Gather spec: empty indices produce an empty output, and a gather from an empty axis is an out-of-range index, so the output is zero-filled.
Skip kernel setup for static Gather nodes with empty data/output; the setup divided by those sizes and crashed with SIGFPE. An empty gathered axis with non-empty output now runs and zero-fills the output (all indices out of range, zeros per Gather-8 spec) instead of returning an unfilled buffer.
ReshapeLayerTest and SqueezeUnsqueezeLayerTest cases where the target shape has a literal 0 dim and the output is statically empty.
The static reshape path builds the primitive from cldnn::tensor, where a 0 dim means "copy from input" and cannot describe an empty output. Send statically empty outputs to the new shape-infer path instead.
With suppress_errors=False, several plain-graph cases (strided slice, diagonal with offset or negative dims) raise IndexError while Dynamo builds guards after the openvino backend returns. The harness default suppress_errors=True hides this behind a silent eager fallback.
fx_openvino re-traces the Dynamo graph with make_fx(tracing_mode="fake"), which reuses Dynamo's live ShapeEnv and appends sourceless guards Dynamo cannot build later. Wrap the re-trace in torch._guards.tracing(None) so make_fx runs without recording guards.
Diagonal over fixed and negative dim pairs, non-zero offsets, dynamic shapes and traced graphs, on float32/int64/bool inputs, including an empty-dimension input.
Move dim1 and dim2 to the end, flatten them, and gather the diagonal's flat positions. Handles offset, negative dims, and zero-sized dims. Registered for TorchScript and FX tables; marked supported in the torch.compile op-support list.
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.
Adds aten::diagonal converter (TorchScript, torch.export, torch.compile); it decomposes to transpose/reshape + one Gather, handles negative/reversed dims, offsets, empty shapes, unknown rank.
The empty-result shapes needed for testing exposed four plugin bugs, each committed as failing test + fix.
Details:
src/plugins/intel_cpu/tests/functional/custom/single_layer_tests/gather.cpp: Adds GatherZeroDimsLayerTestCPU, 4 suites covering zero-sized-dim Gather. Currently SIGFPE (signal: floating-point exception) on static empty inputs, unfilled output on empty gathered axis.src/plugins/intel_cpu/src/nodes/gather.cpp: Fixes zero-sized-dim Gather. Skips JIT setup for static empty inputs (SIGFPE), lets empty-gathered-axis run with zero-filled output per spec, instead of unfilled garbage.src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/reshape.cpp: Addssmoke_ReshapeZeroDimsandsmoke_ReshapeZeroDimsSpecialZeroCPU/GPU instantiations for static zero-sized output.src/plugins/intel_gpu/tests/functional/shared_tests_instances/single_layer_tests/squeeze_unsqueeze.cpp: Addssmoke_ZeroDimsandsmoke_ZeroDims_emptyAxesinstantiations for Squeeze/Unsqueeze to a zero-sized output.src/plugins/intel_gpu/src/plugin/ops/reshape.cpp: Addsempty_static_outputcheck so static zero-sized output goes through the legacy path.src/bindings/python/tests/test_torchdynamo_backend.py: Regression test (5 cases) that the "openvino" backend doesn't break Dynamo guards with suppress_errors=False.src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/backend.py: Wraps the make_fx re-trace in torch._guards.tracing(None) so it records no sourceless guards.tests/layer_tests/pytorch_tests/test_diagonal.py: Layer tests for torch.diagonal across shapes, offsets, negative dims, dtypes, dynamic shapes, traced graphs, empty input.src/frontends/pytorch/src/op/diagonal.cpp: New converter: move dim1/dim2 last, flatten, gather diagonal positions at n2+1 stride.src/frontends/pytorch/src/op_table.cpp: Registers aten::diagonal to the new converter (TorchScript table; FX table inherits).src/bindings/python/src/openvino/frontend/pytorch/torchdynamo/op_support.py: Marks torch.ops.aten.diagonal.default as supported for torch.compile.Tickets:
AI Assistance: