static void evergreen_launch_grid( struct pipe_context *ctx_, const uint *block_layout, const uint *grid_layout, uint32_t pc, const void *input) { struct r600_context *ctx = (struct r600_context *)ctx_; #ifdef HAVE_OPENCL COMPUTE_DBG(ctx->screen, "*** evergreen_launch_grid: pc = %u\n", pc); struct r600_pipe_compute *shader = ctx->cs_shader_state.shader; if (!shader->kernels[pc].code_bo) { void *p; struct r600_kernel *kernel = &shader->kernels[pc]; r600_compute_shader_create(ctx_, kernel->llvm_module, &kernel->bc); kernel->code_bo = r600_compute_buffer_alloc_vram(ctx->screen, kernel->bc.ndw * 4); p = r600_buffer_mmap_sync_with_rings(ctx, kernel->code_bo, PIPE_TRANSFER_WRITE); memcpy(p, kernel->bc.bytecode, kernel->bc.ndw * 4); ctx->ws->buffer_unmap(kernel->code_bo->cs_buf); } #endif ctx->cs_shader_state.kernel_index = pc; evergreen_compute_upload_input(ctx_, block_layout, grid_layout, input); compute_emit_cs(ctx, block_layout, grid_layout); }
static void evergreen_launch_grid( struct pipe_context *ctx_, const uint *block_layout, const uint *grid_layout, uint32_t pc, const void *input) { struct r600_context *ctx = (struct r600_context *)ctx_; #ifdef HAVE_OPENCL struct r600_pipe_compute *shader = ctx->cs_shader_state.shader; boolean use_kill; #if HAVE_LLVM < 0x0306 struct r600_kernel *kernel = &shader->kernels[pc]; (void)use_kill; if (!kernel->code_bo) { void *p; struct r600_bytecode *bc = &kernel->bc; LLVMModuleRef mod = kernel->llvm_module; boolean use_kill = false; bool dump = (ctx->screen->b.debug_flags & DBG_CS) != 0; unsigned use_sb = ctx->screen->b.debug_flags & DBG_SB_CS; unsigned sb_disasm = use_sb || (ctx->screen->b.debug_flags & DBG_SB_DISASM); r600_bytecode_init(bc, ctx->b.chip_class, ctx->b.family, ctx->screen->has_compressed_msaa_texturing); bc->type = TGSI_PROCESSOR_COMPUTE; bc->isa = ctx->isa; r600_llvm_compile(mod, ctx->b.family, bc, &use_kill, dump, &ctx->b.debug); if (dump && !sb_disasm) { r600_bytecode_disasm(bc); } else if ((dump && sb_disasm) || use_sb) { if (r600_sb_bytecode_process(ctx, bc, NULL, dump, use_sb)) R600_ERR("r600_sb_bytecode_process failed!\n"); } kernel->code_bo = r600_compute_buffer_alloc_vram(ctx->screen, kernel->bc.ndw * 4); p = r600_buffer_map_sync_with_rings(&ctx->b, kernel->code_bo, PIPE_TRANSFER_WRITE); memcpy(p, kernel->bc.bytecode, kernel->bc.ndw * 4); ctx->b.ws->buffer_unmap(kernel->code_bo->buf); } shader->active_kernel = kernel; ctx->cs_shader_state.kernel_index = pc; #else ctx->cs_shader_state.pc = pc; /* Get the config information for this kernel. */ r600_shader_binary_read_config(&shader->binary, &shader->bc, pc, &use_kill); #endif #endif COMPUTE_DBG(ctx->screen, "*** evergreen_launch_grid: pc = %u\n", pc); evergreen_compute_upload_input(ctx_, block_layout, grid_layout, input); compute_emit_cs(ctx, block_layout, grid_layout); }
static void evergreen_launch_grid( struct pipe_context *ctx_, const uint *block_layout, const uint *grid_layout, uint32_t pc, const void *input) { struct r600_context *ctx = (struct r600_context *)ctx_; COMPUTE_DBG("PC: %i\n", pc); evergreen_compute_upload_input(ctx_, block_layout, grid_layout, input); compute_emit_cs(ctx, block_layout, grid_layout); }
static void evergreen_launch_grid(struct pipe_context *ctx, const struct pipe_grid_info *info) { struct r600_context *rctx = (struct r600_context *)ctx; #ifdef HAVE_OPENCL struct r600_pipe_compute *shader = rctx->cs_shader_state.shader; boolean use_kill; rctx->cs_shader_state.pc = info->pc; /* Get the config information for this kernel. */ r600_shader_binary_read_config(&shader->binary, &shader->bc, info->pc, &use_kill); #endif COMPUTE_DBG(rctx->screen, "*** evergreen_launch_grid: pc = %u\n", info->pc); evergreen_compute_upload_input(ctx, info); compute_emit_cs(rctx, info); }
static void evergreen_launch_grid( struct pipe_context *ctx_, const uint *block_layout, const uint *grid_layout, uint32_t pc, const void *input) { COMPUTE_DBG("PC: %i\n", pc); struct r600_context *ctx = (struct r600_context *)ctx_; unsigned num_waves; unsigned num_pipes = ctx->screen->info.r600_max_pipes; unsigned wave_divisor = (16 * num_pipes); /* num_waves = ceil((tg_size.x * tg_size.y, tg_size.z) / (16 * num_pipes)) */ num_waves = (block_layout[0] * block_layout[1] * block_layout[2] + wave_divisor - 1) / wave_divisor; COMPUTE_DBG("Using %u pipes, there are %u wavefronts per thread block\n", num_pipes, num_waves); evergreen_set_lds(ctx->cs_shader, 0, 0, num_waves); evergreen_compute_upload_input(ctx_, block_layout, grid_layout, input); evergreen_direct_dispatch(ctx_, block_layout, grid_layout); compute_emit_cs(ctx); }