Skip to content

Fix HabanaProfile unit tests to align with idempotent start behavior#2258

Merged
astachowiczhabana merged 1 commit intohuggingface:v1.20-releasefrom
HabanaAI:dev/gplutop7/fix_profiler
Sep 15, 2025
Merged

Fix HabanaProfile unit tests to align with idempotent start behavior#2258
astachowiczhabana merged 1 commit intohuggingface:v1.20-releasefrom
HabanaAI:dev/gplutop7/fix_profiler

Conversation

@astachowiczhabana
Copy link
Collaborator

This pull request updates the Habana profiler unit tests to reflect changes in how multiple profiler instances are managed. The most important changes include switching from a list to a WeakSet for tracking profiler instances and updating test logic to match the new behavior where starting a new profiler stops any previous one.

Profiler instance management:

  • Changed the storage of active profiler instances in HabanaProfile._profilers from a list to a weakref.WeakSet to better manage memory and object lifecycle. [1] [2]

Test behavior updates:

  • Updated the test to verify that starting a new profiler automatically stops the previous one, rather than raising an error. The test now asserts the running state of both profilers.

@astachowiczhabana astachowiczhabana merged commit 00d7f46 into huggingface:v1.20-release Sep 15, 2025
astachowiczhabana added a commit that referenced this pull request Sep 17, 2025
…2258)

Co-authored-by: Adam Stachowicz <astachow@habana.ai>
gplutop7 pushed a commit to HabanaAI/optimum-habana-fork that referenced this pull request Oct 15, 2025
…uggingface#2258) (huggingface#683)

Co-authored-by: Adam Stachowicz <105052242+astachowiczhabana@users.noreply.github.com>
Co-authored-by: Adam Stachowicz <astachow@habana.ai>
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