Skip to content

record return status from hipDeviceSynchronize() to avoid compilation… #230

record return status from hipDeviceSynchronize() to avoid compilation…

record return status from hipDeviceSynchronize() to avoid compilation… #230

GitHub Actions / Test Results failed Mar 11, 2024 in 0s

1 fail, 109 pass in 6m 49s

110 tests  ±0   109 ✅ +1   6m 49s ⏱️ -4s
 10 suites ±0     0 💤 ±0 
 10 files   ±0     1 ❌  - 1 

Results for commit a0f5d25. ± Comparison against earlier commit f9e8068.

Annotations

Check warning on line 0 in tests.test_analyze_commands

See this annotation in the file changed.

@github-actions github-actions / Test Results

test_baseline (tests.test_analyze_commands) failed

tests/test_analyze_commands.xml [took 17s]
Raw output
  File "<string>", line 1
    �����#x19�@
        ^
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0x9a in position 0: invalid start byte
@pytest.mark.misc
    def test_baseline():
        with pytest.raises(SystemExit) as e:
            with patch(
                "sys.argv",
                [
                    "omniperf",
                    "analyze",
                    "--path",
                    "tests/workloads/vcopy/MI200",
                    "--path",
                    "tests/workloads/vcopy/MI100",
                ],
            ):
                omniperf.main()
        assert e.value.code == 0
    
        with pytest.raises(SystemExit) as e:
            with patch(
                "sys.argv",
                [
                    "omniperf",
                    "analyze",
                    "--path",
                    "tests/workloads/vcopy/MI200",
                    "--path",
                    "tests/workloads/vcopy/MI200",
                ],
            ):
>               omniperf.main()

tests/test_analyze_commands.py:1639: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
src/omniperf:49: in main
    omniperf.run_analysis()
src/utils/utils.py:44: in wrap_function
    result = function(*args, **kwargs)
src/omniperf_base.py:304: in run_analysis
    analyzer.pre_processing()
src/utils/utils.py:44: in wrap_function
    result = function(*args, **kwargs)
src/omniperf_analyze/analysis_cli.py:57: in pre_processing
    parser.load_table_data(
src/utils/parser.py:959: in load_table_data
    eval_metric(
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

dfs = {1:                                     Kernel_Name  Count  ...  Median(ns)    Pct
0  vecCopy(double*, double*, double...c_perf  None
2.1.30             L1I Fetch Latency     18.61851  ...  SQ_IFETCH_LEVEL  None

[31 rows x 7 columns], ...}
dfs_type = {1: 'raw_csv_table', 2: 'raw_csv_table', 101: 'raw_csv_table', 201: 'metric_table', ...}
sys_info = workload_name                                                     vcopy
command                           ./sample/vco...                  1638.4
num_xcd                                                               1
Name: 0, dtype: object
raw_pmc_df =   SQ_IFETCH_LEVEL  ...         pmc_perf
      Dispatch_ID  ...    End_Timestamp
0               0  ...  201235827826452
1               1  ...  201235827944532
2               2  ...  201235827981172

[3 rows x 1151 columns]
debug = False

    def eval_metric(dfs, dfs_type, sys_info, raw_pmc_df, debug):
        """
        Execute the expr string for each metric in the df.
        """
    
        # confirm no illogical counter values (only consider non-roofline runs)
        roof_only_run = sys_info.ip_blocks == "roofline"
        rocscope_run = sys_info.ip_blocks == "rocscope"
        if (
            (not rocscope_run and not roof_only_run)
            and hasattr(raw_pmc_df["pmc_perf"], "GRBM_GUI_ACTIVE")
            and (raw_pmc_df["pmc_perf"]["GRBM_GUI_ACTIVE"] == 0).any()
        ):
            error("Dectected GRBM_GUI_ACTIVE == 0\nHaulting execution.")
    
        ammolite__se_per_gpu = sys_info.se_per_gpu
        ammolite__pipes_per_gpu = sys_info.pipes_per_gpu
        ammolite__cu_per_gpu = sys_info.cu_per_gpu
        ammolite__simd_per_cu = sys_info.simd_per_cu  # not used
        ammolite__sqc_per_gpu = sys_info.sqc_per_gpu
        ammolite__lds_banks_per_cu = sys_info.lds_banks_per_cu
        ammolite__cur_sclk = sys_info.cur_sclk  # not used
        ammolite__mclk = sys_info.cur_mclk  # not used
        ammolite__max_sclk = sys_info.max_sclk
        ammolite__max_waves_per_cu = sys_info.max_waves_per_cu
        ammolite__hbm_bw = sys_info.hbm_bw
        ammolite__total_l2_chan = calc_builtin_var("$total_l2_chan", sys_info)
        ammolite__num_xcd = sys_info.num_xcd
    
        # TODO: fix all $normUnit in Unit column or title
    
        # build and eval all derived build-in global variables
        ammolite__build_in = {}
    
        # first pass, we do all per-xcd values, as these are used in subsequent builtins
        for key, value in build_in_vars.items():
            if "PER_XCD" not in key:
                continue
            # NB: assume all built-in vars from pmc_perf.csv for now
            s = build_eval_string(value, schema.pmc_perf_file_prefix)
            try:
                ammolite__build_in[key] = eval(compile(s, "<string>", "eval"))
            except TypeError:
                ammolite__build_in[key] = None
            except AttributeError as ae:
                if ae == "'NoneType' object has no attribute 'get'":
                    ammolite__build_in[key] = None
        ammolite__GRBM_GUI_ACTIVE_PER_XCD = ammolite__build_in["GRBM_GUI_ACTIVE_PER_XCD"]
        ammolite__GRBM_COUNT_PER_XCD = ammolite__build_in["GRBM_COUNT_PER_XCD"]
        ammolite__GRBM_SPI_BUSY_PER_XCD = ammolite__build_in["GRBM_SPI_BUSY_PER_XCD"]
    
        for key, value in build_in_vars.items():
            # next pass, we evaluate the builtins the depend on the per-XCD values
            if "PER_XCD" in key:
                continue
            # NB: assume all built-in vars from pmc_perf.csv for now
            s = build_eval_string(value, schema.pmc_perf_file_prefix)
            try:
                ammolite__build_in[key] = eval(compile(s, "<string>", "eval"))
            except TypeError:
                ammolite__build_in[key] = None
            except AttributeError as ae:
                if ae == "'NoneType' object has no attribute 'get'":
                    ammolite__build_in[key] = None
        ammolite__numActiveCUs = ammolite__build_in["numActiveCUs"]
        ammolite__kernelBusyCycles = ammolite__build_in["kernelBusyCycles"]
    
        # Hmmm... apply + lambda should just work
        # df['Value'] = df['Value'].apply(lambda s: eval(compile(str(s), '<string>', 'eval')))
        for id, df in dfs.items():
            if dfs_type[id] == "metric_table":
                for idx, row in df.iterrows():
                    for expr in df.columns:
                        if expr in schema.supported_field:
                            if expr.lower() != "alias":
                                if row[expr]:
                                    if debug:  # debug won't impact the regular calc
                                        print("~" * 40 + "\nExpression:")
                                        print(expr, "=", row[expr])
                                        print("Inputs:")
                                        matched_vars = re.findall(r"ammolite__\w+", row[expr])
                                        if matched_vars:
                                            for v in matched_vars:
                                                print(
                                                    "Var ",
                                                    v,
                                                    ":",
                                                    eval(compile(v, "<string>", "eval")),
                                                )
                                        matched_cols = re.findall(
                                            r"raw_pmc_df\['\w+'\]\['\w+'\]", row[expr]
                                        )
                                        if matched_cols:
                                            for c in matched_cols:
                                                m = re.match(
                                                    r"raw_pmc_df\['(\w+)'\]\['(\w+)'\]", c
                                                )
                                                t = raw_pmc_df[m.group(1)][
                                                    m.group(2)
                                                ].to_list()
                                                print(c)
                                                print(
                                                    raw_pmc_df[m.group(1)][
                                                        m.group(2)
                                                    ].to_list()
                                                )
                                                # print(
                                                #     tabulate(raw_pmc_df[m.group(1)][
                                                #         m.group(2)],
                                                #              headers='keys',
                                                #              tablefmt='fancy_grid'))
                                        print("\nOutput:")
                                        try:
                                            print(
                                                eval(compile(row[expr], "<string>", "eval"))
                                            )
                                            print("~" * 40)
                                        except TypeError:
                                            print(
                                                "skipping entry. Encountered a missing counter"
                                            )
                                            print(expr, " has been assigned to None")
                                            print(np.nan)
                                        except AttributeError as ae:
                                            if (
                                                str(ae)
                                                == "'NoneType' object has no attribute 'get'"
                                            ):
                                                print(
                                                    "skipping entry. Encountered a missing csv"
                                                )
                                                print(np.nan)
                                            else:
                                                print(ae)
                                                sys.exit(1)
    
                                    # print("eval_metric", id, expr)
                                    try:
>                                       out = eval(compile(row[expr], "<string>", "eval"))
E                                         File "<string>", line 1
E                                           �����#x19�@
E                                               ^
E                                       SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0x9a in position 0: invalid start byte

src/utils/parser.py:807: SyntaxError