Example #1
0
def kernel(north, south, east, west, max_wg_size, source):
    """
  Perform feature extraction on a kernel.
  """
    bitcode = llvm.bitcode(source)
    instcounts = llvm.instcounts(bitcode)
    ratios = llvm.instcounts2ratios(instcounts)
    return (
        north,  # north
        south,  # south
        east,  # east
        west,  # west
        max_wg_size,  # max_wg_size
        ratios.get("instruction_count", 0),  # instruction_count
        ratios.get("ratio AShr insts", 0),  # ratio_AShr_insts
        ratios.get("ratio Add insts", 0),  # ratio_Add_insts
        ratios.get("ratio Alloca insts", 0),  # ratio_Alloca_insts
        ratios.get("ratio And insts", 0),  # ratio_And_insts
        ratios.get("ratio Br insts", 0),  # ratio_Br_insts
        ratios.get("ratio Call insts", 0),  # ratio_Call_insts
        ratios.get("ratio FAdd insts", 0),  # ratio_FAdd_insts
        ratios.get("ratio FCmp insts", 0),  # ratio_FCmp_insts
        ratios.get("ratio FDiv insts", 0),  # ratio_FDiv_insts
        ratios.get("ratio FMul insts", 0),  # ratio_FMul_insts
        ratios.get("ratio FPExt insts", 0),  # ratio_FPExt_insts
        ratios.get("ratio FPToSI insts", 0),  # ratio_FPToSI_insts
        ratios.get("ratio FSub insts", 0),  # ratio_FSub_insts
        ratios.get("ratio GetElementPtr insts",
                   0),  # ratio_GetElementPtr_insts
        ratios.get("ratio ICmp insts", 0),  # ratio_ICmp_insts
        ratios.get("ratio InsertValue insts", 0),  # ratio_InsertValue_insts
        ratios.get("ratio Load insts", 0),  # ratio_Load_insts
        ratios.get("ratio Mul insts", 0),  # ratio_Mul_insts
        ratios.get("ratio Or insts", 0),  # ratio_Or_insts
        ratios.get("ratio PHI insts", 0),  # ratio_PHI_insts
        ratios.get("ratio Ret insts", 0),  # ratio_Ret_insts
        ratios.get("ratio SDiv insts", 0),  # ratio_SDiv_insts
        ratios.get("ratio SExt insts", 0),  # ratio_SExt_insts
        ratios.get("ratio SIToFP insts", 0),  # ratio_SIToFP_insts
        ratios.get("ratio SRem insts", 0),  # ratio_SRem_insts
        ratios.get("ratio Select insts", 0),  # ratio_Select_insts
        ratios.get("ratio Shl insts", 0),  # ratio_Shl_insts
        ratios.get("ratio Store insts", 0),  # ratio_Store_insts
        ratios.get("ratio Sub insts", 0),  # ratio_Sub_insts
        ratios.get("ratio Trunc insts", 0),  # ratio_Trunc_insts
        ratios.get("ratio UDiv insts", 0),  # ratio_UDiv_insts
        ratios.get("ratio Xor insts", 0),  # ratio_Xor_insts
        ratios.get("ratio ZExt insts", 0),  # ratio_ZExt_insts
        ratios.get("ratio basic blocks", 0),  # ratio_basic_blocks
        ratios.get("ratio memory instructions",
                   0),  # ratio_memory_instructions
        ratios.get("ratio non-external functions", 0)
        # ratio_non_external_functions
    )
Example #2
0
def kernel(north, south, east, west, max_wg_size, source):
    """
    Perform feature extraction on a kernel.
    """
    bitcode = llvm.bitcode(source)
    instcounts = llvm.instcounts(bitcode)
    ratios = llvm.instcounts2ratios(instcounts)
    return (
        north,                                        # north
        south,                                        # south
        east,                                         # east
        west,                                         # west
        max_wg_size,                                  # max_wg_size
        ratios.get("instruction_count", 0),           # instruction_count
        ratios.get("ratio AShr insts", 0),            # ratio_AShr_insts
        ratios.get("ratio Add insts", 0),             # ratio_Add_insts
        ratios.get("ratio Alloca insts", 0),          # ratio_Alloca_insts
        ratios.get("ratio And insts", 0),             # ratio_And_insts
        ratios.get("ratio Br insts", 0),              # ratio_Br_insts
        ratios.get("ratio Call insts", 0),            # ratio_Call_insts
        ratios.get("ratio FAdd insts", 0),            # ratio_FAdd_insts
        ratios.get("ratio FCmp insts", 0),            # ratio_FCmp_insts
        ratios.get("ratio FDiv insts", 0),            # ratio_FDiv_insts
        ratios.get("ratio FMul insts", 0),            # ratio_FMul_insts
        ratios.get("ratio FPExt insts", 0),           # ratio_FPExt_insts
        ratios.get("ratio FPToSI insts", 0),          # ratio_FPToSI_insts
        ratios.get("ratio FSub insts", 0),            # ratio_FSub_insts
        ratios.get("ratio GetElementPtr insts", 0),   # ratio_GetElementPtr_insts
        ratios.get("ratio ICmp insts", 0),            # ratio_ICmp_insts
        ratios.get("ratio InsertValue insts", 0),     # ratio_InsertValue_insts
        ratios.get("ratio Load insts", 0),            # ratio_Load_insts
        ratios.get("ratio Mul insts", 0),             # ratio_Mul_insts
        ratios.get("ratio Or insts", 0),              # ratio_Or_insts
        ratios.get("ratio PHI insts", 0),             # ratio_PHI_insts
        ratios.get("ratio Ret insts", 0),             # ratio_Ret_insts
        ratios.get("ratio SDiv insts", 0),            # ratio_SDiv_insts
        ratios.get("ratio SExt insts", 0),            # ratio_SExt_insts
        ratios.get("ratio SIToFP insts", 0),          # ratio_SIToFP_insts
        ratios.get("ratio SRem insts", 0),            # ratio_SRem_insts
        ratios.get("ratio Select insts", 0),          # ratio_Select_insts
        ratios.get("ratio Shl insts", 0),             # ratio_Shl_insts
        ratios.get("ratio Store insts", 0),           # ratio_Store_insts
        ratios.get("ratio Sub insts", 0),             # ratio_Sub_insts
        ratios.get("ratio Trunc insts", 0),           # ratio_Trunc_insts
        ratios.get("ratio UDiv insts", 0),            # ratio_UDiv_insts
        ratios.get("ratio Xor insts", 0),             # ratio_Xor_insts
        ratios.get("ratio ZExt insts", 0),            # ratio_ZExt_insts
        ratios.get("ratio basic blocks", 0),          # ratio_basic_blocks
        ratios.get("ratio memory instructions", 0),   # ratio_memory_instructions
        ratios.get("ratio non-external functions", 0) # ratio_non_external_functions
    )
Example #3
0
 def test_instcounts_cl(self):
     self._test(
         self.stencil_gaussian_kernel_ic_json,
         llvm.instcounts(self.stencil_gaussian_kernel_bc,
                         path=self.LLVM_PATH),
     )
Example #4
0
 def test_instcounts_cl(self):
     self._test(self.stencil_gaussian_kernel_ic_json,
                llvm.instcounts(self.stencil_gaussian_kernel_bc,
                                path=self.LLVM_PATH))