-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add error checking to command buffer completion handler #521
Conversation
Your PR no longer requires formatting changes. Thank you for your contribution! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #521 +/- ##
==========================================
+ Coverage 71.04% 75.32% +4.28%
==========================================
Files 36 57 +21
Lines 1143 2703 +1560
==========================================
+ Hits 812 2036 +1224
- Misses 331 667 +336 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this 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: 3c9c87a | Previous: 1b811cb | Ratio |
---|---|---|---|
private array/construct |
25461.833333333332 ns |
26482.666666666668 ns |
0.96 |
private array/broadcast |
462917 ns |
457584 ns |
1.01 |
private array/random/randn/Float32 |
799458.5 ns |
857895.5 ns |
0.93 |
private array/random/randn!/Float32 |
634083 ns |
657709 ns |
0.96 |
private array/random/rand!/Int64 |
567062.5 ns |
564458 ns |
1.00 |
private array/random/rand!/Float32 |
591791 ns |
610416 ns |
0.97 |
private array/random/rand/Int64 |
769520.5 ns |
805354 ns |
0.96 |
private array/random/rand/Float32 |
607271 ns |
602791.5 ns |
1.01 |
private array/copyto!/gpu_to_gpu |
666833 ns |
672437.5 ns |
0.99 |
private array/copyto!/cpu_to_gpu |
814833 ns |
635271 ns |
1.28 |
private array/copyto!/gpu_to_cpu |
613375 ns |
815104.5 ns |
0.75 |
private array/accumulate/1d |
1327375 ns |
1324625 ns |
1.00 |
private array/accumulate/2d |
1380978.5 ns |
1393666.5 ns |
0.99 |
private array/iteration/findall/int |
2109104.5 ns |
2070667 ns |
1.02 |
private array/iteration/findall/bool |
1803854 ns |
1827208 ns |
0.99 |
private array/iteration/findfirst/int |
1682875 ns |
1688333.5 ns |
1.00 |
private array/iteration/findfirst/bool |
1665584 ns |
1671750 ns |
1.00 |
private array/iteration/scalar |
3796333 ns |
3643750 ns |
1.04 |
private array/iteration/logical |
3186292 ns |
3166208 ns |
1.01 |
private array/iteration/findmin/1d |
1755604 ns |
1758542 ns |
1.00 |
private array/iteration/findmin/2d |
1344792 ns |
1357792 ns |
0.99 |
private array/reductions/reduce/1d |
1026604.5 ns |
1043270.5 ns |
0.98 |
private array/reductions/reduce/2d |
659417 ns |
663333 ns |
0.99 |
private array/reductions/mapreduce/1d |
1026395.5 ns |
1043084 ns |
0.98 |
private array/reductions/mapreduce/2d |
662709 ns |
665896 ns |
1.00 |
private array/permutedims/4d |
2528334 ns |
2529437.5 ns |
1.00 |
private array/permutedims/2d |
1016208 ns |
1024875 ns |
0.99 |
private array/permutedims/3d |
1575021 ns |
1585208 ns |
0.99 |
private array/copy |
590749.5 ns |
592958 ns |
1.00 |
latency/precompile |
5911672333 ns |
8799224667 ns |
0.67 |
latency/ttfp |
3460967895.5 ns |
3600655125 ns |
0.96 |
latency/import |
1125913500 ns |
1231127083 ns |
0.91 |
integration/metaldevrt |
710167 ns |
701416 ns |
1.01 |
integration/byval/slices=1 |
1564562.5 ns |
1566354 ns |
1.00 |
integration/byval/slices=3 |
8508104 ns |
10376042 ns |
0.82 |
integration/byval/reference |
1557000 ns |
1610875 ns |
0.97 |
integration/byval/slices=2 |
2533167 ns |
2715041 ns |
0.93 |
kernel/indexing |
482750 ns |
474291.5 ns |
1.02 |
kernel/indexing_checked |
481667 ns |
475895.5 ns |
1.01 |
kernel/launch |
37073 ns |
8208 ns |
4.52 |
metal/synchronization/stream |
14500 ns |
15041 ns |
0.96 |
metal/synchronization/context |
14667 ns |
15000 ns |
0.98 |
shared array/construct |
24409.666666666668 ns |
24145.833333333332 ns |
1.01 |
shared array/broadcast |
460375 ns |
461145.5 ns |
1.00 |
shared array/random/randn/Float32 |
812875.5 ns |
813750 ns |
1.00 |
shared array/random/randn!/Float32 |
635958 ns |
636542 ns |
1.00 |
shared array/random/rand!/Int64 |
562771 ns |
568417 ns |
0.99 |
shared array/random/rand!/Float32 |
595292 ns |
603334 ns |
0.99 |
shared array/random/rand/Int64 |
795542 ns |
778417 ns |
1.02 |
shared array/random/rand/Float32 |
605042 ns |
616250 ns |
0.98 |
shared array/copyto!/gpu_to_gpu |
81125 ns |
84667 ns |
0.96 |
shared array/copyto!/cpu_to_gpu |
82958 ns |
83375 ns |
0.99 |
shared array/copyto!/gpu_to_cpu |
81958 ns |
84625 ns |
0.97 |
shared array/accumulate/1d |
1346708 ns |
1346167 ns |
1.00 |
shared array/accumulate/2d |
1390833 ns |
1397291.5 ns |
1.00 |
shared array/iteration/findall/int |
1807667 ns |
1800250 ns |
1.00 |
shared array/iteration/findall/bool |
1592292 ns |
1590437.5 ns |
1.00 |
shared array/iteration/findfirst/int |
1381042 ns |
1408125 ns |
0.98 |
shared array/iteration/findfirst/bool |
1366334 ns |
1364584 ns |
1.00 |
shared array/iteration/scalar |
156375 ns |
153583 ns |
1.02 |
shared array/iteration/logical |
2954791.5 ns |
2981833.5 ns |
0.99 |
shared array/iteration/findmin/1d |
1466375 ns |
1467625 ns |
1.00 |
shared array/iteration/findmin/2d |
1365375 ns |
1369416 ns |
1.00 |
shared array/reductions/reduce/1d |
727958 ns |
738166.5 ns |
0.99 |
shared array/reductions/reduce/2d |
667750 ns |
663208.5 ns |
1.01 |
shared array/reductions/mapreduce/1d |
738083 ns |
746583 ns |
0.99 |
shared array/reductions/mapreduce/2d |
658333 ns |
670917 ns |
0.98 |
shared array/permutedims/4d |
2551125 ns |
2524958.5 ns |
1.01 |
shared array/permutedims/2d |
1017458 ns |
1028125 ns |
0.99 |
shared array/permutedims/3d |
1583584 ns |
1588833 ns |
1.00 |
shared array/copy |
246625 ns |
239042 ns |
1.03 |
This comment was automatically generated by workflow using github-action-benchmark.
Thank you! Once you add tests and fix formatting this should be good to merge. |
i cant figure out how to get tests working, any ideas how do i solve the err? |
I believe your illegal load gets optimized away and thus never triggers the error. |
hmm what can i try to do then? |
Have you looked at #416 and the links to the resources in #510? They might point you in the right direction. As for the kernel, you could write one that tries to set the value in clearly out of bounds memory (like |
This will need some thinking; apparently we can't switch tasks on the callback threads or risk a deadlock. Main thread, waits until everything is done:
Callback thread, triggers a task switch by doing
JuliaInterop/ObjectiveC.jl#43 made it possible to allocate, but I guess task switches need additional work. |
Also, even switching this to a proper null pointer load doesn't trigger a command buffer error:
I would have expected this to trigger a |
i experimented with aggressive OOB accesses, pointer dereferences via I'm happy to implement to test any other specific approaches you recommend ? |
I'm not sure of any test that triggers an error here, but regardless it's probably good to have the reporting in place. Because of the task switching issue mentioned above, we'll have to stick to |
Agreed, it's better to have the reporting in place as a safeguard. And yes, sticking to Core.println makes sense given the task switching issue. |
what could be the next move ? |
Let's simplify for now and create an issue to track proper error reporting. |
solves #510