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

Remove @linearidx in permutedims kernel #385

Closed
wants to merge 1 commit into from

Conversation

GiggleLiu
Copy link
Contributor

@GiggleLiu GiggleLiu commented Jan 3, 2022

NEW

➜  scripts git:(master) ✗ JULIA_CUDA_USE_BINARYBUILDER=false julia permutedims.jl       
BenchmarkTools.Trial: 118 samples with 1 evaluation.
 Range (min … max):  42.366 ms … 42.511 ms  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     42.393 ms              ┊ GC (median):    0.00%
 Time  (mean ± σ):   42.398 ms ± 17.662 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

                   ▃▄▁█▄▆▃ ▁ ▁ ▁ ▃                             
  ▄▁▁▁▄▁▆▄▄▆▆▆▁▇▇▄▇███████▆█▇█▁█▇█▆▇▁▁▆▁▆▄▁▄▄▆▄▇▆▁▁▇▇▁▁▄▁▁▁▁▆ ▄
  42.4 ms         Histogram: frequency by time        42.4 ms <

 Memory estimate: 9.05 KiB, allocs estimate: 95.%

OLD

➜  scripts git:(master) ✗ JULIA_CUDA_USE_BINARYBUILDER=false julia permutedims.jl
BenchmarkTools.Trial: 31 samples with 1 evaluation.
 Range (min … max):  165.607 ms … 165.798 ms  ┊ GC (min … max): 0.00% … 0.00%
 Time  (median):     165.701 ms               ┊ GC (median):    0.00%
 Time  (mean ± σ):   165.698 ms ±  50.178 μs  ┊ GC (mean ± σ):  0.00% ± 0.00%

                       ▃        █           █                    
  ▇▇▁▁▁▇▁▁▇▁▁▇▁▇▁▁▇▁▁▇▇█▇▁▁▇▁▇▁▇█▇▇▇▁▁▇▇▁▇▁▁█▁▁▁▁▁▁▇▁▁▁▁▁▁▁▁▇▇▇ ▁
  166 ms           Histogram: frequency by time          166 ms <

SCRIPT

➜  scripts git:(master) ✗ cat permutedims.jl 
using CUDA, BenchmarkTools, Random

let D = 28
    a = CUDA.randn(fill(2, D)...)
    b = CUDA.randn(fill(2, D)...)
    pm = (randperm(D)...,)
    display(@benchmark (CUDA.@sync permutedims!($b, $a, $pm)))
end

Please also check the discussion in JuliaGPU/CUDA.jl#1301

@maleadt
Copy link
Member

maleadt commented Jan 3, 2022

Eh. Let me try storing the array length instead, that follows how Base works.

(but thanks for the PR and finding the issue, of course)

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.

None yet

2 participants