Skip to content

List the Neural Engine as npu on Apple silicon Macs - #102

Open
piotrekno1 wants to merge 1 commit into
develfrom
feat/apple-npu-accelerator
Open

piotrekno1 wants to merge 1 commit into
develfrom
feat/apple-npu-accelerator

Conversation

@piotrekno1

Copy link
Copy Markdown
Collaborator

Summary

Apple silicon Macs now list the Neural Engine as npu in the device's accelerators: ["cpu", "mps", "npu"] instead of ["cpu", "mps"].

The device's list was built as cpu plus whatever gpu_accelerators() found, so a Neural Engine could never appear. The Swift SDK already lists npu on Apple devices, and the Android SDK uses the same name.

  • wildedge.accelerators.NPU = "npu"
  • Platform.npu_accelerators(), empty by default. macOS returns ["npu"] on arm64, since every Apple silicon Mac has a Neural Engine.
  • gpu_accelerators() and gpu_accelerator_for_offload() are unchanged, so GPU offload detection isn't affected.

Related

Not covered

NPUs on other platforms (Intel, AMD and Qualcomm NPUs on Windows and Linux) are still not detected. Each needs its own probe, and no integration reports running on one yet.

Testing

  • New tests: macOS lists npu on arm64 only, other platforms list none, and an Apple silicon device's accelerators are ["cpu", "mps", "npu"].
  • Full suite: 920 passed. On an M2 Mac, detect_device() returns ['cpu', 'mps', 'npu'].

🤖 Generated with Claude Code

The device's accelerators only ever added GPUs to cpu, so an Apple silicon
Mac reported ["cpu", "mps"] and never its Neural Engine. The Swift SDK
lists npu on Apple devices.

Platforms get npu_accelerators(), empty by default, and macOS returns npu
on arm64. gpu_accelerators() is unchanged, so GPU offload detection is not
affected.
@github-actions

Copy link
Copy Markdown

Coverage report

  • Total: 90% (12194/13604 lines)

Top uncovered files

  • wildedge/integrations/transformers.py: 63.2% (111 lines missed)
  • wildedge/integrations/mlx.py: 43.0% (98 lines missed)
  • wildedge/integrations/ultralytics.py: 67.8% (84 lines missed)
  • wildedge/integrations/pytorch.py: 64.5% (70 lines missed)
  • wildedge/platforms/macos.py: 57.6% (67 lines missed)

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.

1 participant