Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the TRelu test data generation script by introducing an explicit output_case_name attribute to the TReluParams class, which is now used for directory naming instead of loop indices. A review comment suggests that the case_name variable and the generate_case_name function have become redundant following these changes and should be removed to simplify the script.
| output_dir = os.path.join(script_dir, f"TRELUTest.case_{i}") | ||
| else: | ||
| output_dir = os.path.join(script_dir, case_name) | ||
| output_dir = os.path.join(script_dir, f"TRELUTest.{param.output_case_name}") |
There was a problem hiding this comment.
The case_name variable (defined on line 81) is no longer used for directory mapping, as it has been replaced by the explicit param.output_case_name. Additionally, case_name is passed to gen_golden_data_trelu (line 86), which does not use the parameter. This makes the generate_case_name function and the case_name variable redundant. Consider removing them to simplify the script and improve maintainability.
What changed
i < 8directory selection intrelu/gen_data.pywith explicit per-case output namesWhy
The previous logic depended on the current ordering and size of
case_params_list. Any insertion, deletion, or reordering could silently break the mapping between generated golden-data directories and the gtest names used byTRELUTest.Impact
trelugolden-data generation is now tied to the intended gtest case names instead of fragile list indexesValidation
python3 -m py_compile tests/cpu/st/testcase/trelu/gen_data.pyruff check tests/cpu/st/testcase/trelu/gen_data.pypython3 tests/run_cpu.py --testcase trelu --gtest_filter 'TRELUTest.case_0' --generator Ninja --build-dir build/cpu_pr_trelu_dir_mapping --clean