fix range iteration test (#999)
* fix range iteration test
* misc fix
* fixing test fail
* fixing test
* fix yaml test
* add newline
---------
Co-authored-by: Gopesh Bhardwaj <gopesh.bhardwaj@amd.com>
[ROCm/rocprofiler-sdk commit: 0e0b37501c]
This commit is contained in:
@@ -611,12 +611,6 @@ code_object_tracing_callback(rocprofiler_callback_tracing_record_t record,
|
||||
!std::regex_search(kernel_info.formatted_kernel_name, exclude_regex))
|
||||
add_kernel_target(sym_data->kernel_id, kernel_filter_range);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(kernel_filter_exclude.empty() ||
|
||||
!std::regex_search(kernel_info.formatted_kernel_name, exclude_regex))
|
||||
add_kernel_target(sym_data->kernel_id, kernel_filter_range);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+8
-2
@@ -72,7 +72,10 @@ add_test(
|
||||
--input-json-pass2 ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_2/out_results.json
|
||||
--input-csv-pass3
|
||||
${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_3/out_counter_collection.csv
|
||||
--input-json-pass3 ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_3/out_results.json)
|
||||
--input-json-pass3 ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_3/out_results.json
|
||||
--input-csv-pass4
|
||||
${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_4/out_counter_collection.csv
|
||||
--input-json-pass4 ${CMAKE_CURRENT_BINARY_DIR}/json_input/pass_4/out_results.json)
|
||||
|
||||
add_test(
|
||||
NAME rocprofv3-test-cc-kernel-filtering-input-yaml-validate
|
||||
@@ -86,7 +89,10 @@ add_test(
|
||||
--input-json-pass2 ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_2/out_results.json
|
||||
--input-csv-pass3
|
||||
${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_3/out_counter_collection.csv
|
||||
--input-json-pass3 ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_3/out_results.json)
|
||||
--input-json-pass3 ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_3/out_results.json
|
||||
--input-csv-pass4
|
||||
${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_4/out_counter_collection.csv
|
||||
--input-json-pass4 ${CMAKE_CURRENT_BINARY_DIR}/yaml_input/pass_4/out_results.json)
|
||||
|
||||
add_test(
|
||||
NAME rocprofv3-test-cc-kernel-filtering-input-cmd-validate
|
||||
|
||||
+27
-1
@@ -31,7 +31,7 @@ def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
"--input-csv-pass2",
|
||||
action="store",
|
||||
help="Path to JSON file.",
|
||||
help="Path to CSV file.",
|
||||
)
|
||||
|
||||
parser.addoption(
|
||||
@@ -43,9 +43,21 @@ def pytest_addoption(parser):
|
||||
parser.addoption(
|
||||
"--input-csv-pass3",
|
||||
action="store",
|
||||
help="Path to CSV file.",
|
||||
)
|
||||
|
||||
parser.addoption(
|
||||
"--input-json-pass4",
|
||||
action="store",
|
||||
help="Path to JSON file.",
|
||||
)
|
||||
|
||||
parser.addoption(
|
||||
"--input-csv-pass4",
|
||||
action="store",
|
||||
help="Path to CSV file.",
|
||||
)
|
||||
|
||||
parser.addoption(
|
||||
"--input-csv-pmc1",
|
||||
action="store",
|
||||
@@ -74,6 +86,13 @@ def input_csv_pass3(request):
|
||||
return pd.read_csv(inp)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def input_csv_pass4(request):
|
||||
filename = request.config.getoption("--input-csv-pass4")
|
||||
with open(filename, "r") as inp:
|
||||
return pd.read_csv(inp)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def input_csv_pmc1(request):
|
||||
filename = request.config.getoption("--input-csv-pmc1")
|
||||
@@ -100,3 +119,10 @@ def input_json_pass3(request):
|
||||
filename = request.config.getoption("--input-json-pass3")
|
||||
with open(filename, "r") as inp:
|
||||
return dotdict(collapse_dict_list(json.load(inp)))
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def input_json_pass4(request):
|
||||
filename = request.config.getoption("--input-json-pass4")
|
||||
with open(filename, "r") as inp:
|
||||
return dotdict(collapse_dict_list(json.load(inp)))
|
||||
|
||||
+14
@@ -33,6 +33,20 @@
|
||||
],
|
||||
"kernel_include_regex": ".*_kernel",
|
||||
"kernel_exclude_regex": "",
|
||||
"output_file": "out",
|
||||
"output_format": [
|
||||
"csv",
|
||||
"json"
|
||||
],
|
||||
"truncate_kernels": true
|
||||
},
|
||||
{
|
||||
"pmc": [
|
||||
"SQ_WAVES"
|
||||
],
|
||||
"kernel_include_regex": "divide",
|
||||
"kernel_exclude_regex": "",
|
||||
|
||||
"output_file": "out",
|
||||
"output_format": [
|
||||
"csv",
|
||||
|
||||
@@ -13,3 +13,6 @@ jobs:
|
||||
- pmc: [GRBM_GUI_ACTIVE]
|
||||
kernel_include_regex: ".*_kernel"
|
||||
kernel_exclude_regex: ""
|
||||
- pmc: [SQ_WAVES]
|
||||
kernel_include_regex: "divide"
|
||||
kernel_exclude_regex: ""
|
||||
|
||||
+9
@@ -121,6 +121,11 @@ def test_validate_counter_collection_csv_pass3(input_csv_pass3: pd.DataFrame):
|
||||
validate_csv(input_csv_pass3, kernel_list, "GRBM_GUI_ACTIVE")
|
||||
|
||||
|
||||
def test_validate_counter_collection_csv_pass4(input_csv_pass4: pd.DataFrame):
|
||||
kernel_list = sorted(["divide_kernel"])
|
||||
validate_csv(input_csv_pass4, kernel_list, "SQ_WAVES")
|
||||
|
||||
|
||||
def test_validate_counter_collection_json_pass1(input_json_pass1):
|
||||
validate_json(input_json_pass1, "SQ_WAVES", False)
|
||||
|
||||
@@ -133,6 +138,10 @@ def test_validate_counter_collection_json_pass3(input_json_pass3):
|
||||
validate_json(input_json_pass3, "GRBM_GUI_ACTIVE", True)
|
||||
|
||||
|
||||
def test_validate_counter_collection_json_pass4(input_json_pass4):
|
||||
validate_json(input_json_pass4, "SQ_WAVES", False)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
exit_code = pytest.main(["-x", __file__] + sys.argv[1:])
|
||||
sys.exit(exit_code)
|
||||
|
||||
+18
-12
@@ -36,20 +36,26 @@ def pytest_addoption(parser):
|
||||
)
|
||||
|
||||
|
||||
def tokenize(kernel_iteration_range):
|
||||
range_str = kernel_iteration_range.replace("[", "").replace("]", "")
|
||||
split_list = range_str.split(",")
|
||||
_range = []
|
||||
for split_string in split_list:
|
||||
if "-" in split_string:
|
||||
interval = split_string.split("-")
|
||||
[
|
||||
_range.append(i)
|
||||
for i in list(range((int)(interval[0]), (int)(interval[1]) + 1))
|
||||
]
|
||||
else:
|
||||
_range.append(int(split_string))
|
||||
return _range
|
||||
|
||||
|
||||
def extract_iteration_list(jobs, pass_):
|
||||
|
||||
kernel_iteration_range = jobs[pass_]["kernel_iteration_range"]
|
||||
_range = re.split(r"\[|,|\],|\[|,|\]", kernel_iteration_range)
|
||||
_range = list(filter(lambda itr: itr != "", _range))
|
||||
range_list = []
|
||||
for itr in _range:
|
||||
if "-" in itr:
|
||||
interval = re.split("-", itr)
|
||||
range_list.append(list(range((int)(interval[0]), (int)(interval[1]))))
|
||||
else:
|
||||
|
||||
range_list.append(itr)
|
||||
return range_list
|
||||
kernel_iteration_range = jobs[pass_]["kernel_iteration_range"].strip()
|
||||
return tokenize(kernel_iteration_range)
|
||||
|
||||
|
||||
def process_config(out_file, input_config, pass_):
|
||||
|
||||
+2
-2
@@ -27,9 +27,9 @@ def validate_json(input_data):
|
||||
for dispatch in kernel_dispatch_data:
|
||||
dispatch_info = dispatch["dispatch_info"]
|
||||
kernel_name = get_kernel_name(dispatch_info["kernel_id"])
|
||||
if kernel_name == "transpose" and iteration in iteration_list:
|
||||
dispatch_ids[dispatch_info["dispatch_id"]] = dispatch_info
|
||||
if kernel_name == "transpose":
|
||||
if iteration in iteration_list:
|
||||
dispatch_ids[dispatch_info[dispatch_id]] = dispatch_info
|
||||
iteration = iteration + 1
|
||||
|
||||
for counter in counter_collection_data:
|
||||
|
||||
Reference in New Issue
Block a user