Repository navigation
Conversation
The JSON printer writes "summaries": null for a skipped state, because it creates the key but never adds anything to it. get_measures() passed that None straight to filter(), so nvbench-walltime failed with "TypeError: 'NoneType' object is not iterable" on any file with a skipped state. The in-tree python/scripts/test_ref.json is one of them. Treating a null summaries list as empty was not enough on its own. get_measures() only returned the measures it found, and the table code indexes every active measure for every row, so the skipped row then raised KeyError: 'cold'. Start from init_measures() so each measure is always present, with 0.0 when the state has no walltime for it. Skipped states now show up as zero rows. Signed-off-by: Dmitry Voropaev <dy.voropaev@gmail.com>
Collaborator
|
Verified claimed unexpected behavior: Log``` (py313) opavlyk@ee09c48-lcedt:~/repos/nvbench$ nvbench-walltime python/scripts/test_ref.json Traceback (most recent call last): File "/home/opavlyk/miniforge/envs/py313/bin/nvbench-walltime", line 6, in sys.exit(main()) ~~~~^^ File "/home/opavlyk/miniforge/envs/py313/lib/python3.13/site-packages/cuda/bench/scripts/nvbench_walltime.py", line 377, in main file_data = consume_file(filename) File "/home/opavlyk/miniforge/envs/py313/lib/python3.13/site-packages/cuda/bench/scripts/nvbench_walltime.py", line 148, in consume_file bench_data = consume_benchmark(bench, file_root) File "/home/opavlyk/miniforge/envs/py313/lib/python3.13/site-packages/cuda/bench/scripts/nvbench_walltime.py", line 182, in consume_benchmark state_measures = get_measures(state) File "/home/opavlyk/miniforge/envs/py313/lib/python3.13/site-packages/cuda/bench/scripts/nvbench_walltime.py", line 97, in get_measures filter(lambda s: s["tag"] == measure_walltime_tag, summaries), None ~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: 'NoneType' object is not iterable ``` |
Collaborator
|
/ok to test cc8fb51 |
This branch has not been deployed
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.
nvbench-walltime fails on any JSON file that has a skipped state. The JSON printer writes
"summaries": nullfor those states, andget_measures()hands that None straight tofilter(). Running the tool on the in-treepython/scripts/test_ref.json, which has skipped states such asDevice=0 In=I8 Out=I8incopy_type_conversion_sweep, exits withTypeError: 'NoneType' object is not iterableat nvbench_walltime.py line 97.Guarding the None alone is not enough.
get_measures()only returns the measures it actually found, so a skipped state gives{}, andappend_measure_values()then hitsKeyError: 'cold'because it indexes every active measure for every row. The change readsstate.get("summaries") or [], the same guard nvbench_plot_bwutil.py already uses, and startstimesfrominit_measures()so each measure is always present with 0.0. Skipped states show up as zero rows in the report.I added python/test/test_nvbench_walltime.py. It writes a small JSON file with one skipped state and one measured state, runs
main()with a stub tabulate that records the rows, and checks the configuration table. On main it fails with the TypeError. With only theor []part it fails withKeyError: 'cold'. With the full change it passes. test_nvbench_compare.py and test_nvbench_tooling_deps.py also pass, and ruff 0.15.20 (check and format) and codespell 2.4.2 report nothing on the touched files.I also ran
python nvbench_walltime.py test_ref.jsonand the same for test_cmp.json from python/scripts with tabulate installed. Both exit 0 now. For test_ref.json the overview reads 03:08.374 total, 01:47.430 isolated and 01:20.943 batch, and skipped rows such asDevice=0 In=I8 Out=I8print 0.00% and a plain 0 in each time column, since tabulate reformats the numeric-looking "0.000" strings.