Created
September 18, 2012 17:57
-
-
Save eholk/3744663 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "harlan.hpp" | |
cl::program g_prog(g_ctx.createAndBuildProgramFromSource("#include \"rt/gpu_common.h\"\n\n#include \"rt/gpu_only.h\"\n\n__kernel void kernel_84(region_ptr kern_66, region_ptr A_1, void __global * mainregion_73_85) {\n region __global * mainregion_73 = ((region __global *)(mainregion_73_85));\n {\n int __global * retval_70 = (&(((int __global *)(get_region_ptr(mainregion_73, (kern_66) + (sizeof(int)))))[get_global_id(0)]));\n int __global * retval_69 = (&(((int __global *)(get_region_ptr(mainregion_73, (*retval_70) + (sizeof(int)))))[get_global_id(1)]));\n int j_2 = get_global_id(0);\n int i_3 = get_global_id(1);\n *retval_69 = ((int __global *)(get_region_ptr(mainregion_73, (((int __global *)(get_region_ptr(mainregion_73, (A_1) + (sizeof(int)))))[i_3]) + (sizeof(int)))))[j_2];\n }\n}")); | |
int main() { | |
{ | |
region __global * mainregion_73 = create_region(134217728); | |
int v_71_length_82 = 4; | |
region_ptr v_71 = alloc_in_region(mainregion_73, ((sizeof(int)) * (v_71_length_82)) + (sizeof(int))); | |
*((int __global *)(get_region_ptr(mainregion_73, v_71))) = v_71_length_82; | |
((int __global *)(get_region_ptr(mainregion_73, (v_71) + (sizeof(int)))))[0] = 1; | |
((int __global *)(get_region_ptr(mainregion_73, (v_71) + (sizeof(int)))))[1] = 2; | |
((int __global *)(get_region_ptr(mainregion_73, (v_71) + (sizeof(int)))))[2] = 3; | |
((int __global *)(get_region_ptr(mainregion_73, (v_71) + (sizeof(int)))))[3] = 4; | |
int refindex_64 = 0; | |
int v_72_length_81 = 4; | |
region_ptr v_72 = alloc_in_region(mainregion_73, ((sizeof(int)) * (v_72_length_81)) + (sizeof(int))); | |
*((int __global *)(get_region_ptr(mainregion_73, v_72))) = v_72_length_81; | |
((int __global *)(get_region_ptr(mainregion_73, (v_72) + (sizeof(int)))))[0] = 1; | |
((int __global *)(get_region_ptr(mainregion_73, (v_72) + (sizeof(int)))))[1] = 2; | |
((int __global *)(get_region_ptr(mainregion_73, (v_72) + (sizeof(int)))))[2] = 3; | |
((int __global *)(get_region_ptr(mainregion_73, (v_72) + (sizeof(int)))))[3] = 4; | |
int A_1_length_80 = 2; | |
region_ptr A_1 = alloc_in_region(mainregion_73, ((sizeof(region_ptr)) * (A_1_length_80)) + (sizeof(int))); | |
*((int __global *)(get_region_ptr(mainregion_73, A_1))) = A_1_length_80; | |
((int __global *)(get_region_ptr(mainregion_73, (A_1) + (sizeof(int)))))[0] = v_71; | |
((int __global *)(get_region_ptr(mainregion_73, (A_1) + (sizeof(int)))))[1] = v_72; | |
region_ptr vec_63 = A_1; | |
if((refindex_64) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_63))))) | |
harlan_error("vector-length-error_65"); | |
int kern_66_length_79 = *((int __global *)(get_region_ptr(mainregion_73, ((int __global *)(get_region_ptr(mainregion_73, (vec_63) + (sizeof(int)))))[refindex_64]))); | |
region_ptr kern_66 = alloc_in_region(mainregion_73, ((sizeof(region_ptr)) * (kern_66_length_79)) + (sizeof(int))); | |
*((int __global *)(get_region_ptr(mainregion_73, kern_66))) = kern_66_length_79; | |
region_ptr vec_63 = A_1; | |
int refindex_64 = 0; | |
if((refindex_64) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_63))))) | |
harlan_error("vector-length-error_65"); | |
for(int i_68 = 0; i_68 < *((int __global *)(get_region_ptr(mainregion_73, ((int __global *)(get_region_ptr(mainregion_73, (vec_63) + (sizeof(int)))))[refindex_64]))); i_68= (i_68 + 1)) | |
{ | |
int vv_67_length_78 = *((int __global *)(get_region_ptr(mainregion_73, A_1))); | |
region_ptr vv_67 = alloc_in_region(mainregion_73, ((sizeof(int)) * (vv_67_length_78)) + (sizeof(int))); | |
*((int __global *)(get_region_ptr(mainregion_73, vv_67))) = vv_67_length_78; | |
((int __global *)(get_region_ptr(mainregion_73, (kern_66) + (sizeof(int)))))[i_68] = vv_67; | |
} | |
region_ptr vec_63 = A_1; | |
int refindex_64 = 0; | |
if((refindex_64) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_63))))) | |
harlan_error("vector-length-error_65"); | |
{ | |
cl::kernel kernel_84_86 = g_prog.createKernel("kernel_84"); | |
unmap_region(mainregion_73); | |
kernel_84_86.setArg(0, kern_66); | |
kernel_84_86.setArg(1, A_1); | |
kernel_84_86.setArg(2, get_cl_buffer(mainregion_73)); | |
g_queue.execute2d(kernel_84_86, *((int __global *)(get_region_ptr(mainregion_73, ((int __global *)(get_region_ptr(mainregion_73, (vec_63) + (sizeof(int)))))[refindex_64]))), *((int __global *)(get_region_ptr(mainregion_73, A_1))), 1); | |
map_region(mainregion_73); | |
} | |
region_ptr B_4 = kern_66; | |
region_ptr v_5 = B_4; | |
print("["); | |
for(int i_6 = 0; i_6 < *((int __global *)(get_region_ptr(mainregion_73, v_5))); i_6= (i_6 + 1)) | |
{ | |
if((i_6) > (0)) | |
print(" \n "); | |
int refindex_61 = i_6; | |
region_ptr vec_60 = v_5; | |
if((refindex_61) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_60))))) | |
harlan_error("vector-length-error_62"); | |
region_ptr v_7 = ((int __global *)(get_region_ptr(mainregion_73, (vec_60) + (sizeof(int)))))[refindex_61]; | |
print("["); | |
for(int i_8 = 0; i_8 < *((int __global *)(get_region_ptr(mainregion_73, v_7))); i_8= (i_8 + 1)) | |
{ | |
if((i_8) > (0)) | |
print(" "); | |
int refindex_58 = i_8; | |
region_ptr vec_57 = v_7; | |
if((refindex_58) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_57))))) | |
harlan_error("vector-length-error_59"); | |
print(((int __global *)(get_region_ptr(mainregion_73, (vec_57) + (sizeof(int)))))[refindex_58]); | |
} | |
print("]"); | |
} | |
print("]"); | |
print("\n"); | |
region_ptr vec_51 = B_4; | |
int refindex_52 = 0; | |
if((refindex_52) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_51))))) | |
harlan_error("vector-length-error_53"); | |
int refindex_55 = 0; | |
region_ptr vec_54 = ((int __global *)(get_region_ptr(mainregion_73, (vec_51) + (sizeof(int)))))[refindex_52]; | |
if((refindex_55) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_54))))) | |
harlan_error("vector-length-error_56"); | |
assert((1) == (((int __global *)(get_region_ptr(mainregion_73, (vec_54) + (sizeof(int)))))[refindex_55])); | |
region_ptr vec_45 = B_4; | |
int refindex_46 = 0; | |
if((refindex_46) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_45))))) | |
harlan_error("vector-length-error_47"); | |
int refindex_49 = 1; | |
region_ptr vec_48 = ((int __global *)(get_region_ptr(mainregion_73, (vec_45) + (sizeof(int)))))[refindex_46]; | |
if((refindex_49) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_48))))) | |
harlan_error("vector-length-error_50"); | |
assert((1) == (((int __global *)(get_region_ptr(mainregion_73, (vec_48) + (sizeof(int)))))[refindex_49])); | |
region_ptr vec_39 = B_4; | |
int refindex_40 = 1; | |
if((refindex_40) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_39))))) | |
harlan_error("vector-length-error_41"); | |
int refindex_43 = 0; | |
region_ptr vec_42 = ((int __global *)(get_region_ptr(mainregion_73, (vec_39) + (sizeof(int)))))[refindex_40]; | |
if((refindex_43) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_42))))) | |
harlan_error("vector-length-error_44"); | |
assert((2) == (((int __global *)(get_region_ptr(mainregion_73, (vec_42) + (sizeof(int)))))[refindex_43])); | |
region_ptr vec_33 = B_4; | |
int refindex_34 = 1; | |
if((refindex_34) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_33))))) | |
harlan_error("vector-length-error_35"); | |
int refindex_37 = 1; | |
region_ptr vec_36 = ((int __global *)(get_region_ptr(mainregion_73, (vec_33) + (sizeof(int)))))[refindex_34]; | |
if((refindex_37) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_36))))) | |
harlan_error("vector-length-error_38"); | |
assert((2) == (((int __global *)(get_region_ptr(mainregion_73, (vec_36) + (sizeof(int)))))[refindex_37])); | |
region_ptr vec_27 = B_4; | |
int refindex_28 = 2; | |
if((refindex_28) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_27))))) | |
harlan_error("vector-length-error_29"); | |
int refindex_31 = 0; | |
region_ptr vec_30 = ((int __global *)(get_region_ptr(mainregion_73, (vec_27) + (sizeof(int)))))[refindex_28]; | |
if((refindex_31) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_30))))) | |
harlan_error("vector-length-error_32"); | |
assert((3) == (((int __global *)(get_region_ptr(mainregion_73, (vec_30) + (sizeof(int)))))[refindex_31])); | |
region_ptr vec_21 = B_4; | |
int refindex_22 = 2; | |
if((refindex_22) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_21))))) | |
harlan_error("vector-length-error_23"); | |
int refindex_25 = 1; | |
region_ptr vec_24 = ((int __global *)(get_region_ptr(mainregion_73, (vec_21) + (sizeof(int)))))[refindex_22]; | |
if((refindex_25) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_24))))) | |
harlan_error("vector-length-error_26"); | |
assert((3) == (((int __global *)(get_region_ptr(mainregion_73, (vec_24) + (sizeof(int)))))[refindex_25])); | |
region_ptr vec_15 = B_4; | |
int refindex_16 = 3; | |
if((refindex_16) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_15))))) | |
harlan_error("vector-length-error_17"); | |
int refindex_19 = 0; | |
region_ptr vec_18 = ((int __global *)(get_region_ptr(mainregion_73, (vec_15) + (sizeof(int)))))[refindex_16]; | |
if((refindex_19) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_18))))) | |
harlan_error("vector-length-error_20"); | |
assert((4) == (((int __global *)(get_region_ptr(mainregion_73, (vec_18) + (sizeof(int)))))[refindex_19])); | |
int refindex_10 = 3; | |
region_ptr vec_9 = B_4; | |
if((refindex_10) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_9))))) | |
harlan_error("vector-length-error_11"); | |
int refindex_13 = 1; | |
region_ptr vec_12 = ((int __global *)(get_region_ptr(mainregion_73, (vec_9) + (sizeof(int)))))[refindex_10]; | |
if((refindex_13) >= (*((int __global *)(get_region_ptr(mainregion_73, vec_12))))) | |
harlan_error("vector-length-error_14"); | |
assert((4) == (((int __global *)(get_region_ptr(mainregion_73, (vec_12) + (sizeof(int)))))[refindex_13])); | |
int ret_83 = 0; | |
free_region(mainregion_73); | |
return ret_83; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment