Skip to content

Commit a92d448

Browse files
committed
Use available_registers() to set_hw properties consistently across LoopSet generating functions.
1 parent 0ae34ab commit a92d448

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed

src/condense_loopset.jl

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ function check_if_empty(ls::LoopSet, q::Expr)
220220
end
221221

222222
val(x) = Expr(:call, Expr(:curly, :Val, x))
223+
223224
# Try to condense in type stable manner
224225
function generate_call(ls::LoopSet, inline_unroll::NTuple{3,Int8}, debug::Bool = false)
225226
operation_descriptions = Expr(:tuple)
@@ -243,13 +244,7 @@ function generate_call(ls::LoopSet, inline_unroll::NTuple{3,Int8}, debug::Bool =
243244
:tuple, inline, u₁, u₂,
244245
Expr(:call, lv(:unwrap), VECTORWIDTHSYMBOL),
245246
Expr(:call, lv(:unwrap), Expr(:call, lv(:register_size))),
246-
Expr(:call, lv(:unwrap),
247-
Expr(:call, lv(:ifelse),
248-
Expr(:call, lv(:unwrap), Expr(:call, lv(:has_opmask_registers))),
249-
Expr(:call, lv(:unwrap), Expr(:call, lv(:register_count))),
250-
Expr(:call, lv(:unwrap), Expr(:call, :(-), Expr(:call, lv(:register_count)), Expr(:call, lv(:One))))
251-
)
252-
),
247+
Expr(:call, lv(:unwrap), Expr(:call, lv(:available_registers))),
253248
Expr(:call, lv(:unwrap), Expr(:call, lv(:cache_linesize)))
254249
)
255250
q = Expr(

src/constructors.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function add_ci_call!(q::Expr, @nospecialize(f), args, syms, i, mod = nothing)
3131
end
3232
if mod !== nothing # indicates it's `vmaterialize(!)`
3333
reg_size = Expr(:call, lv(:register_size))
34-
reg_count = Expr(:call, lv(:register_count))
34+
reg_count = Expr(:call, lv(:available_registers))
3535
cache_lnsze = Expr(:call, lv(:cache_linesize))
3636
push!(call.args, Expr(:call, Expr(:curly, :Val, QuoteNode(mod))), reg_size, reg_count, cache_lnsze)
3737
end

src/graphs.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,9 +305,10 @@ function set_hw!(ls::LoopSet, rs::Int, rc::Int, cls::Int)
305305
ls.cache_linesize[] = cls
306306
# ls.opmask_register[] = omr
307307
end
308+
available_registers() = ifelse(has_opmask_registers(), register_count(), register_count() - One())
308309
function set_hw!(ls::LoopSet)
309310
rs = Int(register_size())
310-
rc = Int(register_count())
311+
rc = Int(available_registers())
311312
cls = Int(cache_linesize())
312313
# omr = Bool(VectorizationBase.has_opmask_registers())
313314
set_hw!(ls, rs, rc, cls)

0 commit comments

Comments
 (0)