Skip to content
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

Allow for ndims query #551

Merged
merged 2 commits into from
Jan 13, 2025
Merged

Allow for ndims query #551

merged 2 commits into from
Jan 13, 2025

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Jan 8, 2025

No description provided.

Copy link
Contributor

github-actions bot commented Jan 8, 2025

Benchmark Results

main 8671ed9... main/8671ed9d6b1358...
saxpy/default/Float16/1024 0.734 ± 0.0075 μs 0.723 ± 0.01 μs 1.01
saxpy/default/Float16/1048576 0.173 ± 0.0094 ms 0.173 ± 0.0095 ms 1
saxpy/default/Float16/16384 3.36 ± 0.052 μs 3.32 ± 0.023 μs 1.01
saxpy/default/Float16/2048 0.912 ± 0.012 μs 0.906 ± 0.012 μs 1.01
saxpy/default/Float16/256 0.59 ± 0.0058 μs 0.573 ± 0.0076 μs 1.03
saxpy/default/Float16/262144 0.044 ± 0.00053 ms 0.0439 ± 0.00081 ms 1
saxpy/default/Float16/32768 6.05 ± 0.1 μs 5.99 ± 0.05 μs 1.01
saxpy/default/Float16/4096 1.31 ± 0.023 μs 1.3 ± 0.023 μs 1.01
saxpy/default/Float16/512 0.648 ± 0.007 μs 0.632 ± 0.0076 μs 1.02
saxpy/default/Float16/64 0.556 ± 0.0062 μs 0.539 ± 0.0058 μs 1.03
saxpy/default/Float16/65536 11.7 ± 0.2 μs 11.7 ± 0.13 μs 1
saxpy/default/Float32/1024 0.632 ± 0.011 μs 0.63 ± 0.01 μs 1
saxpy/default/Float32/1048576 0.231 ± 0.012 ms 0.238 ± 0.018 ms 0.969
saxpy/default/Float32/16384 3.49 ± 1 μs 2.74 ± 0.15 μs 1.28
saxpy/default/Float32/2048 0.745 ± 0.015 μs 0.74 ± 0.053 μs 1.01
saxpy/default/Float32/256 0.559 ± 0.0066 μs 0.556 ± 0.0077 μs 1.01
saxpy/default/Float32/262144 0.0451 ± 0.0048 ms 0.0533 ± 0.013 ms 0.846
saxpy/default/Float32/32768 6.65 ± 1.5 μs 5.24 ± 0.32 μs 1.27
saxpy/default/Float32/4096 1.12 ± 0.068 μs 1.12 ± 0.083 μs 1
saxpy/default/Float32/512 0.597 ± 0.0081 μs 0.595 ± 0.0098 μs 1
saxpy/default/Float32/64 0.55 ± 0.0064 μs 0.548 ± 0.0066 μs 1
saxpy/default/Float32/65536 13 ± 1.4 μs 12.3 ± 0.69 μs 1.06
saxpy/default/Float64/1024 0.755 ± 0.017 μs 0.749 ± 0.063 μs 1.01
saxpy/default/Float64/1048576 0.478 ± 0.051 ms 0.48 ± 0.048 ms 0.996
saxpy/default/Float64/16384 6.25 ± 1.5 μs 5.24 ± 0.28 μs 1.19
saxpy/default/Float64/2048 1.13 ± 0.067 μs 1.13 ± 0.085 μs 1
saxpy/default/Float64/256 0.589 ± 0.0082 μs 0.574 ± 0.0081 μs 1.03
saxpy/default/Float64/262144 0.0902 ± 0.0093 ms 0.0891 ± 0.0099 ms 1.01
saxpy/default/Float64/32768 12.8 ± 1.3 μs 11.9 ± 0.94 μs 1.07
saxpy/default/Float64/4096 1.88 ± 0.25 μs 1.67 ± 0.11 μs 1.12
saxpy/default/Float64/512 0.642 ± 0.01 μs 0.624 ± 0.01 μs 1.03
saxpy/default/Float64/64 0.564 ± 0.0069 μs 0.549 ± 0.0072 μs 1.03
saxpy/default/Float64/65536 24.1 ± 2.6 μs 22.8 ± 1.9 μs 1.06
saxpy/static workgroup=(1024,)/Float16/1024 2.18 ± 0.03 μs 2.16 ± 0.029 μs 1.01
saxpy/static workgroup=(1024,)/Float16/1048576 0.157 ± 0.0084 ms 0.159 ± 0.0093 ms 0.99
saxpy/static workgroup=(1024,)/Float16/16384 4.41 ± 0.1 μs 4.4 ± 0.11 μs 1
saxpy/static workgroup=(1024,)/Float16/2048 2.34 ± 0.029 μs 2.32 ± 0.029 μs 1.01
saxpy/static workgroup=(1024,)/Float16/256 2.81 ± 0.04 μs 2.8 ± 0.039 μs 1
saxpy/static workgroup=(1024,)/Float16/262144 0.0418 ± 0.0016 ms 0.0419 ± 0.0013 ms 0.999
saxpy/static workgroup=(1024,)/Float16/32768 6.8 ± 0.16 μs 6.84 ± 0.16 μs 0.994
saxpy/static workgroup=(1024,)/Float16/4096 2.66 ± 0.037 μs 2.66 ± 0.046 μs 1
saxpy/static workgroup=(1024,)/Float16/512 3.25 ± 0.048 μs 3.24 ± 0.039 μs 1
saxpy/static workgroup=(1024,)/Float16/64 2.51 ± 0.21 μs 2.49 ± 0.21 μs 1.01
saxpy/static workgroup=(1024,)/Float16/65536 12.4 ± 0.28 μs 12.3 ± 0.2 μs 1
saxpy/static workgroup=(1024,)/Float32/1024 2.22 ± 0.032 μs 2.23 ± 0.037 μs 0.995
saxpy/static workgroup=(1024,)/Float32/1048576 0.207 ± 0.027 ms 0.206 ± 0.038 ms 1.01
saxpy/static workgroup=(1024,)/Float32/16384 4.37 ± 0.26 μs 4.4 ± 0.22 μs 0.995
saxpy/static workgroup=(1024,)/Float32/2048 2.37 ± 0.055 μs 2.39 ± 0.049 μs 0.994
saxpy/static workgroup=(1024,)/Float32/256 2.66 ± 0.043 μs 2.67 ± 0.078 μs 0.998
saxpy/static workgroup=(1024,)/Float32/262144 0.048 ± 0.0039 ms 0.0478 ± 0.0039 ms 1
saxpy/static workgroup=(1024,)/Float32/32768 7.49 ± 0.39 μs 7.59 ± 0.32 μs 0.987
saxpy/static workgroup=(1024,)/Float32/4096 2.64 ± 0.066 μs 2.67 ± 0.086 μs 0.986
saxpy/static workgroup=(1024,)/Float32/512 2.7 ± 0.073 μs 2.71 ± 0.095 μs 0.999
saxpy/static workgroup=(1024,)/Float32/64 2.7 ± 5 μs 2.71 ± 5.1 μs 0.998
saxpy/static workgroup=(1024,)/Float32/65536 14.4 ± 1.4 μs 14.6 ± 1.4 μs 0.986
saxpy/static workgroup=(1024,)/Float64/1024 2.34 ± 0.065 μs 2.31 ± 0.055 μs 1.01
saxpy/static workgroup=(1024,)/Float64/1048576 0.499 ± 0.052 ms 0.538 ± 0.065 ms 0.928
saxpy/static workgroup=(1024,)/Float64/16384 7.47 ± 0.42 μs 7.5 ± 0.38 μs 0.996
saxpy/static workgroup=(1024,)/Float64/2048 2.62 ± 0.079 μs 2.6 ± 0.068 μs 1.01
saxpy/static workgroup=(1024,)/Float64/256 2.68 ± 0.073 μs 2.66 ± 0.076 μs 1.01
saxpy/static workgroup=(1024,)/Float64/262144 0.0988 ± 0.011 ms 0.119 ± 0.0079 ms 0.83
saxpy/static workgroup=(1024,)/Float64/32768 14.5 ± 1.5 μs 15.4 ± 1.1 μs 0.937
saxpy/static workgroup=(1024,)/Float64/4096 3.18 ± 0.17 μs 3.14 ± 0.14 μs 1.01
saxpy/static workgroup=(1024,)/Float64/512 2.67 ± 0.065 μs 2.65 ± 0.068 μs 1.01
saxpy/static workgroup=(1024,)/Float64/64 2.64 ± 4.4 μs 2.61 ± 0.064 μs 1.01
saxpy/static workgroup=(1024,)/Float64/65536 26.5 ± 2.3 μs 31.5 ± 1.6 μs 0.84
time_to_load 0.322 ± 0.0018 s 0.322 ± 0.004 s 1

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@vchuravy
Copy link
Member Author

vchuravy commented Jan 8, 2025

@maleadt the idea would be that backends could write in their index functions:

if ndims(ctx) <= 3
    # Do custom indexing using hardware indexes
else
   # Cartesian mess
end

But this fails if workgroups are bigger than what the launch configuration supports.
I think I will merge this nonetheless since it is just an exposing of the information.

@vchuravy
Copy link
Member Author

vchuravy commented Jan 8, 2025

@fredrikekre :

[1920] signal 11 (1): Segmentation fault
in expression starting at none:0
verified_kids at /home/runner/.julia/packages/Runic/pKiKZ/src/Runic.jl:95 [inlined]
second_last_leaf at /home/runner/.julia/packages/Runic/pKiKZ/src/chisels.jl:428
second_last_leaf at /home/runner/.julia/packages/Runic/pKiKZ/src/chisels.jl:430 [inlined]
second_last_leaf at /home/runner/.julia/packages/Runic/pKiKZ/src/chisels.jl:430 [inlined]
second_last_leaf at /home/runner/.julia/packages/Runic/pKiKZ/src/chisels.jl:420
no_leading_and_single_trailing_newline at /home/runner/.julia/packages/Runic/pKiKZ/src/runestone.jl:1626
format_node! at /home/runner/.julia/packages/Runic/pKiKZ/src/Runic.jl:421
format_tree! at /home/runner/.julia/packages/Runic/pKiKZ/src/Runic.jl:466
main at /home/runner/.julia/packages/Runic/pKiKZ/src/main.jl:248
jfptr_main_693 at /home/runner/.julia/compiled/v1.12/Runic/xUEjj_6UK4J.so (unknown line)
jl_apply at /cache/build/tester-demeter6-10/julialang/julia-master/src/julia.h:2250 [inlined]
jl_f__call_latest at /cache/build/tester-demeter6-10/julialang/julia-master/src/builtins.c:883
#invokelatest#1 at ./essentials.jl:1056 [inlined]
invokelatest at ./essentials.jl:1052 [inlined]
_start at ./client.jl:563
jfptr__start_57101.1 at /opt/hostedtoolcache/julia/nightly/x64/lib/julia/sys.so (unknown line)
jl_apply at /cache/build/tester-demeter6-10/julialang/julia-master/src/julia.h:2250 [inlined]
true_main at /cache/build/tester-demeter6-10/julialang/julia-master/src/jlapi.c:922
jl_repl_entrypoint at /cache/build/tester-demeter6-10/julialang/julia-master/src/jlapi.c:1081
main at julia (unknown line)
unknown function (ip: 0x7f442762a1c9) at /lib/x86_64-linux-gnu/libc.so.6
__libc_start_main at /lib/x86_64-linux-gnu/libc.so.6 (unknown line)
unknown function (ip: 0x4010b8) at julia
Allocations: 1 (Pool: 1; Big: 0); GC: 0
xargs: julia: terminated by signal 11

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.

Runic suggested the following formatting changes.

src/nditeration.jl Outdated Show resolved Hide resolved
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@vchuravy vchuravy merged commit f198f5c into main Jan 13, 2025
33 of 36 checks passed
@vchuravy vchuravy deleted the vc/hw_indexes_v2 branch January 13, 2025 10:40
@@ -30,3 +30,4 @@ end

@inline groupsize(ctx) = __groupsize(ctx)
@inline ndrange(ctx) = __ndrange(ctx)
@inline Base.ndims(ctx) = ndims(__iterspace(ctx))
Copy link
Member

Choose a reason for hiding this comment

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

arrrrrrrr! Attack of the pirates!!! This is causing a lot of downstream breakage: can it not dispatch on ctx being a context object?

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.

2 participants