feat: Query ranked/aggregate group compile stats via getattribute - #2147
Open
lgritz wants to merge 1 commit into
Open
feat: Query ranked/aggregate group compile stats via getattribute#2147lgritz wants to merge 1 commit into
lgritz wants to merge 1 commit into
Conversation
Post-optimization group metrics active_layers, network_depth,
texture_ops, and noise_ops were queryable per group, but the "top N"
lists and min/max/median that getstats() prints were computed inline
and discarded. Renderers had no way to get them short of scraping the
text, and no way to enumerate groups to recompute them.
Add system-level getattribute keys:
stat:compiled_<metric>:top_count int # groups with value > 0
stat:compiled_<metric>:top_names string[n] # ranked, "" padded
stat:compiled_<metric>:top_values int[n] # ranked, 0 padded
stat:compiled_<metric>:min|max|median int # zero-valued included
Caller's array size picks N; stat:rank_groups still governs only the
printed report. Only optimized groups count, and querying never forces
optimization.
The gather/sort/aggregate logic moves into gather_group_stats(), which
getstats() now also uses, so the report and the queries cannot drift.
Keys dispatch before m_mutex is taken, since gather_group_stats() needs
only m_all_shader_groups_mutex.
oslexec.h gains documentation only, so there is no API or ABI change.
Testing: testrender gains --print-group-stats, and compstats renders a
three-group scene, which testshade cannot do with one group per process.
That covers ranking order, the name-ascending tie-break, and exclusion of
zero-valued groups from the ranked list while they still count toward
min/max/median. The test's filter_re was also dropping the individual
ranked entries from both sides of the diff, so the printed top-N was
never actually compared; widened to include them.
Assisted-by: Claude Code / Claude Opus 5
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Collaborator
Author
|
I have no idea why the icx test is failing, but it is certainly not related to the contents of this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Post-optimization group metrics active_layers, network_depth, texture_ops, and noise_ops were queryable per group, but the "top N" lists and min/max/median that getstats() prints were computed inline and discarded. Renderers had no way to get them short of scraping the text, and no way to enumerate groups to recompute them.
Add system-level getattribute keys:
Caller's array size picks N; stat:rank_groups still governs only the printed report. Only optimized groups count, and querying never forces optimization.
The gather/sort/aggregate logic moves into gather_group_stats(), which getstats() now also uses, so the report and the queries cannot drift. Keys dispatch before m_mutex is taken, since gather_group_stats() needs only m_all_shader_groups_mutex.
oslexec.h gains documentation only, so there is no API or ABI change.
Testing: testrender gains --print-group-stats, and compstats renders a three-group scene, which testshade cannot do with one group per process. That covers ranking order, the name-ascending tie-break, and exclusion of zero-valued groups from the ranked list while they still count toward min/max/median. The test's filter_re was also dropping the individual ranked entries from both sides of the diff, so the printed top-N was never actually compared; widened to include them.
Assisted-by: Claude Code / Claude Opus 5