Skip to content

Wrap MPS(Graph) neural network primitives#854

Merged
maleadt merged 6 commits into
mainfrom
tb/conv
Jun 22, 2026
Merged

Wrap MPS(Graph) neural network primitives#854
maleadt merged 6 commits into
mainfrom
tb/conv

Conversation

@maleadt

@maleadt maleadt commented Jun 22, 2026

Copy link
Copy Markdown
Member

Closes #210
Interfaced with from FluxML/NNlib.jl#725

@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: 6e659a4 Previous: a9f57f4 Ratio
array/accumulate/Float32/1d 826917 ns 844374.5 ns 0.98
array/accumulate/Float32/dims=1 985833 ns 984417 ns 1.00
array/accumulate/Float32/dims=1L 8595750 ns 8591521 ns 1.00
array/accumulate/Float32/dims=2 1274041 ns 1271459 ns 1.00
array/accumulate/Float32/dims=2L 4020250.5 ns 4014000 ns 1.00
array/accumulate/Int64/1d 906750 ns 884917 ns 1.02
array/accumulate/Int64/dims=1 1133250 ns 1130979.5 ns 1.00
array/accumulate/Int64/dims=1L 9578396 ns 9575500 ns 1.00
array/accumulate/Int64/dims=2 1457000 ns 1454666 ns 1.00
array/accumulate/Int64/dims=2L 6591875.5 ns 6576584 ns 1.00
array/broadcast 368125 ns 363500 ns 1.01
array/construct 3292 ns 3375 ns 0.98
array/permutedims/2d 631666 ns 598833 ns 1.05
array/permutedims/3d 1088854.5 ns 1082917 ns 1.01
array/permutedims/4d 1808354 ns 1640708 ns 1.10
array/private/copy 418791 ns 412812.5 ns 1.01
array/private/copyto!/cpu_to_gpu 384291 ns 339959 ns 1.13
array/private/copyto!/gpu_to_cpu 382666 ns 381834 ns 1.00
array/private/copyto!/gpu_to_gpu 357000 ns 356709 ns 1.00
array/private/iteration/findall/bool 1117187.5 ns 1126666 ns 0.99
array/private/iteration/findall/int 1280416.5 ns 1275208 ns 1.00
array/private/iteration/findfirst/bool 1412042 ns 1396875 ns 1.01
array/private/iteration/findfirst/int 1442042 ns 1429354 ns 1.01
array/private/iteration/findmin/1d 1575333 ns 1570583.5 ns 1.00
array/private/iteration/findmin/2d 1268125 ns 1253666 ns 1.01
array/private/iteration/logical 1829083 ns 1816000 ns 1.01
array/private/iteration/scalar 2793083 ns 2845542 ns 0.98
array/random/rand/Float32 615959 ns 610125 ns 1.01
array/random/rand/Int64 631042 ns 629209 ns 1.00
array/random/rand!/Float32 530541 ns 524583 ns 1.01
array/random/rand!/Int64 494667 ns 493959 ns 1.00
array/random/randn/Float32 575625 ns 568291 ns 1.01
array/random/randn!/Float32 479083.5 ns 477917 ns 1.00
array/reductions/mapreduce/Float32/1d 702833 ns 703625 ns 1.00
array/reductions/mapreduce/Float32/dims=1 482625 ns 481209 ns 1.00
array/reductions/mapreduce/Float32/dims=1L 687667 ns 686666 ns 1.00
array/reductions/mapreduce/Float32/dims=2 494875 ns 491000 ns 1.01
array/reductions/mapreduce/Float32/dims=2L 1285645.5 ns 1281250 ns 1.00
array/reductions/mapreduce/Int64/1d 896875 ns 892979 ns 1.00
array/reductions/mapreduce/Int64/dims=1 772937.5 ns 773083 ns 1.00
array/reductions/mapreduce/Int64/dims=1L 1083541 ns 1085417 ns 1.00
array/reductions/mapreduce/Int64/dims=2 932667 ns 925083 ns 1.01
array/reductions/mapreduce/Int64/dims=2L 2177020.5 ns 2169417 ns 1.00
array/reductions/reduce/Float32/1d 686459 ns 698125 ns 0.98
array/reductions/reduce/Float32/dims=1 480583 ns 480167 ns 1.00
array/reductions/reduce/Float32/dims=1L 686145.5 ns 686166 ns 1.00
array/reductions/reduce/Float32/dims=2 495042 ns 488625 ns 1.01
array/reductions/reduce/Float32/dims=2L 1284791 ns 1275417 ns 1.01
array/reductions/reduce/Int64/1d 894583 ns 894541.5 ns 1.00
array/reductions/reduce/Int64/dims=1 773625 ns 772250 ns 1.00
array/reductions/reduce/Int64/dims=1L 1078895.5 ns 1078708 ns 1.00
array/reductions/reduce/Int64/dims=2 932500 ns 927375 ns 1.01
array/reductions/reduce/Int64/dims=2L 2156084 ns 2149500 ns 1.00
array/shared/copy 152750 ns 153083 ns 1.00
array/shared/copyto!/cpu_to_gpu 39916 ns 40250 ns 0.99
array/shared/copyto!/gpu_to_cpu 40000 ns 39500 ns 1.01
array/shared/copyto!/gpu_to_gpu 40583 ns 40792 ns 0.99
array/shared/iteration/findall/bool 1121083 ns 1117167 ns 1.00
array/shared/iteration/findall/int 1285166 ns 1278417 ns 1.01
array/shared/iteration/findfirst/bool 1119542 ns 1114417 ns 1.00
array/shared/iteration/findfirst/int 1154417 ns 1142479.5 ns 1.01
array/shared/iteration/findmin/1d 1305042 ns 1294500 ns 1.01
array/shared/iteration/findmin/2d 1273500 ns 1276333 ns 1.00
array/shared/iteration/logical 1647000 ns 1640958 ns 1.00
array/shared/iteration/scalar 3526 ns 3453.125 ns 1.02
integration/byval/reference 1139833 ns 1144334 ns 1.00
integration/byval/slices=1 1134500 ns 1136833 ns 1.00
integration/byval/slices=2 2048895.5 ns 2052958 ns 1.00
integration/byval/slices=3 7152417 ns 7070625 ns 1.01
integration/metaldevrt 441125 ns 437125 ns 1.01
kernel/indexing 357333 ns 356542 ns 1.00
kernel/indexing_checked 531208 ns 530458 ns 1.00
kernel/launch 1954.2 ns 1966.7 ns 0.99
kernel/rand 529625 ns 519917 ns 1.02
latency/import 1852920959 ns 1855549750 ns 1.00
latency/precompile 36991825854 ns 36949704062.5 ns 1.00
latency/ttfp 2069514833 ns 2075329333 ns 1.00
metal/synchronization/context 535.15625 ns 519.4300518134716 ns 1.03
metal/synchronization/stream 275.7936507936508 ns 275.4182389937107 ns 1.00

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

@codecov

codecov Bot commented Jun 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 99.29577% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.75%. Comparing base (eed9d53) to head (6e659a4).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
lib/mpsgraphs/nn.jl 99.29% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #854      +/-   ##
==========================================
+ Coverage   84.38%   85.75%   +1.36%     
==========================================
  Files          70       71       +1     
  Lines        4196     4478     +282     
==========================================
+ Hits         3541     3840     +299     
+ Misses        655      638      -17     

☔ 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 c9ea8b1 into main Jun 22, 2026
1 check failed
@maleadt maleadt deleted the tb/conv branch June 22, 2026 10:00
@christiangnrd

Copy link
Copy Markdown
Member

Supersedes #745?

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.

MPS - Support for Convolutional Neural Network kernels

2 participants