unsigned si_llvm_compile(LLVMModuleRef M, struct si_shader_binary *binary,
struct ac_llvm_compiler *compiler,
struct pipe_debug_callback *debug,
- bool less_optimized)
+ bool less_optimized, unsigned wave_size)
{
- struct ac_compiler_passes *passes =
- less_optimized && compiler->low_opt_passes ?
- compiler->low_opt_passes : compiler->passes;
+ struct ac_compiler_passes *passes = compiler->passes;
+
+ if (wave_size == 32)
+ passes = compiler->passes_wave32;
+ else if (less_optimized && compiler->low_opt_passes)
+ passes = compiler->low_opt_passes;
+
struct si_llvm_diagnostics diag;
LLVMContextRef llvm_ctx;
void si_llvm_context_init(struct si_shader_context *ctx,
struct si_screen *sscreen,
- struct ac_llvm_compiler *compiler)
+ struct ac_llvm_compiler *compiler,
+ unsigned wave_size,
+ unsigned ballot_mask_bits)
{
struct lp_type type;
ctx->screen = sscreen;
ctx->compiler = compiler;
- enum ac_float_mode float_mode =
- sscreen->debug_flags & DBG(UNSAFE_MATH) ?
- AC_FLOAT_MODE_UNSAFE_FP_MATH :
- AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH;
-
ac_llvm_context_init(&ctx->ac, compiler, sscreen->info.chip_class,
- sscreen->info.family, float_mode, 64);
+ sscreen->info.family,
+ AC_FLOAT_MODE_NO_SIGNED_ZEROS_FP_MATH,
+ wave_size, ballot_mask_bits);
ctx->gallivm.context = ctx->ac.context;
ctx->gallivm.module = ctx->ac.module;
bld_base->op_actions[TGSI_OPCODE_ENDIF].emit = endif_emit;
bld_base->op_actions[TGSI_OPCODE_ENDLOOP].emit = endloop_emit;
- si_shader_context_init_alu(&ctx->bld_base);
+ si_shader_context_init_alu(ctx);
si_shader_context_init_mem(ctx);
ctx->voidt = LLVMVoidTypeInContext(ctx->ac.context);
/* Set the context to a certain TGSI shader. Can be called repeatedly
* to change the shader. */
-void si_llvm_context_set_tgsi(struct si_shader_context *ctx,
- struct si_shader *shader)
+void si_llvm_context_set_ir(struct si_shader_context *ctx,
+ struct si_shader *shader)
{
- const struct tgsi_shader_info *info = NULL;
- const struct tgsi_token *tokens = NULL;
-
- if (shader && shader->selector) {
- info = &shader->selector->info;
- tokens = shader->selector->tokens;
- }
+ struct si_shader_selector *sel = shader->selector;
+ const struct tgsi_shader_info *info = &sel->info;
ctx->shader = shader;
- ctx->type = info ? info->processor : -1;
+ ctx->type = sel->type;
ctx->bld_base.info = info;
/* Clean up the old contents. */
ctx->temps = NULL;
ctx->temps_count = 0;
- if (!info)
- return;
-
ctx->num_const_buffers = util_last_bit(info->const_buffers_declared);
ctx->num_shader_buffers = util_last_bit(info->shader_buffers_declared);
ctx->num_samplers = util_last_bit(info->samplers_declared);
ctx->num_images = util_last_bit(info->images_declared);
- if (!tokens)
+ if (sel->nir)
return;
if (info->array_max[TGSI_FILE_TEMPORARY] > 0) {
ctx->temp_arrays = CALLOC(size, sizeof(ctx->temp_arrays[0]));
ctx->temp_array_allocas = CALLOC(size, sizeof(ctx->temp_array_allocas[0]));
- tgsi_scan_arrays(tokens, TGSI_FILE_TEMPORARY, size,
+ tgsi_scan_arrays(sel->tokens, TGSI_FILE_TEMPORARY, size,
ctx->temp_arrays);
}
if (info->file_max[TGSI_FILE_IMMEDIATE] >= 0) {