Skip to content

Fix findall output type #587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2025
Merged

Fix findall output type #587

merged 1 commit into from
Apr 26, 2025

Conversation

christiangnrd
Copy link
Member

Might as well fix it now and the new test will stay relevant.

Close #578

Copy link
Contributor

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/test/array.jl b/test/array.jl
index 12b844a4..f1934a7d 100644
--- a/test/array.jl
+++ b/test/array.jl
@@ -526,12 +526,12 @@ end
     @test testf(x->findall(x), rand(Bool, 1000))
     @test testf(x->findall(y->y>Float32(0.5), x), rand(Float32,1000))
 
-    # Set storage mode to a different one than the default
-    let storage=Metal.DefaultStorageMode == Metal.PrivateStorage ? Metal.SharedStorage : Metal.PrivateStorage
-        x = mtl(rand(Float32,100); storage)
-        out = findall(y->y>Float32(0.5), x)
-        @test Metal.storagemode(x) == Metal.storagemode(out)
-    end
+        # Set storage mode to a different one than the default
+        let storage = Metal.DefaultStorageMode == Metal.PrivateStorage ? Metal.SharedStorage : Metal.PrivateStorage
+            x = mtl(rand(Float32, 100); storage)
+            out = findall(y -> y > Float32(0.5), x)
+            @test Metal.storagemode(x) == Metal.storagemode(out)
+        end
 
     # ND
     let x = rand(Bool, 1000, 1000)

Copy link

codecov bot commented Apr 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.71%. Comparing base (987264c) to head (313e853).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #587   +/-   ##
=======================================
  Coverage   80.71%   80.71%           
=======================================
  Files          61       61           
  Lines        2676     2676           
=======================================
  Hits         2160     2160           
  Misses        516      516           

☔ View full report in Codecov by Sentry.
📢 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.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metal Benchmarks

Benchmark suite Current: 313e853 Previous: 987264c Ratio
private array/construct 24701.333333333332 ns 24791.666666666668 ns 1.00
private array/broadcast 463792 ns 463917 ns 1.00
private array/random/randn/Float32 761854 ns 816625 ns 0.93
private array/random/randn!/Float32 636250 ns 634292 ns 1.00
private array/random/rand!/Int64 571083 ns 583750 ns 0.98
private array/random/rand!/Float32 602458.5 ns 606520.5 ns 0.99
private array/random/rand/Int64 741562.5 ns 772104.5 ns 0.96
private array/random/rand/Float32 620792 ns 608125 ns 1.02
private array/copyto!/gpu_to_gpu 668416 ns 671354.5 ns 1.00
private array/copyto!/cpu_to_gpu 589791.5 ns 688875 ns 0.86
private array/copyto!/gpu_to_cpu 799000 ns 830666 ns 0.96
private array/accumulate/1d 1348208 ns 1348687 ns 1.00
private array/accumulate/2d 1389104 ns 1396250.5 ns 0.99
private array/iteration/findall/int 2106750 ns 2096875.5 ns 1.00
private array/iteration/findall/bool 1840667 ns 1841771 ns 1.00
private array/iteration/findfirst/int 1706666.5 ns 1711020.5 ns 1.00
private array/iteration/findfirst/bool 1670250 ns 1670687 ns 1.00
private array/iteration/scalar 3536000 ns 3982188 ns 0.89
private array/iteration/logical 3202771 ns 3211250 ns 1.00
private array/iteration/findmin/1d 1764625 ns 1767771 ns 1.00
private array/iteration/findmin/2d 1358687 ns 1354709 ns 1.00
private array/reductions/reduce/1d 1042937.5 ns 1049792 ns 0.99
private array/reductions/reduce/2d 666042 ns 671895.5 ns 0.99
private array/reductions/mapreduce/1d 1032584 ns 1052084 ns 0.98
private array/reductions/mapreduce/2d 661750 ns 666875 ns 0.99
private array/permutedims/4d 2530875 ns 2528125 ns 1.00
private array/permutedims/2d 1022167 ns 1025937.5 ns 1.00
private array/permutedims/3d 1573375 ns 1580958 ns 1.00
private array/copy 546958 ns 591625 ns 0.92
latency/precompile 9799567750 ns 9739659292 ns 1.01
latency/ttfp 4094895583 ns 3741470917 ns 1.09
latency/import 1279387563 ns 1262158250 ns 1.01
integration/metaldevrt 724667 ns 731437.5 ns 0.99
integration/byval/slices=1 1582750 ns 1601250 ns 0.99
integration/byval/slices=3 8931291.5 ns 9288917 ns 0.96
integration/byval/reference 1589104.5 ns 1623083.5 ns 0.98
integration/byval/slices=2 2581750 ns 2532250 ns 1.02
kernel/indexing 458021 ns 495125 ns 0.93
kernel/indexing_checked 459770.5 ns 491500 ns 0.94
kernel/launch 36000 ns 7917 ns 4.55
metal/synchronization/stream 14667 ns 14750 ns 0.99
metal/synchronization/context 15167 ns 15125 ns 1.00
shared array/construct 23885.416666666664 ns 23781.25 ns 1.00
shared array/broadcast 464166 ns 465500 ns 1.00
shared array/random/randn/Float32 806583 ns 776479 ns 1.04
shared array/random/randn!/Float32 644292 ns 636625 ns 1.01
shared array/random/rand!/Int64 575416 ns 577375 ns 1.00
shared array/random/rand!/Float32 605583 ns 599479.5 ns 1.01
shared array/random/rand/Int64 763917 ns 776104 ns 0.98
shared array/random/rand/Float32 607625 ns 614604.5 ns 0.99
shared array/copyto!/gpu_to_gpu 79167 ns 81333 ns 0.97
shared array/copyto!/cpu_to_gpu 78167 ns 83250 ns 0.94
shared array/copyto!/gpu_to_cpu 78250 ns 84375 ns 0.93
shared array/accumulate/1d 1356541 ns 1359459 ns 1.00
shared array/accumulate/2d 1387083.5 ns 1400166.5 ns 0.99
shared array/iteration/findall/int 1848521 ns 1859250 ns 0.99
shared array/iteration/findall/bool 1599417 ns 1606625 ns 1.00
shared array/iteration/findfirst/int 1405583 ns 1401520.5 ns 1.00
shared array/iteration/findfirst/bool 1380187.5 ns 1376083 ns 1.00
shared array/iteration/scalar 160959 ns 159416 ns 1.01
shared array/iteration/logical 2907208 ns 3013646 ns 0.96
shared array/iteration/findmin/1d 1472812.5 ns 1472500 ns 1.00
shared array/iteration/findmin/2d 1369792 ns 1367583 ns 1.00
shared array/reductions/reduce/1d 723209 ns 731250 ns 0.99
shared array/reductions/reduce/2d 669562.5 ns 668667 ns 1.00
shared array/reductions/mapreduce/1d 748583 ns 751417 ns 1.00
shared array/reductions/mapreduce/2d 671583 ns 661083 ns 1.02
shared array/permutedims/4d 2551375 ns 2441917 ns 1.04
shared array/permutedims/2d 1030729.5 ns 1022416.5 ns 1.01
shared array/permutedims/3d 1593354 ns 1589437 ns 1.00
shared array/copy 249792 ns 253104 ns 0.99

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

@christiangnrd christiangnrd merged commit 30432ce into main Apr 26, 2025
7 checks passed
@christiangnrd christiangnrd deleted the findall branch April 26, 2025 13:48
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.

findall output always uses default storage mode instead of matching input storage mode
2 participants