Re: [Mesa-dev] [PATCH 2/3] radeon/llvm: Set the target triple on the module

2016-02-05 Thread Tom Stellard
On Thu, Feb 04, 2016 at 02:42:15PM -0800, Matt Arsenault wrote:
> 
> > On Feb 4, 2016, at 13:02, Tom Stellard  wrote:
> > 
> > +   LLVMSetTarget(ctx->gallivm.module,
> > +
> > +#if HAVE_LLVM < 0x0306
> > +   "r600--");
> > +#else
> > +   triple);
> > +#endif
> 
> This alone does not set the datalayout, which should also be set here.
> 

Ok, I'll do this in a follow up patch.

-Tom

> -Matt

> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH 2/3] radeon/llvm: Set the target triple on the module

2016-02-04 Thread Matt Arsenault

> On Feb 4, 2016, at 13:02, Tom Stellard  wrote:
> 
> + LLVMSetTarget(ctx->gallivm.module,
> +
> +#if HAVE_LLVM < 0x0306
> + "r600--");
> +#else
> + triple);
> +#endif

This alone does not set the datalayout, which should also be set here.

-Matt___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


[Mesa-dev] [PATCH 2/3] radeon/llvm: Set the target triple on the module

2016-02-04 Thread Tom Stellard
---
 src/gallium/drivers/r600/r600_llvm.c| 2 +-
 src/gallium/drivers/radeon/radeon_llvm.h| 3 ++-
 src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c | 9 -
 src/gallium/drivers/radeonsi/si_shader.c| 4 ++--
 4 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_llvm.c 
b/src/gallium/drivers/r600/r600_llvm.c
index 232db13..8db0476 100644
--- a/src/gallium/drivers/r600/r600_llvm.c
+++ b/src/gallium/drivers/r600/r600_llvm.c
@@ -784,7 +784,7 @@ LLVMModuleRef r600_tgsi_llvm(
 {
struct tgsi_shader_info shader_info;
struct lp_build_tgsi_context * bld_base = >soa.bld_base;
-   radeon_llvm_context_init(ctx);
+   radeon_llvm_context_init(ctx, "r600--");
LLVMTypeRef Arguments[32];
unsigned ArgumentsCount = 0;
for (unsigned i = 0; i < ctx->inputs_count; i++)
diff --git a/src/gallium/drivers/radeon/radeon_llvm.h 
b/src/gallium/drivers/radeon/radeon_llvm.h
index e967ad2..9f7d039 100644
--- a/src/gallium/drivers/radeon/radeon_llvm.h
+++ b/src/gallium/drivers/radeon/radeon_llvm.h
@@ -158,7 +158,8 @@ void radeon_llvm_emit_prepare_cube_coords(struct 
lp_build_tgsi_context * bld_bas
  LLVMValueRef *coords_arg,
  LLVMValueRef *derivs_arg);
 
-void radeon_llvm_context_init(struct radeon_llvm_context * ctx);
+void radeon_llvm_context_init(struct radeon_llvm_context * ctx,
+  const char *triple);
 
 void radeon_llvm_create_func(struct radeon_llvm_context * ctx,
  LLVMTypeRef *ParamTypes, unsigned ParamCount);
diff --git a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c 
b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
index 76be376..d03ba4b 100644
--- a/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
+++ b/src/gallium/drivers/radeon/radeon_setup_tgsi_llvm.c
@@ -1452,7 +1452,7 @@ static void emit_minmax_int(const struct 
lp_build_tgsi_action *action,
emit_data->args[1], "");
 }
 
-void radeon_llvm_context_init(struct radeon_llvm_context * ctx)
+void radeon_llvm_context_init(struct radeon_llvm_context * ctx, const char 
*triple)
 {
struct lp_type type;
 
@@ -1466,6 +1466,13 @@ void radeon_llvm_context_init(struct radeon_llvm_context 
* ctx)
ctx->gallivm.context = LLVMContextCreate();
ctx->gallivm.module = LLVMModuleCreateWithNameInContext("tgsi",
ctx->gallivm.context);
+   LLVMSetTarget(ctx->gallivm.module,
+
+#if HAVE_LLVM < 0x0306
+   "r600--");
+#else
+   triple);
+#endif
ctx->gallivm.builder = LLVMCreateBuilderInContext(ctx->gallivm.context);
 
struct lp_build_tgsi_context * bld_base = >soa.bld_base;
diff --git a/src/gallium/drivers/radeonsi/si_shader.c 
b/src/gallium/drivers/radeonsi/si_shader.c
index 2192b21..6830363 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -4133,7 +4133,7 @@ static int si_generate_gs_copy_shader(struct si_screen 
*sscreen,
si_shader_ctx->type = TGSI_PROCESSOR_VERTEX;
si_shader_ctx->is_gs_copy_shader = true;
 
-   radeon_llvm_context_init(_shader_ctx->radeon_bld);
+   radeon_llvm_context_init(_shader_ctx->radeon_bld, "amdgcn--");
 
create_meta_data(si_shader_ctx);
create_function(si_shader_ctx);
@@ -4276,7 +4276,7 @@ int si_shader_create(struct si_screen *sscreen, 
LLVMTargetMachineRef tm,
assert(shader->nparam == 0);
 
memset(_shader_ctx, 0, sizeof(si_shader_ctx));
-   radeon_llvm_context_init(_shader_ctx.radeon_bld);
+   radeon_llvm_context_init(_shader_ctx.radeon_bld, "amdgcn--");
bld_base = _shader_ctx.radeon_bld.soa.bld_base;
 
if (sel->type != PIPE_SHADER_COMPUTE)
-- 
2.0.4

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev