Skip to content

Commit 08fc817

Browse files
Fix LinearSolveAutotune printout to use correct benchmark size ranges (#691)
- Updated categorize_results() to use actual benchmark size categories (tiny, small, medium, large, big) instead of hardcoded ranges (0-128, 128-256, etc.) - Added proper size range labels with cutoffs: tiny (5-20), small (20-100), medium (100-300), large (300-1000), big (10000+) - Updated telemetry formatting to handle new range format and sort them in logical order - Now the issue printout correctly reflects the same sizing used in the benchmark Co-authored-by: ChrisRackauckas <[email protected]>
1 parent de3da2e commit 08fc817

File tree

2 files changed

+29
-7
lines changed

2 files changed

+29
-7
lines changed

lib/LinearSolveAutotune/src/benchmarking.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,14 @@ function categorize_results(df::DataFrame)
229229

230230
categories = Dict{String, String}()
231231

232-
# Define size ranges
232+
# Define size ranges based on actual benchmark categories
233+
# These align with the sizes defined in get_benchmark_sizes()
233234
ranges = [
234-
("0-128", 1:128),
235-
("128-256", 129:256),
236-
("256-512", 257:512),
237-
("512+", 513:10000)
235+
("tiny (5-20)", 5:20),
236+
("small (20-100)", 21:100),
237+
("medium (100-300)", 101:300),
238+
("large (300-1000)", 301:1000),
239+
("big (10000+)", 10000:typemax(Int))
238240
]
239241

240242
# Get unique element types

lib/LinearSolveAutotune/src/telemetry.jl

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ function format_categories_markdown(categories::Dict{String, String})
192192
eltype_categories = Dict{String, Dict{String, String}}()
193193

194194
for (key, algorithm) in categories
195-
# Parse key like "Float64_0-128" -> eltype="Float64", range="0-128"
195+
# Parse key like "Float64_tiny (5-20)" -> eltype="Float64", range="tiny (5-20)"
196196
if contains(key, "_")
197197
eltype, range = split(key, "_", limit=2)
198198
if !haskey(eltype_categories, eltype)
@@ -208,14 +208,34 @@ function format_categories_markdown(categories::Dict{String, String})
208208
end
209209
end
210210

211+
# Define the proper order for size ranges
212+
size_order = ["tiny (5-20)", "small (20-100)", "medium (100-300)", "large (300-1000)", "big (10000+)"]
213+
214+
# Custom sort function for ranges
215+
function sort_ranges(ranges_dict)
216+
sorted_pairs = []
217+
for size in size_order
218+
if haskey(ranges_dict, size)
219+
push!(sorted_pairs, (size, ranges_dict[size]))
220+
end
221+
end
222+
# Add any other ranges not in our predefined order (for backward compatibility)
223+
for (range, algo) in ranges_dict
224+
if !(range in size_order)
225+
push!(sorted_pairs, (range, algo))
226+
end
227+
end
228+
return sorted_pairs
229+
end
230+
211231
# Format each element type
212232
for (eltype, ranges) in sort(eltype_categories)
213233
push!(lines, "#### Recommendations for $eltype")
214234
push!(lines, "")
215235
push!(lines, "| Size Range | Best Algorithm |")
216236
push!(lines, "|------------|----------------|")
217237

218-
for (range, algorithm) in sort(ranges)
238+
for (range, algorithm) in sort_ranges(ranges)
219239
push!(lines, "| $range | $algorithm |")
220240
end
221241
push!(lines, "")

0 commit comments

Comments
 (0)