| 321 | } |
| 322 | |
| 323 | int |
| 324 | kgenDeclareLocalID( |
| 325 | struct KgenContext *ctx, |
| 326 | const char *lidName, |
| 327 | const PGranularity *pgran) |
| 328 | { |
| 329 | char tmp[128]; |
| 330 | int r; |
| 331 | |
| 332 | if (pgran->wgDim == 1) { |
| 333 | sprintf(tmp, "const int %s = get_local_id(0);\n", lidName); |
| 334 | } |
| 335 | else { |
| 336 | sprintf(tmp, "const int %s = get_local_id(1) * %u + " |
| 337 | "get_local_id(0);\n", |
| 338 | lidName, pgran->wgSize[0]); |
| 339 | } |
| 340 | |
| 341 | r = kgenAddStmt(ctx, tmp); |
| 342 | |
| 343 | return (r) ? -EOVERFLOW : 0; |
| 344 | } |
| 345 | |
| 346 | int |
| 347 | kgenDeclareGroupID( |
no test coverage detected