Skip to content

Thread safety fixes - #3229

Merged
maleadt merged 2 commits into
mainfrom
tb/threadsafety
Aug 12, 2026
Merged

maleadt merged 2 commits into
mainfrom
tb/threadsafety

Conversation

@maleadt

@maleadt maleadt commented Aug 11, 2026

Copy link
Copy Markdown
Member

Counterpart of JuliaGPU/OpenCL.jl#472

Argument conversion used to migrate stream ownership and mark allocations dirty before any matching launch was submitted, so another task could take ownership between conversion and enqueue and leave later work invisible to synchronization. Make conversion metadata-pure while collecting each reached Managed allocation into KernelCall, then deduplicate and lock those allocations in stable lock-object order, transfer ownership to the actual launch stream, and hold the locks through backend submission. Host conversion, explicit synchronization, unified-memory prefetch, and pool return participate in the same per-allocation protocol.
Reflection and direct callers can bypass cufunction_lock, so concurrent cache misses could construct duplicate configurations and mutate the shared Dict at the same time. Serialize only the lookup, configuration construction, and insertion with a dedicated reentrant lock and use get! for the atomic cache operation.
@codecov

codecov Bot commented Aug 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.27%. Comparing base (361a8d0) to head (b84da49).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3229      +/-   ##
==========================================
+ Coverage   92.19%   92.27%   +0.08%     
==========================================
  Files         184      184              
  Lines       15903    15903              
==========================================
+ Hits        14661    14674      +13     
+ Misses       1242     1229      -13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@maleadt
maleadt merged commit e5fd063 into main Aug 12, 2026
1 check passed
@maleadt
maleadt deleted the tb/threadsafety branch August 12, 2026 13:02
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