move maskedLoopPositive to @-based
This commit is contained in:
parent
dee29a1a02
commit
90e7537225
@ -34,7 +34,7 @@ fn equal{W, X}(w:*void, x:*void, l:u64, d:u64) : u1 = {
|
|||||||
def TU = [vw/64]u64
|
def TU = [vw/64]u64
|
||||||
f0:= TF**0.0
|
f0:= TF**0.0
|
||||||
f1:= TF**1.0
|
f1:= TF**1.0
|
||||||
maskedLoopPositive{bulk, l, {i, M} => {
|
@maskedLoopPositive{bulk}(M in 'm' over i to l) {
|
||||||
wu:= (if (hasarch{'AVX2'}) {
|
wu:= (if (hasarch{'AVX2'}) {
|
||||||
cw:= b_getBatchLo{bulk, *u64~~w, i}
|
cw:= b_getBatchLo{bulk, *u64~~w, i}
|
||||||
topBlend{f0, f1, TU**cw << make{TU,63-iota{vcount{TU}}}}
|
topBlend{f0, f1, TU**cw << make{TU,63-iota{vcount{TU}}}}
|
||||||
@ -44,7 +44,7 @@ fn equal{W, X}(w:*void, x:*void, l:u64, d:u64) : u1 = {
|
|||||||
})
|
})
|
||||||
cx:= load{*TF ~~ x, i}
|
cx:= load{*TF ~~ x, i}
|
||||||
if (anynePositive{wu, cx, M}) return{0}
|
if (anynePositive{wu, cx, M}) return{0}
|
||||||
}}
|
}
|
||||||
} else { # bitarr ≡ i8/i16/i32arr
|
} else { # bitarr ≡ i8/i16/i32arr
|
||||||
def T = [bulk]X
|
def T = [bulk]X
|
||||||
def sh{c} = c << (width{X}-1)
|
def sh{c} = c << (width{X}-1)
|
||||||
@ -65,11 +65,11 @@ fn equal{W, X}(w:*void, x:*void, l:u64, d:u64) : u1 = {
|
|||||||
|
|
||||||
def R = [bulk]X
|
def R = [bulk]X
|
||||||
|
|
||||||
maskedLoopPositive{bulk, l, {i, M} => {
|
@maskedLoopPositive{bulk}(M in 'm' over i to l) {
|
||||||
cw:= loadBatch{*W~~w, i, R}
|
cw:= loadBatch{*W~~w, i, R}
|
||||||
cx:= loadBatch{*X~~x, i, R}
|
cx:= loadBatch{*X~~x, i, R}
|
||||||
if (anynePositive{cw,cx,M}) return{0}
|
if (anynePositive{cw,cx,M}) return{0}
|
||||||
}}
|
}
|
||||||
}
|
}
|
||||||
1
|
1
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,16 +68,6 @@ def storeBatch{ptr:P, ns, xs, M & istup{ns}} = each{{n,x} => storeBatch{ptr, n,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def maskedLoopPositive{bulk, l:L, step} = {
|
|
||||||
i:L = 0
|
|
||||||
while(i < (l-1)/bulk) {
|
|
||||||
step{i, maskNone}
|
|
||||||
++i
|
|
||||||
}
|
|
||||||
step{i, maskAfter{l - i*bulk}}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# "harmless" pointer cast that'll only cast void*
|
# "harmless" pointer cast that'll only cast void*
|
||||||
def hCast{T,p} = assert{show{'expected pointer with element',T,'or void but got ',p}}
|
def hCast{T,p} = assert{show{'expected pointer with element',T,'or void but got ',p}}
|
||||||
def hCast{T,p:P & match{T,eltype{P}}} = p
|
def hCast{T,p:P & match{T,eltype{P}}} = p
|
||||||
@ -120,6 +110,16 @@ def maskedLoop{bulk, i0}{vars,begin==0,end,iter} = {
|
|||||||
def maskedLoop{bulk} = maskedLoop{bulk,0}
|
def maskedLoop{bulk} = maskedLoop{bulk,0}
|
||||||
|
|
||||||
|
|
||||||
|
def maskedLoopPositive{bulk}{vars,begin==0,end:L,iter} = {
|
||||||
|
i:L = 0
|
||||||
|
while(i < (end-1)/bulk) {
|
||||||
|
mlExec{i, iter, vars, bulk, maskNone}
|
||||||
|
++i
|
||||||
|
}
|
||||||
|
mlExec{i, iter, vars, bulk, maskAfter{end - i*bulk}}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# masked unrolled loop
|
# masked unrolled loop
|
||||||
# bulk: vector count
|
# bulk: vector count
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user