{"action":"created","issue":{"url":"https://api.github.com/repos/eschnett/SIMD.jl/issues/23","repository_url":"https://api.github.com/repos/eschnett/SIMD.jl","labels_url":"https://api.github.com/repos/eschnett/SIMD.jl/issues/23/labels{/name}","comments_url":"https://api.github.com/repos/eschnett/SIMD.jl/issues/23/comments","events_url":"https://api.github.com/repos/eschnett/SIMD.jl/issues/23/events","html_url":"https://github.com/eschnett/SIMD.jl/issues/23","id":266590669,"node_id":"MDU6SXNzdWUyNjY1OTA2Njk=","number":23,"title":"Performance of subarrays","user":{"login":"jw3126","id":7261506,"node_id":"MDQ6VXNlcjcyNjE1MDY=","avatar_url":"https://avatars2.githubusercontent.com/u/7261506?v=4","gravatar_id":"","url":"https://api.github.com/users/jw3126","html_url":"https://github.com/jw3126","followers_url":"https://api.github.com/users/jw3126/followers","following_url":"https://api.github.com/users/jw3126/following{/other_user}","gists_url":"https://api.github.com/users/jw3126/gists{/gist_id}","starred_url":"https://api.github.com/users/jw3126/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jw3126/subscriptions","organizations_url":"https://api.github.com/users/jw3126/orgs","repos_url":"https://api.github.com/users/jw3126/repos","events_url":"https://api.github.com/users/jw3126/events{/privacy}","received_events_url":"https://api.github.com/users/jw3126/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-10-18T18:12:51Z","updated_at":"2019-01-05T19:48:00Z","closed_at":null,"author_association":"NONE","body":"Performance is often degraded, when using views. Here is an example:\r\n\r\n```julia\r\nusing SIMD\r\nusing BenchmarkTools\r\n\r\nfunction myadd!(out, a,b)\r\n    V = Vec{8,Float32}\r\n    @assert size(a) == size(b) == size(out)\r\n    for i in 1:8:length(a)\r\n        av = vload(V,a,i)\r\n        bv = vload(V,b,i)\r\n        ov = av + bv\r\n        vstore(ov, out, i)\r\n    end\r\n    out\r\nend\r\n```\r\n\r\n```julia\r\na = b = out= randn(Float32,10^6)\r\n@benchmark myadd!(out, a, b)\r\n```\r\n```\r\nBenchmarkTools.Trial: \r\n  memory estimate:  0 bytes\r\n  allocs estimate:  0\r\n  --------------\r\n  minimum time:     264.645 μs (0.00% GC)\r\n  median time:      267.240 μs (0.00% GC)\r\n  mean time:        272.489 μs (0.00% GC)\r\n  maximum time:     1.529 ms (0.00% GC)\r\n  --------------\r\n  samples:          10000\r\n  evals/sample:     1\r\n```\r\n```julia\r\nva = view(a,:)\r\nvb = view(b, :) \r\nvout = view(out, :)\r\n@benchmark myadd!(vout, va, vb)\r\n```\r\n```\r\nBenchmarkTools.Trial: \r\n  memory estimate:  0 bytes\r\n  allocs estimate:  0\r\n  --------------\r\n  minimum time:     367.993 μs (0.00% GC)\r\n  median time:      382.777 μs (0.00% GC)\r\n  mean time:        395.287 μs (0.00% GC)\r\n  maximum time:     1.157 ms (0.00% GC)\r\n  --------------\r\n  samples:          10000\r\n  evals/sample:     1\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/eschnett/SIMD.jl/issues/comments/451685302","html_url":"https://github.com/eschnett/SIMD.jl/issues/23#issuecomment-451685302","issue_url":"https://api.github.com/repos/eschnett/SIMD.jl/issues/23","id":451685302,"node_id":"MDEyOklzc3VlQ29tbWVudDQ1MTY4NTMwMg==","user":{"login":"eschnett","id":213514,"node_id":"MDQ6VXNlcjIxMzUxNA==","avatar_url":"https://avatars0.githubusercontent.com/u/213514?v=4","gravatar_id":"","url":"https://api.github.com/users/eschnett","html_url":"https://github.com/eschnett","followers_url":"https://api.github.com/users/eschnett/followers","following_url":"https://api.github.com/users/eschnett/following{/other_user}","gists_url":"https://api.github.com/users/eschnett/gists{/gist_id}","starred_url":"https://api.github.com/users/eschnett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eschnett/subscriptions","organizations_url":"https://api.github.com/users/eschnett/orgs","repos_url":"https://api.github.com/users/eschnett/repos","events_url":"https://api.github.com/users/eschnett/events{/privacy}","received_events_url":"https://api.github.com/users/eschnett/received_events","type":"User","site_admin":false},"created_at":"2019-01-05T19:48:00Z","updated_at":"2019-01-05T19:48:00Z","author_association":"OWNER","body":"The problem I mentioned (which, I believe, exists on Blue Gene/Q, but other non-x86 architectures might also be affected) has nothing to do with caching itself. Rather, when the CPU accesses memory, this doesn't happen byte-by-byte, but rather in a highly parallel manner. x86 CPU read and write whole cache lines (64 bytes) at a time. In this sense, memory has been SIMD-parallelized for quite some time."}}
{"actor":{"display_login":"eschnett"}}