28
28
29
29
@inline eltype (:: Type{Padded{L, P}} ) where {L, P} = eltype (L)
30
30
@inline size (:: Type{Padded{L, P}} , logical_size:: NamedTuple ) where {L, P} = size (L, pad_logical_coord (Padded{L, P}, logical_size))
31
- @inline load (:: Type{Padded{L, P}} , workspace, tile:: Tile , logical_size :: NamedTuple ) where {L, P} = load (L, workspace, tile)
32
- @inline store! (:: Type{Padded{L, P}} , workspace, value, tile:: Tile ) where {L, P} = store! (L, workspace, value, tile:: Tile )
31
+ @inline load (:: Type{Padded{L, P}} , workspace, tile:: Tile , workspace_size :: NamedTuple ) where {L, P} = load (L, workspace, tile, pad_logical_coord (Padded{L, P}, workspace_size) )
32
+ @inline store! (:: Type{Padded{L, P}} , workspace, value, tile:: Tile , workspace_size :: NamedTuple ) where {L, P} = store! (L, workspace, value, tile:: Tile , pad_logical_coord (Padded{L, P}, workspace_size) )
33
33
34
34
# ---------------
35
35
# AlignedColMajor
38
38
struct AlignedColMajor{T} <: LayoutBase{T} end
39
39
40
40
# TODO : cleanup vectorisation
41
- @inline function load (:: Type{AlignedColMajor{T}} , workspace, tile:: Tile{size} ) where {T, size}
41
+ @inline function load (:: Type{AlignedColMajor{T}} , workspace, tile:: Tile{size} , workspace_size :: NamedTuple ) where {T, size}
42
42
vec_len = 16 ÷ sizeof (T)
43
43
N = (sizeof (T) * vec_len) ÷ sizeof (Float32)
44
44
res = MArray {Tuple{size[1] ÷ vec_len, size[2]}, NTuple{N, VecElement{Float32}}} (undef)
@@ -47,8 +47,8 @@ struct AlignedColMajor{T} <: LayoutBase{T} end
47
47
@unroll for i = 1 : vec_len : size[1 ]
48
48
t = translate (tile, (i - 1 , j - 1 ))
49
49
50
- linear_base = linearise (t. base, Base . size (workspace) )
51
- linear_offset = linearise (t. offset, Base . size (workspace) )
50
+ linear_base = linearise (t. base, workspace_size )
51
+ linear_offset = linearise (t. offset, workspace_size )
52
52
53
53
@inbounds res[i, j] = vloada (Vec{vec_len, T}, pointer (workspace, linear_base), linear_offset)
54
54
end
@@ -57,15 +57,15 @@ struct AlignedColMajor{T} <: LayoutBase{T} end
57
57
return res
58
58
end
59
59
60
- @inline function store! (:: Type{AlignedColMajor{T}} , workspace, value, tile:: Tile{size} ) where {T, size}
60
+ @inline function store! (:: Type{AlignedColMajor{T}} , workspace, value, tile:: Tile{size} , workspace_size :: NamedTuple ) where {T, size}
61
61
vec_len = 16 ÷ sizeof (T)
62
62
63
63
@unroll for j = 1 : size[2 ]
64
64
@unroll for i = 1 : vec_len : size[1 ]
65
65
t = translate (tile, (i - 1 , j - 1 ))
66
66
67
- linear_base = linearise (t. base, Base . size (workspace) )
68
- linear_offset = linearise (t. offset, Base . size (workspace) )
67
+ linear_base = linearise (t. base, workspace_size )
68
+ linear_offset = linearise (t. offset, workspace_size )
69
69
70
70
vstorea! (Vec{vec_len, T}, pointer (workspace, linear_base), value[i, j], linear_offset)
71
71
end
0 commit comments