Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save hughperkins/b382f0ddf6cbb88f9b5e1347bea0f959 to your computer and use it in GitHub Desktop.
Save hughperkins/b382f0ddf6cbb88f9b5e1347bea0f959 to your computer and use it in GitHub Desktop.
struct class_tensorflow__random__Array {
int f0[4];
};
struct class_tensorflow__random__Array_0 {
int f0[2];
};
struct class_tensorflow__random__NormalDistribution {
char f0;
};
struct class_tensorflow__random__PhiloxRandom {
struct class_tensorflow__random__Array f0;
struct class_tensorflow__random__Array_0 f1;
};
kernel void _ZN10tensorflow7func(global char* clmem0, global char* clmem1, uint v12_offset, uint v13_offset, long v14, uint v15_offset, local int *scratch);
void _Z3logf(float v1, local int *scratch);
void _Z6memcpyPvPKvm(char* v1, char* v2, long v3, local int *scratch);
kernel void _ZN10tensorflow7func(global char* clmem0, global char* clmem1, uint v12_offset, uint v13_offset, long v14, uint v15_offset, local int *scratch) {
global struct class_tensorflow__random__NormalDistribution* v15 = (global struct class_tensorflow__random__NormalDistribution*)(clmem1 + v15_offset);
global float* v13 = (global float*)(clmem1 + v13_offset);
global struct class_tensorflow__random__PhiloxRandom* v12 = (global struct class_tensorflow__random__PhiloxRandom*)(clmem0 + v12_offset);
bool v311;
bool v50;
char* v64;
char* v65;
char* v66;
char* v67;
float v17[1];
float v19[1];
float v223;
float v224;
float v237;
float v244;
float v245;
float v248;
float v249;
float v250;
float v251;
float v258;
float v259;
float v270;
float v276;
float v277;
float v279;
float v280;
float v281;
float v282;
float v283;
float v286;
global float* v287;
global float* v292;
global float* v297;
global float* v303;
global struct class_tensorflow__random__Array_0* v29;
int v115;
int v116;
int v117;
int v118;
int v119;
int v122;
int v125;
int v127;
int v129;
int v131;
int v133;
int v135;
int v137;
int v139;
int v141;
int v143;
int v145;
int v147;
int v149;
int v151;
int v153;
int v155;
int v157;
int v159;
int v161;
int v163;
int v165;
int v167;
int v169;
int v16[1];
int v171;
int v173;
int v175;
int v177;
int v179;
int v181;
int v183;
int v185;
int v187;
int v189;
int v18[1];
int v191;
int v193;
int v195;
int v197;
int v203;
int v204;
int v205;
int v206;
int v208;
int v209;
int v213;
int v217;
int v22;
int v233;
int v254;
int v25;
int v266;
int v28;
int v305;
int v306;
int v309;
int v310;
int v312;
int v314;
int v317;
int v32;
int v33;
int v35;
int v36;
int v37;
int v38;
int v39;
int v45;
int v48;
int v49;
int v51;
int v59;
int v62;
int v63;
int v68;
int v74;
int v76;
long v284;
long v290;
long v295;
long v301;
long v31;
v1:;
/* int* v20 = getelementptr v12 <unk> <unk> <unk> <unk> */;
/* int v22 = load v20 */;
v22 = (&(v12[0].f0.f0[0]))[0];
/* int* v23 = getelementptr v12 v21 <unk> <unk> <unk> */;
/* int v25 = load v23 */;
v25 = (&(v12[0].f0.f0[1]))[0];
/* int* v26 = getelementptr v12 v21 <unk> <unk> <unk> */;
/* int v28 = load v26 */;
v28 = (&(v12[0].f0.f0[2]))[0];
/* struct class_tensorflow__random__Array_0* v29 = getelementptr v12 v21 <unk> */;
v29 = (&(v12[0].f1));
/* long* v30 = bitcast v29 */;
/* long v31 = load v30 */;
v31 = ((global long*)v29)[0];
/* int v32 = call <unk> */;
v32 = get_group_id(0);
/* int v33 = call <unk> */;
v33 = get_local_size(0);
/* int v34 = mul v33 v32 */;
/* int v35 = call <unk> */;
v35 = get_local_id(0);
/* int v36 = add v34 v35 */;
v36 = (v33 * v32) + v35;
/* int v37 = call <unk> */;
v37 = get_num_groups(0);
/* int v38 = mul v37 v33 */;
v38 = v37 * v33;
/* int v39 = shl v36 <unk> */;
v39 = v36 << 2;
/* long v41 = sext v36 */;
/* long v42 = lshr v41 <unk> */;
/* int v44 = trunc v42 */;
/* int v45 = add v36 v22 */;
v45 = v36 + v22;
/* bool v46 = icmp v45 v36 */;
/* int v47 = zext v46 */;
/* int v48 = add v47 v44 */;
v48 = v45 < v36 + (int)(v36 >> 32);
/* int v49 = add v48 v25 */;
v49 = v48 + v25;
/* bool v50 = icmp v49 v48 */;
v50 = v49 < v48;
/* int v51 = add v28 <unk> */;
v51 = v28 + 1;
/* long v53 = sext v39 */;
/* bool v54 = icmp v53 v14 */;
/* if(v54) */
if (v39 < v14) {
goto v2;
} else {
goto v11;
}
v2:;
/* bool v55 = icmp v51 <unk> */;
/* int* v57 = getelementptr v12 v21 v56 v56 <unk> */;
/* int v59 = load v57 */;
v59 = (&(v12[0].f0.f0[3]))[0];
/* bool v60 = and v55 v50 */;
/* int v61 = zext v60 */;
/* int v62 = add v59 v61 */;
v62 = v59 + (v51 == 0 & v50);
/* int v63 = select v50 v51 v28 */;
v63 = v50 ? v51 : v28;
/* char* v64 = bitcast v18 */;
v64 = (char*)v18;
/* char* v65 = bitcast v19 */;
v65 = (char*)v19;
/* char* v66 = bitcast v16 */;
v66 = (char*)v16;
/* char* v67 = bitcast v17 */;
v67 = (char*)v17;
/* int v68 = add v38 <unk> */;
v68 = v38 + -1;
/* int v70 = shl v68 v40 */;
/* long v71 = sext v68 */;
/* long v72 = lshr v71 v43 */;
/* int v73 = trunc v72 */;
/* int v74 = trunc v31 */;
v74 = (int)v31;
/* long v75 = lshr v31 v43 */;
/* int v76 = trunc v75 */;
v76 = (int)(v31 >> 32);
/* int v77 = add v74 <unk> */;
/* int v79 = add v76 <unk> */;
/* int v81 = add v74 <unk> */;
/* int v83 = add v76 <unk> */;
/* int v85 = add v74 <unk> */;
/* int v87 = add v76 <unk> */;
/* int v89 = add v74 <unk> */;
/* int v91 = add v76 <unk> */;
/* int v93 = add v74 <unk> */;
/* int v95 = add v76 <unk> */;
/* int v97 = add v74 <unk> */;
/* int v99 = add v76 <unk> */;
/* int v101 = add v74 <unk> */;
/* int v103 = add v76 <unk> */;
/* int v105 = add v74 <unk> */;
/* int v107 = add v76 <unk> */;
/* int v109 = add v74 <unk> */;
/* int v111 = add v76 <unk> */;
/* int v113 = add v70 <unk> */;
/* int v115 = phi v49 */
v115 = v49;
/* int v116 = phi v45 */
v116 = v45;
/* int v117 = phi v63 */
v117 = v63;
/* int v118 = phi v62 */
v118 = v62;
/* int v119 = phi v39 */
v119 = v39;
goto v3;
v3:;
/* int v120 = mul v116 <unk> */;
/* int v122 = call v121 v116 <unk> */;
v122 = 0;
/* int v123 = mul v117 <unk> */;
/* int v125 = call v124 v117 <unk> */;
v125 = 0;
/* int v126 = xor v115 v74 */;
/* int v127 = xor v126 v125 */;
v127 = (v115 ^ v74) ^ v125;
/* int v128 = xor v118 v76 */;
/* int v129 = xor v128 v122 */;
v129 = (v118 ^ v76) ^ v122;
/* int v130 = mul v127 v121 */;
/* int v131 = call v121 v127 <unk> */;
v131 = 0;
/* int v132 = mul v129 v124 */;
/* int v133 = call v124 v129 <unk> */;
v133 = 0;
/* int v134 = xor v123 v77 */;
/* int v135 = xor v134 v133 */;
v135 = ((v117 * -845247145) ^ (v74 + -1640531527)) ^ v133;
/* int v136 = xor v120 v79 */;
/* int v137 = xor v136 v131 */;
v137 = ((v116 * -766435501) ^ (v76 + -1150833019)) ^ v131;
/* int v138 = mul v135 v121 */;
/* int v139 = call v121 v135 <unk> */;
v139 = 0;
/* int v140 = mul v137 v124 */;
/* int v141 = call v124 v137 <unk> */;
v141 = 0;
/* int v142 = xor v132 v81 */;
/* int v143 = xor v142 v141 */;
v143 = ((v129 * -845247145) ^ (v74 + 1013904242)) ^ v141;
/* int v144 = xor v130 v83 */;
/* int v145 = xor v144 v139 */;
v145 = ((v127 * -766435501) ^ (v76 + 1993301258)) ^ v139;
/* int v146 = mul v143 v121 */;
/* int v147 = call v121 v143 <unk> */;
v147 = 0;
/* int v148 = mul v145 v124 */;
/* int v149 = call v124 v145 <unk> */;
v149 = 0;
/* int v150 = xor v140 v85 */;
/* int v151 = xor v150 v149 */;
v151 = ((v137 * -845247145) ^ (v74 + -626627285)) ^ v149;
/* int v152 = xor v138 v87 */;
/* int v153 = xor v152 v147 */;
v153 = ((v135 * -766435501) ^ (v76 + 842468239)) ^ v147;
/* int v154 = mul v151 v121 */;
/* int v155 = call v121 v151 <unk> */;
v155 = 0;
/* int v156 = mul v153 v124 */;
/* int v157 = call v124 v153 <unk> */;
v157 = 0;
/* int v158 = xor v148 v89 */;
/* int v159 = xor v158 v157 */;
v159 = ((v145 * -845247145) ^ (v74 + 2027808484)) ^ v157;
/* int v160 = xor v146 v91 */;
/* int v161 = xor v160 v155 */;
v161 = ((v143 * -766435501) ^ (v76 + -308364780)) ^ v155;
/* int v162 = mul v159 v121 */;
/* int v163 = call v121 v159 <unk> */;
v163 = 0;
/* int v164 = mul v161 v124 */;
/* int v165 = call v124 v161 <unk> */;
v165 = 0;
/* int v166 = xor v156 v93 */;
/* int v167 = xor v166 v165 */;
v167 = ((v153 * -845247145) ^ (v74 + 387276957)) ^ v165;
/* int v168 = xor v154 v95 */;
/* int v169 = xor v168 v163 */;
v169 = ((v151 * -766435501) ^ (v76 + -1459197799)) ^ v163;
/* int v170 = mul v167 v121 */;
/* int v171 = call v121 v167 <unk> */;
v171 = 0;
/* int v172 = mul v169 v124 */;
/* int v173 = call v124 v169 <unk> */;
v173 = 0;
/* int v174 = xor v164 v97 */;
/* int v175 = xor v174 v173 */;
v175 = ((v161 * -845247145) ^ (v74 + -1253254570)) ^ v173;
/* int v176 = xor v162 v99 */;
/* int v177 = xor v176 v171 */;
v177 = ((v159 * -766435501) ^ (v76 + 1684936478)) ^ v171;
/* int v178 = mul v175 v121 */;
/* int v179 = call v121 v175 <unk> */;
v179 = 0;
/* int v180 = mul v177 v124 */;
/* int v181 = call v124 v177 <unk> */;
v181 = 0;
/* int v182 = xor v172 v101 */;
/* int v183 = xor v182 v181 */;
v183 = ((v169 * -845247145) ^ (v74 + 1401181199)) ^ v181;
/* int v184 = xor v170 v103 */;
/* int v185 = xor v184 v179 */;
v185 = ((v167 * -766435501) ^ (v76 + 534103459)) ^ v179;
/* int v186 = mul v183 v121 */;
/* int v187 = call v121 v183 <unk> */;
v187 = 0;
/* int v188 = mul v185 v124 */;
/* int v189 = call v124 v185 <unk> */;
v189 = 0;
/* int v190 = xor v180 v105 */;
/* int v191 = xor v190 v189 */;
v191 = ((v177 * -845247145) ^ (v74 + -239350328)) ^ v189;
/* int v192 = xor v178 v107 */;
/* int v193 = xor v192 v187 */;
v193 = ((v175 * -766435501) ^ (v76 + -616729560)) ^ v187;
/* int v194 = mul v191 v121 */;
/* int v195 = call v121 v191 <unk> */;
v195 = 0;
/* int v196 = mul v193 v124 */;
/* int v197 = call v124 v193 <unk> */;
v197 = 0;
/* int v198 = xor v188 v109 */;
/* int v199 = xor v198 v197 */;
/* int v200 = xor v186 v111 */;
/* int v201 = xor v200 v195 */;
/* bool v202 = icmp v116 v69 */;
/* if(v202) */
if (v116 == -1) {
goto v4;
} else {
/* int v203 = phi v115 */
v203 = v115;
/* int v204 = phi v117 */
v204 = v117;
/* int v205 = phi v118 */
v205 = v118;
goto v5;
}
v4:;
/* int v206 = add v115 v52 */;
v206 = v115 + 1;
/* bool v207 = icmp v206 v56 */;
/* int v208 = add v117 v52 */;
v208 = v117 + 1;
/* int v209 = select v207 v208 v117 */;
v209 = v206 == 0 ? v208 : v117;
/* int v210 = or v208 v206 */;
/* bool v211 = icmp v210 v56 */;
/* int v212 = zext v211 */;
/* int v213 = add v212 v118 */;
v213 = v208 | v206 == 0 + v118;
/* int v203 = phi v206 */
v203 = v206;
/* int v204 = phi v209 */
v204 = v209;
/* int v205 = phi v213 */
v205 = v213;
goto v5;
v5:;
/* int v214 = and v199 <unk> */;
/* int v217 = or v214 <unk> */;
v217 = ((((v185 * -845247145) ^ (v74 + 7554945)) ^ v197) & 8388607) | 1065353216;
/* void v219 = store v217 v18 */;
v18[0] = v217;
_Z6memcpyPvPKvm(v65, v64, 4, scratch);
/* float v223 = load v19 */;
v223 = v19[0];
/* float v224 = fadd v223 <unk> */;
v224 = v223 + -1.0f;
/* bool v228 = fcmp v224 <unk> */;
/* float v230 = select v228 v229 v224 */;
/* int v231 = and v196 v215 */;
/* int v233 = or v231 v218 */;
v233 = ((v193 * -845247145) & 8388607) | 1065353216;
/* void v234 = store v233 v16 */;
v16[0] = v233;
_Z6memcpyPvPKvm(v67, v66, 4, scratch);
/* float v237 = load v17 */;
v237 = v17[0];
/* float v238 = fadd v237 v225 */;
/* float v241 = fpext v238 */;
/* float v242 = fmul v241 <unk> */;
/* float v244 = fptrunc v242 */;
v244 = (float)((v237 + -1.0f) * 6.28319f);
/* float v245 = call v230 <unk> */;
v245 = _Z3logf(v224 < 1e-07.0f ? 1e-07.0f : v224, scratch);
/* float v246 = fmul v245 <unk> */;
/* float v248 = call v246 <unk> */;
v248 = sqrt(v245 * -2.0f);
/* float v249 = call v244 <unk> */;
v249 = sin(v244);
/* float v250 = call v244 <unk> */;
v250 = cos(v244);
/* float v251 = fmul v248 v250 */;
v251 = v248 * v250;
/* int v252 = and v201 v215 */;
/* int v254 = or v252 v218 */;
v254 = ((((v183 * -766435501) ^ (v76 + 2433709)) ^ v195) & 8388607) | 1065353216;
/* void v255 = store v254 v18 */;
v18[0] = v254;
_Z6memcpyPvPKvm(v65, v64, 4, scratch);
/* float v258 = load v19 */;
v258 = v19[0];
/* float v259 = fadd v258 v225 */;
v259 = v258 + -1.0f;
/* bool v262 = fcmp v259 v229 */;
/* float v263 = select v262 v229 v259 */;
/* int v264 = and v194 v215 */;
/* int v266 = or v264 v218 */;
v266 = ((v191 * -766435501) & 8388607) | 1065353216;
/* void v267 = store v266 v16 */;
v16[0] = v266;
_Z6memcpyPvPKvm(v67, v66, 4, scratch);
/* float v270 = load v17 */;
v270 = v17[0];
/* float v271 = fadd v270 v225 */;
/* float v274 = fpext v271 */;
/* float v275 = fmul v274 v243 */;
/* float v276 = fptrunc v275 */;
v276 = (float)((v270 + -1.0f) * 6.28319f);
/* float v277 = call v263 <unk> */;
v277 = _Z3logf(v259 < 1e-07.0f ? 1e-07.0f : v259, scratch);
/* float v278 = fmul v277 v247 */;
/* float v279 = call v278 <unk> */;
v279 = sqrt(v277 * -2.0f);
/* float v280 = call v276 <unk> */;
v280 = sin(v276);
/* float v281 = call v276 <unk> */;
v281 = cos(v276);
/* float v282 = fmul v279 v280 */;
v282 = v279 * v280;
/* float v283 = fmul v279 v281 */;
v283 = v279 * v281;
/* long v284 = sext v119 */;
v284 = v119;
/* bool v285 = icmp v284 v14 */;
/* if(v285) */
if (v284 < v14) {
goto v6;
} else {
goto v10;
}
v6:;
/* float v286 = fmul v248 v249 */;
v286 = v248 * v249;
/* float* v287 = getelementptr v13 v284 */;
v287 = (&(v13[v284]));
/* void v288 = store v286 v287 */;
v287[0] = v286;
/* int v289 = or v119 v52 */;
/* long v290 = sext v289 */;
v290 = v119 | 1;
/* bool v291 = icmp v290 v14 */;
/* if(v291) */
if (v290 < v14) {
goto v7;
} else {
goto v10;
}
v7:;
/* float* v292 = getelementptr v13 v290 */;
v292 = (&(v13[v290]));
/* void v293 = store v251 v292 */;
v292[0] = v251;
/* int v294 = or v119 v40 */;
/* long v295 = sext v294 */;
v295 = v119 | 2;
/* bool v296 = icmp v295 v14 */;
/* if(v296) */
if (v295 < v14) {
goto v8;
} else {
goto v10;
}
v8:;
/* float* v297 = getelementptr v13 v295 */;
v297 = (&(v13[v295]));
/* void v298 = store v282 v297 */;
v297[0] = v282;
/* int v299 = or v119 <unk> */;
/* long v301 = sext v299 */;
v301 = v119 | 3;
/* bool v302 = icmp v301 v14 */;
/* if(v302) */
if (v301 < v14) {
goto v9;
} else {
goto v10;
}
v9:;
/* float* v303 = getelementptr v13 v301 */;
v303 = (&(v13[v301]));
/* void v304 = store v283 v303 */;
v303[0] = v283;
/* int v305 = add v113 v119 */;
v305 = ((v68 << 2) + 4) + v119;
/* int v306 = add v116 v38 */;
v306 = v116 + v38;
/* bool v307 = icmp v306 v68 */;
/* int v308 = zext v307 */;
/* int v309 = add v308 v73 */;
v309 = v306 < v68 + (int)(v68 >> 32);
/* int v310 = add v203 v309 */;
v310 = v203 + v309;
/* bool v311 = icmp v310 v309 */;
v311 = v310 < v309;
/* int v312 = add v204 v52 */;
v312 = v204 + 1;
/* bool v313 = icmp v312 v56 */;
/* int v314 = select v311 v312 v204 */;
v314 = v311 ? v312 : v204;
/* bool v315 = and v311 v313 */;
/* int v316 = zext v315 */;
/* int v317 = add v316 v205 */;
v317 = (v311 & v312 == 0) + v205;
/* long v318 = sext v305 */;
/* bool v319 = icmp v318 v14 */;
/* if(v319) */
if (v305 < v14) {
/* int v115 = phi v310 */
v115 = v310;
/* int v116 = phi v306 */
v116 = v306;
/* int v117 = phi v314 */
v117 = v314;
/* int v118 = phi v317 */
v118 = v317;
/* int v119 = phi v305 */
v119 = v305;
goto v3;
} else {
goto v10;
}
v10:;
goto v11;
v11:;
return;
}
void _Z3logf(float v1, local int *scratch) {
}
void _Z6memcpyPvPKvm(char* v1, char* v2, long v3, local int *scratch) {
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment