Beispiel #1
0
    def full_analysis(self,
                      kernel,
                      kernel_dg: KernelDG,
                      ignore_unknown=False,
                      arch_warning=False,
                      length_warning=False,
                      verbose=False):
        """
        Build the full analysis report including header, the symbol map, the combined TP/CP/LCD
        view and the list based LCD view.

        :param kernel: kernel to report on
        :type kernel: list
        :param kernel_dg: directed graph containing CP and LCD
        :type kernel_dg: :class:`~osaca.semantics.KernelDG`
        :param ignore_unknown: flag for ignore warning if performance data is missing, defaults to
            `False`
        :type ignore_unknown: boolean, optional
        :param print_arch_warning: flag for additional user warning to specify micro-arch 
        :type print_arch_warning: boolean, optional
        :param print_length_warning: flag for additional user warning to specify kernel length with --lines
        :type print_length_warning: boolean, optional
        :param verbose: flag for verbosity level, defaults to False
        :type verbose: boolean, optional
        """
        return (self._header_report() +
                self._user_warnings(arch_warning, length_warning) +
                self._symbol_map() + self.combined_view(
                    kernel,
                    kernel_dg.get_critical_path(),
                    kernel_dg.get_loopcarried_dependencies(),
                    ignore_unknown,
                ) + self.loopcarried_dependencies(
                    kernel_dg.get_loopcarried_dependencies()))
Beispiel #2
0
 def test_cyclic_dag(self):
     dg = KernelDG(self.kernel_x86, self.parser_x86, self.machine_model_csx)
     dg.dg.add_edge(100, 101, latency=1.0)
     dg.dg.add_edge(101, 102, latency=2.0)
     dg.dg.add_edge(102, 100, latency=3.0)
     with self.assertRaises(NotImplementedError):
         dg.get_critical_path()
     with self.assertRaises(NotImplementedError):
         dg.get_loopcarried_dependencies()
Beispiel #3
0
 def test_loop_carried_dependency_x86(self):
     lcd_id = 8
     lcd_id2 = 5
     dg = KernelDG(self.kernel_x86, self.parser_x86, self.machine_model_csx,
                   self.semantics_csx)
     lc_deps = dg.get_loopcarried_dependencies()
     self.assertEqual(len(lc_deps), 2)
     # ID 8
     self.assertEqual(lc_deps[lcd_id]["root"],
                      dg.dg.nodes(data=True)[lcd_id]["instruction_form"])
     self.assertEqual(len(lc_deps[lcd_id]["dependencies"]), 1)
     self.assertEqual(
         lc_deps[lcd_id]["dependencies"][0][0],
         dg.dg.nodes(data=True)[lcd_id]["instruction_form"],
     )
     # w/  flag dependencies: ID 9 w/ len=2
     # w/o flag dependencies: ID 5 w/ len=1
     # TODO discuss
     self.assertEqual(lc_deps[lcd_id2]["root"],
                      dg.dg.nodes(data=True)[lcd_id2]["instruction_form"])
     self.assertEqual(len(lc_deps[lcd_id2]["dependencies"]), 1)
     self.assertEqual(
         lc_deps[lcd_id2]["dependencies"][0][0],
         dg.dg.nodes(data=True)[lcd_id2]["instruction_form"],
     )
Beispiel #4
0
 def get_lcd(self):
     kernel_graph = KernelDG(self.kernel, self.parser, self.machine_model)
     lcd_dict = kernel_graph.get_loopcarried_dependencies()
     lcd = 0.0
     for dep in lcd_dict:
         lcd_tmp = sum(
             [x['latency_lcd'] for x in lcd_dict[dep]['dependencies']])
         lcd = lcd_tmp if lcd_tmp > lcd else lcd
     return lcd
Beispiel #5
0
 def test_loop_carried_dependency_aarch64(self):
     dg = KernelDG(
         self.kernel_aarch64_memdep,
         self.parser_AArch64,
         self.machine_model_tx2,
         self.semantics_tx2,
     )
     lc_deps = dg.get_loopcarried_dependencies()
     self.assertEqual(len(lc_deps), 2)
     # based on line 6
     self.assertEqual(lc_deps[6]["latency"], 28.0)
     self.assertEqual(
         [(iform.line_number, lat)
          for iform, lat in lc_deps[6]['dependencies']],
         [(6, 4.0), (10, 6.0), (11, 6.0), (12, 6.0), (13, 6.0), (14, 0)],
     )