Added
Link Here
|
1 |
https://gitlab.freedesktop.org/mesa/mesa/commit/648dc52367c6 |
2 |
|
3 |
--- src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c.orig 2019-01-17 11:26:22 UTC |
4 |
+++ src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c |
5 |
@@ -698,17 +698,25 @@ static void store_emit( |
6 |
} |
7 |
|
8 |
if (target == TGSI_TEXTURE_BUFFER) { |
9 |
- LLVMValueRef buf_args[] = { |
10 |
+ LLVMValueRef buf_args[6] = { |
11 |
value, |
12 |
args.resource, |
13 |
vindex, |
14 |
ctx->i32_0, /* voffset */ |
15 |
- LLVMConstInt(ctx->i1, !!(args.cache_policy & ac_glc), 0), |
16 |
- LLVMConstInt(ctx->i1, !!(args.cache_policy & ac_slc), 0), |
17 |
}; |
18 |
|
19 |
+ if (HAVE_LLVM >= 0x0800) { |
20 |
+ buf_args[4] = ctx->i32_0; /* soffset */ |
21 |
+ buf_args[5] = LLVMConstInt(ctx->i1, args.cache_policy, 0); |
22 |
+ } else { |
23 |
+ buf_args[4] = LLVMConstInt(ctx->i1, !!(args.cache_policy & ac_glc), 0); |
24 |
+ buf_args[5] = LLVMConstInt(ctx->i1, !!(args.cache_policy & ac_slc), 0); |
25 |
+ } |
26 |
+ |
27 |
emit_data->output[emit_data->chan] = ac_build_intrinsic( |
28 |
- &ctx->ac, "llvm.amdgcn.buffer.store.format.v4f32", |
29 |
+ &ctx->ac, |
30 |
+ HAVE_LLVM >= 0x0800 ? "llvm.amdgcn.struct.buffer.store.format.v4f32" : |
31 |
+ "llvm.amdgcn.buffer.store.format.v4f32", |
32 |
ctx->voidt, buf_args, 6, |
33 |
ac_get_store_intr_attribs(writeonly_memory)); |
34 |
} else { |
35 |
@@ -830,8 +838,35 @@ static void atomic_emit( |
36 |
vindex = args.coords[0]; /* for buffers only */ |
37 |
} |
38 |
|
39 |
- if (inst->Src[0].Register.File == TGSI_FILE_BUFFER || |
40 |
+ if (HAVE_LLVM >= 0x0800 && |
41 |
+ inst->Src[0].Register.File != TGSI_FILE_BUFFER && |
42 |
inst->Memory.Texture == TGSI_TEXTURE_BUFFER) { |
43 |
+ LLVMValueRef buf_args[7]; |
44 |
+ unsigned num_args = 0; |
45 |
+ |
46 |
+ buf_args[num_args++] = args.data[0]; |
47 |
+ if (inst->Instruction.Opcode == TGSI_OPCODE_ATOMCAS) |
48 |
+ buf_args[num_args++] = args.data[1]; |
49 |
+ |
50 |
+ buf_args[num_args++] = args.resource; |
51 |
+ buf_args[num_args++] = vindex; |
52 |
+ buf_args[num_args++] = voffset; |
53 |
+ buf_args[num_args++] = ctx->i32_0; /* soffset */ |
54 |
+ buf_args[num_args++] = LLVMConstInt(ctx->i32, args.cache_policy & ac_slc, 0); |
55 |
+ |
56 |
+ char intrinsic_name[64]; |
57 |
+ snprintf(intrinsic_name, sizeof(intrinsic_name), |
58 |
+ "llvm.amdgcn.struct.buffer.atomic.%s", action->intr_name); |
59 |
+ emit_data->output[emit_data->chan] = |
60 |
+ ac_to_float(&ctx->ac, |
61 |
+ ac_build_intrinsic(&ctx->ac, intrinsic_name, |
62 |
+ ctx->i32, buf_args, num_args, 0)); |
63 |
+ return; |
64 |
+ } |
65 |
+ |
66 |
+ if (inst->Src[0].Register.File == TGSI_FILE_BUFFER || |
67 |
+ (HAVE_LLVM < 0x0800 && |
68 |
+ inst->Memory.Texture == TGSI_TEXTURE_BUFFER)) { |
69 |
LLVMValueRef buf_args[7]; |
70 |
unsigned num_args = 0; |
71 |
|
72 |
src/gallium/drivers/radeonsi/si_shader_tgsi_mem.c | 45 ++++++++++++++++++++--- |
73 |
src/gallium/drivers/radeonsi/si_state.c | 7 +--- |
74 |
2 files changed, 42 insertions(+), 10 deletions(-) |
75 |
|
76 |
--- src/gallium/drivers/radeonsi/si_state.c.orig 2019-01-17 11:26:22 UTC |
77 |
+++ src/gallium/drivers/radeonsi/si_state.c |
78 |
@@ -3613,14 +3613,11 @@ si_make_buffer_descriptor(struct si_screen *screen, st |
79 |
* - For VMEM and inst.IDXEN == 0 or STRIDE == 0, it's in byte units. |
80 |
* - For VMEM and inst.IDXEN == 1 and STRIDE != 0, it's in units of STRIDE. |
81 |
*/ |
82 |
- if (screen->info.chip_class >= GFX9) |
83 |
- /* When vindex == 0, LLVM sets IDXEN = 0, thus changing units |
84 |
+ if (screen->info.chip_class >= GFX9 && HAVE_LLVM < 0x0800) |
85 |
+ /* When vindex == 0, LLVM < 8.0 sets IDXEN = 0, thus changing units |
86 |
* from STRIDE to bytes. This works around it by setting |
87 |
* NUM_RECORDS to at least the size of one element, so that |
88 |
* the first element is readable when IDXEN == 0. |
89 |
- * |
90 |
- * TODO: Fix this in LLVM, but do we need a new intrinsic where |
91 |
- * IDXEN is enforced? |
92 |
*/ |
93 |
num_records = num_records ? MAX2(num_records, stride) : 0; |
94 |
else if (screen->info.chip_class == VI) |