-
Notifications
You must be signed in to change notification settings - Fork 857
Description
🐛 Describe the bug
The #17096 introduced a regression to the way how the Ethos-U55 limits are checked for the select/select_copy.
The update switches from checking the output shape of the select_copy (correct) to checking the input shape (incorrect). This makes a differences as the output shape is always smaller rank than the input. For example, for the [6, 1, 64, 4, 96] input, the aten.select_copy.int(tensor, dim, index) with dim = 0 and index = i produces [1, 64, 4, 96] output. This regression results in the select_copy not being delegated to NPU as expected. Checking the both input and output shape makes sense for other operators like view_copy as it could need transposes on either sides.
Also, the original code was rejecting only when dtype in torch.int8 and torch.int16, while the new code applies to all dtypes unconditionally when rank > 4. I don't understand the reason for the original code, so not sure it is correct to skip dtype check.
The original is_node_supported():
if node.target in (
exir_ops.edge.aten.select.int,
exir_ops.edge.aten.select_copy.int,
):
input_node, dim, index = cast(tuple[fx.Node, int, int], node.args)
shape = input_node.meta["val"].shape # [6, 1, 64, 4, 96]
dim = dim % len(shape) # 0
# Shape after squeeze — the ACTUAL tensor that flows forward
# and may need a transpose for channels-last conversion.
squeezed_shape = shape[:dim] + shape[dim + 1 :]
shape = squeezed_shape # [1, 64, 4, 96]
# ... later:
if dtype in (torch.int8, torch.int16):
if self.axes_product(shape) > 65536: # 24,576 > 65,536? No, the check passed -> delegated to NPU
return False
return True
And after the PR:
# The select-specific branch was DELETED. All ops now use this generic path:
shape = list(get_first_fake_tensor(node).shape) # output: [1, 64, 4, 96]
input_shape = list(get_first_fake_tensor(node.all_input_nodes[0]).shape) # [6, 1, 64, 4, 96]
input_rank = len(input_shape) # 5
# First check — _check_rank_constraints:
if input_rank > 4:
if self.axes_product(input_shape) > self._MAX_AXIS_PRODUCT:
# product([6, 1, 64, 4, 96]) = 147,456
# 147,456 > 65,536? The check fails, so NOT delegated to NPU
self.reporter.report_reject(node, "Input may require transpose...")
return False
Versions
Collecting environment information...
PyTorch version: 2.12.0.dev20260222+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: Ubuntu 24.04.4 LTS (x86_64)
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Clang version: Could not collect
CMake version: version 3.31.10
Libc version: glibc-2.39
Python version: 3.12.3 (main, Jan 22 2026, 20:57:42) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-6.17.0-14-generic-x86_64-with-glibc2.39
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Caching allocator config: N/A
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 42 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 8
On-line CPU(s) list: 0-7
Vendor ID: GenuineIntel
Model name: Intel(R) Core(TM) Ultra 7 258V
CPU family: 6
Model: 189
Thread(s) per core: 1
Core(s) per socket: 8
Socket(s): 1
Stepping: 1
CPU(s) scaling MHz: 27%
CPU max MHz: 4800.0000
CPU min MHz: 400.0000
BogoMIPS: 6604.80
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdt_a rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni lam wbnoinvd dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid bus_lock_detect movdiri movdir64b fsrm md_clear serialize pconfig arch_lbr ibt flush_l1d arch_capabilities
Virtualization: VT-x
L1d cache: 320 KiB (8 instances)
L1i cache: 512 KiB (8 instances)
L2 cache: 14 MiB (5 instances)
L3 cache: 12 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-7
Vulnerability Gather data sampling: Not affected
Vulnerability Ghostwrite: Not affected
Vulnerability Indirect target selection: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Old microcode: Not affected
Vulnerability Reg file data sampling: Not affected
Vulnerability Retbleed: Not affected
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; PBRSB-eIBRS Not affected; BHI BHI_DIS_S
Vulnerability Srbds: Not affected
Vulnerability Tsa: Not affected
Vulnerability Tsx async abort: Not affected
Vulnerability Vmscape: Mitigation; IBPB before exit to userspace
Versions of relevant libraries:
[pip3] executorch==1.2.0a0+a5423eb
[pip3] numpy==2.4.2
[pip3] pytorch_tokenizers==1.1.0
[pip3] torch==2.12.0.dev20260222+cpu
[pip3] torchao==0.16.0+git026b76d12
[pip3] torchaudio==2.11.0.dev20260222+cpu
[pip3] torchvision==0.26.0.dev20260222+cpu
[conda] Could not collect
@zingo @gggekov @AdrianLundell
cc @digantdesai @SS-JIA @freddan80 @per @zingo @oscarandersson8218 @mansnils @Sebastian-Larsson @robell