-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
gpuAffects running Julia on a GPUAffects running Julia on a GPUperformanceMust go fasterMust go faster
Description
using StaticArrays
@inbounds function f(data, idx)
arr = MArray{Tuple{3,3}}(data...)
va = view(arr, :, idx)
va[2] = 2
return SArray(arr)
end
emits a boundscheck despite the @inbounds.
Line 165 in 642a88c
| @_inline_meta |
@propagate_inbounds.
; @ REPL[23]:3 within `f'
; ┌ @ subarray.jl:167 within `view'
%24 = getelementptr inbounds { i64 }, { i64 }* %4, i64 0, i32 0
store i64 %2, i64* %24, align 8
; │┌ @ abstractarray.jl:610 within `checkbounds' @ abstractarray.jl:589
; ││┌ @ abstractarray.jl:636 within `checkbounds_indices' @ abstractarray.jl:636
; │││┌ @ abstractarray.jl:667 within `checkindex'
; ││││┌ @ bool.jl:36 within `&'
%.off = add i64 %2, -1
%25 = icmp ugt i64 %.off, 2
; ││└└└
; ││ @ abstractarray.jl:610 within `checkbounds'
br i1 %25, label %L21, label %L24
L21: ; preds = %top
%26 = getelementptr inbounds [3 x {}*], [3 x {}*]* %gcframe61, i64 0, i64 2
store {}* %18, {}** %26, align 16
%27 = call nonnull {}* @j_throw_boundserror_711({}* nonnull %18, { i64 }* nocapture readonly %4)
call void @llvm.trap()
unreachable
The bounds-check itself wouldn't be that bad if it in turn wouldn't cause us to capture the MArray and thus preventing allocating it on the stack, so an alternative fix would be for Base.throw_boundserror to not capture the array it's based off.
Metadata
Metadata
Assignees
Labels
gpuAffects running Julia on a GPUAffects running Julia on a GPUperformanceMust go fasterMust go faster