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 unsigned r600_create_shader(struct r600_bytecode *bc, const struct radeon_shader_binary *binary, boolean *use_kill) { assert(binary->code_size % 4 == 0); bc->bytecode = CALLOC(1, binary->code_size); memcpy(bc->bytecode, binary->code, binary->code_size); bc->ndw = binary->code_size / 4; r600_shader_binary_read_config(binary, bc, 0, use_kill); return 0; }
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); }