Skip to content

Add atomic fences for Metal 3.2+#875

Merged
christiangnrd merged 1 commit into
mainfrom
fences
Jul 17, 2026
Merged

Add atomic fences for Metal 3.2+#875
christiangnrd merged 1 commit into
mainfrom
fences

Conversation

@christiangnrd

@christiangnrd christiangnrd commented Jul 16, 2026

Copy link
Copy Markdown
Member

This is the fence part of #870.

Probably needs better tests since this only checks that things aren't loudly failing and atomic stuff doesn't seem to be validated anywhere other than the compiler we bypass

@github-actions github-actions Bot 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.

Metal Benchmarks

Details
Benchmark suite Current: 997fa62 Previous: ac0202d Ratio
array/accumulate/Float32/1d 419125 ns 407375 ns 1.03
array/accumulate/Float32/dims=1 394208 ns 351791 ns 1.12
array/accumulate/Float32/dims=1L 8881334 ns 8796584 ns 1.01
array/accumulate/Float32/dims=2 433708 ns 439792 ns 0.99
array/accumulate/Float32/dims=2L 2377459 ns 2603208 ns 0.91
array/accumulate/Int64/1d 878291 ns 842333 ns 1.04
array/accumulate/Int64/dims=1 950833 ns 944125 ns 1.01
array/accumulate/Int64/dims=1L 9680167 ns 9521000 ns 1.02
array/accumulate/Int64/dims=2 948250 ns 1247208 ns 0.76
array/accumulate/Int64/dims=2L 6758667 ns 6499125 ns 1.04
array/broadcast 191000 ns 222000 ns 0.86
array/construct 2416 ns 2417 ns 1.00
array/permutedims/2d 461375 ns 449458 ns 1.03
array/permutedims/3d 701875 ns 1011000 ns 0.69
array/permutedims/4d 1034500 ns 1275416 ns 0.81
array/private/copy 244542 ns 229791 ns 1.06
array/private/copyto!/cpu_to_gpu 200875 ns 195833 ns 1.03
array/private/copyto!/gpu_to_cpu 206167 ns 194167 ns 1.06
array/private/copyto!/gpu_to_gpu 182709 ns 173708 ns 1.05
array/private/iteration/findall/bool 1126416 ns 1057250 ns 1.07
array/private/iteration/findall/int 1252666 ns 1228125 ns 1.02
array/private/iteration/findfirst/bool 1095042 ns 1111542 ns 0.99
array/private/iteration/findfirst/int 1112000 ns 1117792 ns 0.99
array/private/iteration/findmin/1d 1276542 ns 1229625 ns 1.04
array/private/iteration/findmin/2d 977541 ns 769709 ns 1.27
array/private/iteration/logical 1743166 ns 1688959 ns 1.03
array/private/iteration/scalar 1199125 ns 1216958 ns 0.99
array/random/rand/Float32 438875 ns 426125 ns 1.03
array/random/rand/Int64 543917 ns 513417 ns 1.06
array/random/rand!/Float32 371958 ns 313042 ns 1.19
array/random/rand!/Int64 327167 ns 406791 ns 0.80
array/random/randn/Float32 371583 ns 391833 ns 0.95
array/random/randn!/Float32 334250 ns 340208 ns 0.98
array/reductions/mapreduce/Float32/1d 391541 ns 383792 ns 1.02
array/reductions/mapreduce/Float32/dims=1 325667 ns 263000 ns 1.24
array/reductions/mapreduce/Float32/dims=1L 638792 ns 621791 ns 1.03
array/reductions/mapreduce/Float32/dims=2 328875 ns 275708 ns 1.19
array/reductions/mapreduce/Float32/dims=2L 781042 ns 841125 ns 0.93
array/reductions/mapreduce/Int64/1d 588958 ns 621125 ns 0.95
array/reductions/mapreduce/Int64/dims=1 547875 ns 450958 ns 1.21
array/reductions/mapreduce/Int64/dims=1L 1051917 ns 1026500 ns 1.02
array/reductions/mapreduce/Int64/dims=2 514333 ns 778292 ns 0.66
array/reductions/mapreduce/Int64/dims=2L 2162167 ns 2179166 ns 0.99
array/reductions/reduce/Float32/1d 387584 ns 412916 ns 0.94
array/reductions/reduce/Float32/dims=1 281125 ns 345084 ns 0.81
array/reductions/reduce/Float32/dims=1L 642250 ns 635167 ns 1.01
array/reductions/reduce/Float32/dims=2 202000 ns 228750 ns 0.88
array/reductions/reduce/Float32/dims=2L 442084 ns 448708 ns 0.99
array/reductions/reduce/Int64/1d 580667 ns 576542 ns 1.01
array/reductions/reduce/Int64/dims=1 543625 ns 614541 ns 0.88
array/reductions/reduce/Int64/dims=1L 1036042 ns 1030125 ns 1.01
array/reductions/reduce/Int64/dims=2 227916 ns 240250 ns 0.95
array/reductions/reduce/Int64/dims=2L 633084 ns 644833 ns 0.98
array/shared/copy 143250 ns 136583 ns 1.05
array/shared/copyto!/cpu_to_gpu 37625 ns 38292 ns 0.98
array/shared/copyto!/gpu_to_cpu 37083 ns 38167 ns 0.97
array/shared/copyto!/gpu_to_gpu 38208 ns 38917 ns 0.98
array/shared/iteration/findall/bool 1137542 ns 1076292 ns 1.06
array/shared/iteration/findall/int 1143958 ns 1220458 ns 0.94
array/shared/iteration/findfirst/bool 782166 ns 956459 ns 0.82
array/shared/iteration/findfirst/int 754625 ns 650041 ns 1.16
array/shared/iteration/findmin/1d 959375 ns 1089541 ns 0.88
array/shared/iteration/findmin/2d 1022458 ns 1075500 ns 0.95
array/shared/iteration/logical 1517292 ns 1553459 ns 0.98
array/shared/iteration/scalar 3953.125 ns 4023.714285714286 ns 0.98
array/sorting/1d 1858459 ns 1786083 ns 1.04
array/sorting/2d 8326292 ns 8305833 ns 1.00
integration/byval/reference 1103167 ns 1119042 ns 0.99
integration/byval/slices=1 1106625 ns 1109583 ns 1.00
integration/byval/slices=2 2039500 ns 2021291 ns 1.01
integration/byval/slices=3 14466792 ns 6610875 ns 2.19
integration/metaldevrt 309250 ns 379833 ns 0.81
kernel/indexing 173500 ns 208708 ns 0.83
kernel/indexing_checked 367375 ns 370667 ns 0.99
kernel/launch 1908.3 ns 1883.3 ns 1.01
kernel/rand 341709 ns 393792 ns 0.87
latency/import 2065032584 ns 2038510291 ns 1.01
latency/precompile 39245643708 ns 38792921333 ns 1.01
latency/ttfp 2405619625 ns 2354706125 ns 1.02
metal/synchronization/context 578.775956284153 ns 583.7912087912088 ns 0.99
metal/synchronization/stream 328.3333333333333 ns 332.58744394618833 ns 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.93%. Comparing base (ac0202d) to head (997fa62).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #875      +/-   ##
==========================================
- Coverage   86.21%   85.93%   -0.29%     
==========================================
  Files          76       76              
  Lines        5246     5246              
==========================================
- Hits         4523     4508      -15     
- Misses        723      738      +15     

☔ 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.

Co-Authored-By: Tim Besard <383068+maleadt@users.noreply.github.com>
@christiangnrd
christiangnrd merged commit bc55410 into main Jul 17, 2026
19 checks passed
@christiangnrd
christiangnrd deleted the fences branch July 17, 2026 22:35
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