-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Summary
Tensor.Destroy() currently acquires ortCallMu.Lock() (global write lock) in /Users/tazarov/GolandProjects/onnx-purego/ort/tensor.go.
This is correct for safety but stalls unrelated Session.Run() calls across all sessions while any tensor is being released.
Context
- File:
/Users/tazarov/GolandProjects/onnx-purego/ort/tensor.go - Current behavior is explicitly documented and TODO-marked in code.
- PR context: feat: implement pure-go tensor/session inference MVP (issues #3, #4) #37
Why this matters
In multi-session inference pipelines, batch/tensor rotation can cause avoidable global contention.
Proposed direction
- Design finer-grained lifetime tracking so releasing one tensor does not block unrelated in-flight runs.
- Keep environment teardown safety guarantees intact.
- Preserve pure-Go/no-CGO constraints.
Potential approaches:
- Per-handle active-use tracking (reference counters), or
- Session/value dependency tracking for targeted waits.
Acceptance criteria
- Tensor release no longer globally blocks unrelated session inference.
- Existing concurrency safety tests continue to pass.
- New regression tests demonstrate reduced cross-session contention without unsafe releases.
Notes
This is a performance/scalability follow-up, not a correctness blocker for MVP.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels