radeonsi: add triple into si_compiler
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com> Tested-by: Benedikt Schemmer <ben at besd.de> Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
This commit is contained in:
@@ -123,7 +123,9 @@ const char *ac_get_llvm_processor_name(enum radeon_family family)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, enum ac_target_machine_options tm_options)
|
LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family,
|
||||||
|
enum ac_target_machine_options tm_options,
|
||||||
|
const char **out_triple)
|
||||||
{
|
{
|
||||||
assert(family >= CHIP_TAHITI);
|
assert(family >= CHIP_TAHITI);
|
||||||
char features[256];
|
char features[256];
|
||||||
@@ -146,6 +148,8 @@ LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, enum ac
|
|||||||
LLVMRelocDefault,
|
LLVMRelocDefault,
|
||||||
LLVMCodeModelDefault);
|
LLVMCodeModelDefault);
|
||||||
|
|
||||||
|
if (out_triple)
|
||||||
|
*out_triple = triple;
|
||||||
return tm;
|
return tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -68,7 +68,9 @@ enum ac_float_mode {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const char *ac_get_llvm_processor_name(enum radeon_family family);
|
const char *ac_get_llvm_processor_name(enum radeon_family family);
|
||||||
LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, enum ac_target_machine_options tm_options);
|
LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family,
|
||||||
|
enum ac_target_machine_options tm_options,
|
||||||
|
const char **out_triple);
|
||||||
|
|
||||||
LLVMTargetRef ac_get_llvm_target(const char *triple);
|
LLVMTargetRef ac_get_llvm_target(const char *triple);
|
||||||
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
|
void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
|
||||||
|
@@ -491,7 +491,7 @@ shader_variant_create(struct radv_device *device,
|
|||||||
tm_options |= AC_TM_SUPPORTS_SPILL;
|
tm_options |= AC_TM_SUPPORTS_SPILL;
|
||||||
if (device->instance->perftest_flags & RADV_PERFTEST_SISCHED)
|
if (device->instance->perftest_flags & RADV_PERFTEST_SISCHED)
|
||||||
tm_options |= AC_TM_SISCHED;
|
tm_options |= AC_TM_SISCHED;
|
||||||
tm = ac_create_target_machine(chip_family, tm_options);
|
tm = ac_create_target_machine(chip_family, tm_options, NULL);
|
||||||
|
|
||||||
if (gs_copy_shader) {
|
if (gs_copy_shader) {
|
||||||
assert(shader_count == 1);
|
assert(shader_count == 1);
|
||||||
|
@@ -111,7 +111,8 @@ static void si_init_compiler(struct si_screen *sscreen,
|
|||||||
(sscreen->info.chip_class < GFX9 ? AC_TM_FORCE_DISABLE_XNACK : 0) |
|
(sscreen->info.chip_class < GFX9 ? AC_TM_FORCE_DISABLE_XNACK : 0) |
|
||||||
(!sscreen->llvm_has_working_vgpr_indexing ? AC_TM_PROMOTE_ALLOCA_TO_SCRATCH : 0);
|
(!sscreen->llvm_has_working_vgpr_indexing ? AC_TM_PROMOTE_ALLOCA_TO_SCRATCH : 0);
|
||||||
|
|
||||||
compiler->tm = ac_create_target_machine(sscreen->info.family, tm_options);
|
compiler->tm = ac_create_target_machine(sscreen->info.family,
|
||||||
|
tm_options, &compiler->triple);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void si_destroy_compiler(struct si_compiler *compiler)
|
static void si_destroy_compiler(struct si_compiler *compiler)
|
||||||
|
@@ -314,6 +314,7 @@ struct si_shader;
|
|||||||
/* Per-thread persistent LLVM objects. */
|
/* Per-thread persistent LLVM objects. */
|
||||||
struct si_compiler {
|
struct si_compiler {
|
||||||
LLVMTargetMachineRef tm;
|
LLVMTargetMachineRef tm;
|
||||||
|
const char *triple;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* State of the context creating the shader object. */
|
/* State of the context creating the shader object. */
|
||||||
|
@@ -1009,7 +1009,7 @@ void si_llvm_context_init(struct si_shader_context *ctx,
|
|||||||
ctx->gallivm.context = LLVMContextCreate();
|
ctx->gallivm.context = LLVMContextCreate();
|
||||||
ctx->gallivm.module = LLVMModuleCreateWithNameInContext("tgsi",
|
ctx->gallivm.module = LLVMModuleCreateWithNameInContext("tgsi",
|
||||||
ctx->gallivm.context);
|
ctx->gallivm.context);
|
||||||
LLVMSetTarget(ctx->gallivm.module, "amdgcn--");
|
LLVMSetTarget(ctx->gallivm.module, compiler->triple);
|
||||||
|
|
||||||
LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(compiler->tm);
|
LLVMTargetDataRef data_layout = LLVMCreateTargetDataLayout(compiler->tm);
|
||||||
char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout);
|
char *data_layout_str = LLVMCopyStringRepOfTargetData(data_layout);
|
||||||
|
Reference in New Issue
Block a user