Skip to content

Add NeuronDevices type and sysfs-based device discovery - #4919

Merged
amogh09 merged 1 commit into
aws:devfrom
amogh09:neuron-devices
Apr 8, 2026
Merged

amogh09 merged 1 commit into
aws:devfrom
amogh09:neuron-devices

Conversation

@amogh09

@amogh09 amogh09 commented Apr 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add device-level Neuron discovery in the shared neuron utils package.

Implementation details

  • NeuronDevices struct with DeviceByID() and DeviceIDs() methods in ecs-agent/utils/neuron/neuron.go
  • DiscoverDevices() in ecs-agent/utils/neuron/neuron_linux.go — enumerates /sys/class/neuron_device/neuron*, validates /dev/neuronX exists, skips non-numeric sysfs entries

Testing

  • Unit tests for DiscoverDevices(): no devices, single device, multiple devices, missing device file, non-device sysfs entries
  • Unit tests for NeuronDevices methods: DeviceIDs() (nil, empty, populated), DeviceByID() (found, not found)

New tests cover the changes: yes

Description for the changelog

Enhancement - Add device-level Neuron discovery utils to shared library

Additional Information

Does this PR include breaking model changes? If so, Have you added transformation functions?
No

Does this PR include the addition of new environment variables in the README?
No

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@amogh09
amogh09 requested a review from a team as a code owner April 7, 2026 23:13
Comment thread ecs-agent/utils/neuron/neuron_linux.go Resolved
@amogh09 amogh09 added bot/test and removed bot/test labels Apr 8, 2026
@pengubco
pengubco self-requested a review April 8, 2026 17:12
pengubco
pengubco previously approved these changes Apr 8, 2026
Add device-level discovery alongside existing core-based discovery
in the shared neuron utils package. This supports the pivot from
neuron cores to neuron devices as the resource unit for ECS
Managed Instances.

- NeuronDevices struct with DeviceByID() and DeviceIDs() methods
- DiscoverDevices() enumerates /sys/class/neuron_device/neuron*,
  validates /dev/neuronX exists, skips non-numeric entries
- Tests for discovery, missing device files, non-device sysfs entries
- Existing core-based types and functions are unchanged

@pengubco pengubco left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor change.

Comment thread ecs-agent/utils/neuron/neuron_linux.go Resolved
Comment thread ecs-agent/utils/neuron/neuron_linux.go Resolved
@amogh09
amogh09 merged commit ff3afcf into aws:dev Apr 8, 2026
44 checks passed
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.

5 participants