def test_arrayfire_JacobiSVD(): global_env = parse_function("./arrayfire-repair/JacobiSVD.ll") target_function = global_env.get_value("@_Z9JacobiSVDPiS_ii") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%53 = load i32* %52, align 4, !dbg !65", "store i32 %140, i32* %144, align 4, !dbg !89") content = "define void @_Z9JacobiSVDPiS_ii(i32* %S, i32* %V, i32 %m, i32 %n) uwtable noinline {\n" + content + "}" write_patch_to_file("./arrayfire-repair/JacobiSVD-first.ll", content) global_env = parse_function("./arrayfire-repair/JacobiSVD-first.ll") target_function = global_env.get_value("@_Z9JacobiSVDPiS_ii") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%58 = load i32* %57, align 4, !dbg !65", "store i32 %145, i32* %149, align 4, !dbg !90") content = "define void @_Z9JacobiSVDPiS_ii(i32* %S, i32* %V, i32 %m, i32 %n) uwtable noinline {\n" + content + "}" write_patch_to_file("./arrayfire-repair/JacobiSVD-second.ll", content) print "here"
def test_gklee_barrier1(): global_env = parse_function("./gklee-test-repair/barrier1-delete.ll") target_function = global_env.get_value("@_Z2dlPi") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%34 = load i32* %33, align 4, !dbg !24", "store i32 %51, i32* %55, align 4, !dbg !27") content = "define void @_Z2dlPi(i32* %in) uwtable noinline {\n" + content + "}" write_patch_to_file("./gklee-test-repair/barrier1-first.ll", content) global_env = parse_function("./gklee-test-repair/barrier1-first.ll") target_function = global_env.get_value("@_Z2dlPi") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%46 = load i32* %45, align 4, !dbg !26", "store i32 %51, i32* %55, align 4, !dbg !27") content = "define void @_Z2dlPi(i32* %in) uwtable noinline {\n" + content + "}" write_patch_to_file("./gklee-test-repair/barrier1-second.ll", content) global_env = parse_function("./gklee-test-repair/barrier1-second.ll") target_function = global_env.get_value("@_Z2dlPi") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%34 = load i32* %33, align 4, !dbg !24", "store i32 %19, i32* %17, align 4, !dbg !19") content = "define void @_Z2dlPi(i32* %in) uwtable noinline {\n" + content + "}" write_patch_to_file("./gklee-test-repair/barrier1-repair.ll", content) print "here"
def test_arrayfire_descriptor(): global_env = parse_function("./arrayfire-repair/Descriptor1-delete.ll") target_function = global_env.get_value( "@_Z17computeDescriptorPfjjPKfS1_PKjS1_S1_S1_jiiffi") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%71 = load float* %70, align 4, !dbg !90", "store float 0.000000e+00, float* %52, align 4, !dbg !82") content = "define void @_Z17computeDescriptorPfjjPKfS1_PKjS1_S1_S1_jiiffi(float* %desc_out, i32 %desc_len, i32 %histsz, float* %x_in, float* %y_in, i32* %layer_in, float* %response_in, float* %size_in, float* %ori_in, i32 %total_feat, i32 %d, i32 %n, float %scale, float %sigma, i32 %n_layers) uwtable noinline {\n" + content + "}" write_patch_to_file("./arrayfire-repair/Descriptor1-first.ll", content) global_env = parse_function("./arrayfire-repair/Descriptor1-first.ll") target_function = global_env.get_value( "@_Z17computeDescriptorPfjjPKfS1_PKjS1_S1_S1_jiiffi") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "store float %77, float* %75, align 4, !dbg !90", "store float 0.000000e+00, float* %52, align 4, !dbg !82") content = "define void @_Z17computeDescriptorPfjjPKfS1_PKjS1_S1_S1_jiiffi(float* %desc_out, i32 %desc_len, i32 %histsz, float* %x_in, float* %y_in, i32* %layer_in, float* %response_in, float* %size_in, float* %ori_in, i32 %total_feat, i32 %d, i32 %n, float %scale, float %sigma, i32 %n_layers) uwtable noinline {\n" + content + "}" write_patch_to_file("./arrayfire-repair/Descriptor1-second.ll", content) print "here"
def test_thundersvm(): global_env = parse_function("./thundersvm-repair/smo_kernel.ll") target_function = global_env.get_value("@_Z19nu_smo_solve_kernelPKiPfS1_S1_S0_ifPKfS3_ifS1_") branch = BranchInformation( [item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0]) branch.repair_pair_statements("store float %66, float* %70, align 4, !dbg !114", "%79 = call i32 @_Z13get_block_minPKfPi(float* %77, i32* %78), !dbg !118") print "here"
def test_arrayfire(): global_env = parse_function("./arrayfire-repair/reduce.ll") target_function = global_env.get_value("@_Z11warp_reducePd") branch = BranchInformation( [item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0]) branch.repair_pair_statements("%24 = load double* %23, align 8, !dbg !31", "store double %28, double* %30, align 8, !dbg !33") print "here"
def test(): global_env = parse_function("./read_write_test.ll") target_function = global_env.get_value("@_Z13device_globalPji") branch = BranchInformation( [item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0]) # print branch.branch_map branch.repair_pair_statements("%27 = load i32* %26, align 4, !dbg !161", "store i32 %16, i32* %20, align 4, !dbg !158")
def test_arrayfire_compute_median(): global_env = parse_function("./arrayfire-repair/computeMedian.ll") target_function = global_env.get_value("@_Z13computeMedianj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_redundant_barrier_function( "call void @__syncthreads(), !dbg !31") content = 'define void @_Z13computeMedianj(i32 %iterations) uwtable noinline {' + content + "}\n" write_patch_to_file("./arrayfire-repair/computeMedian-repair.ll", content)
def test_arrayfire_compute_val_homography(): global_env = parse_function("./arrayfire-repair/homography.ll") target_function = global_env.get_value("@_Z21computeEvalHomographyjjjf") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) branch.repair_pair_statements( "%64 = load i32* %63, align 4, !dbg !52", "store i32 %25, i32* %28, align 4, !dbg !41") print "here"
def test_arrayfire_scan_dim(): global_env = parse_function("./arrayfire-repair/scan_dim.ll") target_function = global_env.get_value("@_Z15scan_dim_kerneljjjj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) branch.repair_pair_statements( "%87 = load double* %86, align 8, !dbg !78", "store double %47, double* %50, align 8, !dbg !63") print "here"
def test_arrayfire_warp_reduce1(): global_env = parse_function("./arrayfire-repair/reduce1.ll") target_function = global_env.get_value("@_Z11warp_reducePiPj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%23 = load i32* %22, align 4, !dbg !30", "store i32 %36, i32* %40, align 4, !dbg !36") content = 'define void @_Z11warp_reducePiPj(i32* %s_ptr, i32* %s_idx) nounwind uwtable section "__device__" {' + content + "}\n" write_patch_to_file("./arrayfire-repair/reduce1-repair.ll", content)
def test_arrayfire_select_matches_1(): global_env = parse_function("./arrayfire-repair/select_matches-delete.ll") target_function = global_env.get_value("@_Z14select_matchesPKjPKijji") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%31 = load i32* %30, align 4, !dbg !45", "store i32 %39, i32* %42, align 4, !dbg !47") content = "define void @_Z14select_matchesPKjPKijji(i32* %in_idx, i32* %in_dist, i32 %nfeat, i32 %nelem, i32 %max_dist) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/select_matches-repair.ll", content)
def test_arrayfire_hamming_matcher_1(): global_env = parse_function("./arrayfire-repair/hamming2.ll") target_function = global_env.get_value("@_Z15hamming_matcherPjS_jj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%149 = load i32* getelementptr inbounds ([256 x i32]* @_ZZ15hamming_matcherPjS_jjE6s_dist, i32 0, i64 0), align 4, !dbg !81", "store i32 %27, i32* %30, align 4, !dbg !44") content = "define void @_Z15hamming_matcherPjS_jj(i32* %out_idx, i32* %out_dist, i32 %max_dist, i32 %feat_len) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/hamming2-repair.ll", content)
def test_arrayfire_harris_response(): global_env = parse_function("./arrayfire-repair/harris_response.ll") target_function = global_env.get_value( "@_Z15harris_responsePfS_PKfS1_S1_jS_jfj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_redundant_barrier_function( "call void @__syncthreads(), !dbg !110") content = 'define void @_Z15harris_responsePfS_PKfS1_S1_jS_jfj(float* %score_out, float* %size_out, float* %x_in, float* %y_in, float* %scl_in, i32 %total_feat, float* %image_ptr, i32 %block_size, float %k_thr, i32 %patch_size) uwtable noinline {' + content + "}\n" write_patch_to_file("./arrayfire-repair/harris_response-repair.ll", content)
def test_arrayfire_scan_nofinal_kernel(): global_env = parse_function("./arrayfire-repair/scan_first_by_key_impl.ll") target_function = global_env.get_value("@_Z20scan_nonfinal_kerneljjj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%80 = load i8* %79, align 1, !dbg !91", "store i8 %128, i8* %131, align 1, !dbg !105") content = "define void @_Z20scan_nonfinal_kerneljjj(i32 %blocks_x, i32 %blocks_y, i32 %lim) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/scan_first_by_key_impl-repair.ll", content)
def test_kaldi_add_diag(): # global_env = parse_function("./kaldi-repair/_add_diag_mat_no.ll") # target_function = global_env.get_value("@_Z17_add_diag_mat_matdPdiPKdiiiS1_iid") # branch = BranchInformation( # [item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0]) # branch.repair_pair_statements("%93 = load double* %92, align 8, !dbg !69", "store double %66, double* %69, align 8, !dbg !56") # print 100 * "+" global_env = parse_function("./kaldi-repair/_add_diag_mat_repair.ll") target_function = global_env.get_value("@_Z17_add_diag_mat_matdPdiPKdiiiS1_iid") branch = BranchInformation( [item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0]) branch.repair_pair_statements("%93 = load double* %92, align 8, !dbg !69", "store double %100, double* %98, align 8, !dbg !72") print "here"
def test_arrayfire_hamming_matcher_unroll_2(): global_env = parse_function("./arrayfire-repair/hamming4.ll") target_function = global_env.get_value("@_Z22hamming_matcher_unrollPjS_jj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%204 = load i32* %203, align 4, !dbg !88", "store i32 %159, i32* %162, align 4, !dbg !79") content = "define void @_Z22hamming_matcher_unrollPjS_jj(i32* %out_idx, i32* %out_dist, i32 %max_dist, i32 %feat_len) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/hamming4-first.ll", content) global_env = parse_function("./arrayfire-repair/hamming4-first.ll") target_function = global_env.get_value("@_Z22hamming_matcher_unrollPjS_jj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%204 = load i32* %203, align 4, !dbg !88", "store i32 %187, i32* %190, align 4, !dbg !84") content = "define void @_Z22hamming_matcher_unrollPjS_jj(i32* %out_idx, i32* %out_dist, i32 %max_dist, i32 %feat_len) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/hamming4-second.ll", content) global_env = parse_function("./arrayfire-repair/hamming4-second.ll") target_function = global_env.get_value("@_Z22hamming_matcher_unrollPjS_jj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%148 = load i32* %147, align 4, !dbg !78", "store i32 %131, i32* %134, align 4, !dbg !74") content = "define void @_Z22hamming_matcher_unrollPjS_jj(i32* %out_idx, i32* %out_dist, i32 %max_dist, i32 %feat_len) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/hamming4-third.ll", content) global_env = parse_function("./arrayfire-repair/hamming4-third.ll") target_function = global_env.get_value("@_Z22hamming_matcher_unrollPjS_jj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%176 = load i32* %175, align 4, !dbg !83", "store i32 %187, i32* %190, align 4, !dbg !84") content = "define void @_Z22hamming_matcher_unrollPjS_jj(i32* %out_idx, i32* %out_dist, i32 %max_dist, i32 %feat_len) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/hamming4-4th.ll", content) global_env = parse_function("./arrayfire-repair/hamming4-4th.ll") target_function = global_env.get_value("@_Z22hamming_matcher_unrollPjS_jj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%215 = load i32* %214, align 4, !dbg !89", "store i32 %215, i32* %218, align 4, !dbg !89") content = "define void @_Z22hamming_matcher_unrollPjS_jj(i32* %out_idx, i32* %out_dist, i32 %max_dist, i32 %feat_len) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/hamming4-5th.ll", content) global_env = parse_function("./arrayfire-repair/hamming4-5th.ll") target_function = global_env.get_value("@_Z22hamming_matcher_unrollPjS_jj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%187 = load i32* %186, align 4, !dbg !84", "store i32 %187, i32* %190, align 4, !dbg !84") content = "define void @_Z22hamming_matcher_unrollPjS_jj(i32* %out_idx, i32* %out_dist, i32 %max_dist, i32 %feat_len) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/hamming4-6th.ll", content) global_env = parse_function("./arrayfire-repair/hamming4-6th.ll") target_function = global_env.get_value("@_Z22hamming_matcher_unrollPjS_jj") branch = BranchInformation([ item.strip() for item in target_function.raw_codes.split("\n") if len(item.strip()) != 0 ]) content = branch.repair_pair_statements( "%159 = load i32* %158, align 4, !dbg !79", "store i32 %159, i32* %162, align 4, !dbg !79") content = "define void @_Z22hamming_matcher_unrollPjS_jj(i32* %out_idx, i32* %out_dist, i32 %max_dist, i32 %feat_len) uwtable noinline {\n" + content + "\n}" write_patch_to_file("./arrayfire-repair/hamming4-7th.ll", content)