[Mesa-dev] [PATCH 2/8] gallium: remove TGSI FENCE opcodes
Marek Olšák
maraeo at gmail.com
Sun Aug 20 00:49:08 UTC 2017
From: Marek Olšák <marek.olsak at amd.com>
use MEMBAR instead
---
src/gallium/auxiliary/tgsi/tgsi_info.c | 6 ++---
src/gallium/docs/source/tgsi.rst | 30 ----------------------
.../drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp | 10 --------
src/gallium/drivers/r600/r600_shader.c | 18 ++++++-------
src/gallium/include/pipe/p_shader_tokens.h | 5 +---
5 files changed, 13 insertions(+), 56 deletions(-)
diff --git a/src/gallium/auxiliary/tgsi/tgsi_info.c b/src/gallium/auxiliary/tgsi/tgsi_info.c
index 38c4a81..396e190 100644
--- a/src/gallium/auxiliary/tgsi/tgsi_info.c
+++ b/src/gallium/auxiliary/tgsi/tgsi_info.c
@@ -194,23 +194,23 @@ static const struct tgsi_opcode_info opcode_info[TGSI_OPCODE_LAST] =
{ 1, 3, 0, 0, 0, 0, 0, OTHR, "GATHER4", TGSI_OPCODE_GATHER4 },
{ 1, 2, 0, 0, 0, 0, 0, OTHR, "SVIEWINFO", TGSI_OPCODE_SVIEWINFO },
{ 1, 2, 0, 0, 0, 0, 0, OTHR, "SAMPLE_POS", TGSI_OPCODE_SAMPLE_POS },
{ 1, 2, 0, 0, 0, 0, 0, OTHR, "SAMPLE_INFO", TGSI_OPCODE_SAMPLE_INFO },
{ 1, 1, 0, 0, 0, 0, 0, COMP, "UARL", TGSI_OPCODE_UARL },
{ 1, 3, 0, 0, 0, 0, 0, COMP, "UCMP", TGSI_OPCODE_UCMP },
{ 1, 1, 0, 0, 0, 0, 0, COMP, "IABS", TGSI_OPCODE_IABS },
{ 1, 1, 0, 0, 0, 0, 0, COMP, "ISSG", TGSI_OPCODE_ISSG },
{ 1, 2, 0, 0, 0, 0, 0, OTHR, "LOAD", TGSI_OPCODE_LOAD },
{ 1, 2, 0, 1, 0, 0, 0, OTHR, "STORE", TGSI_OPCODE_STORE },
- { 1, 0, 0, 0, 0, 0, 0, OTHR, "MFENCE", TGSI_OPCODE_MFENCE },
- { 1, 0, 0, 0, 0, 0, 0, OTHR, "LFENCE", TGSI_OPCODE_LFENCE },
- { 1, 0, 0, 0, 0, 0, 0, OTHR, "SFENCE", TGSI_OPCODE_SFENCE },
+ { 1, 0, 0, 0, 0, 0, 0, OTHR, "", 163 }, /* removed */
+ { 1, 0, 0, 0, 0, 0, 0, OTHR, "", 164 }, /* removed */
+ { 1, 0, 0, 0, 0, 0, 0, OTHR, "", 165 }, /* removed */
{ 0, 0, 0, 0, 0, 0, 0, OTHR, "BARRIER", TGSI_OPCODE_BARRIER },
{ 1, 3, 0, 1, 0, 0, 0, OTHR, "ATOMUADD", TGSI_OPCODE_ATOMUADD },
{ 1, 3, 0, 1, 0, 0, 0, OTHR, "ATOMXCHG", TGSI_OPCODE_ATOMXCHG },
{ 1, 4, 0, 1, 0, 0, 0, OTHR, "ATOMCAS", TGSI_OPCODE_ATOMCAS },
{ 1, 3, 0, 1, 0, 0, 0, OTHR, "ATOMAND", TGSI_OPCODE_ATOMAND },
{ 1, 3, 0, 1, 0, 0, 0, OTHR, "ATOMOR", TGSI_OPCODE_ATOMOR },
{ 1, 3, 0, 1, 0, 0, 0, OTHR, "ATOMXOR", TGSI_OPCODE_ATOMXOR },
{ 1, 3, 0, 1, 0, 0, 0, OTHR, "ATOMUMIN", TGSI_OPCODE_ATOMUMIN },
{ 1, 3, 0, 1, 0, 0, 0, OTHR, "ATOMUMAX", TGSI_OPCODE_ATOMUMAX },
diff --git a/src/gallium/docs/source/tgsi.rst b/src/gallium/docs/source/tgsi.rst
index 83ef785..be1f411 100644
--- a/src/gallium/docs/source/tgsi.rst
+++ b/src/gallium/docs/source/tgsi.rst
@@ -2628,50 +2628,20 @@ For these opcodes, the resource can be a BUFFER, IMAGE, or MEMORY.
.. _threadsyncopcodes:
Inter-thread synchronization opcodes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
These opcodes are intended for communication between threads running
within the same compute grid. For now they're only valid in compute
programs.
-.. opcode:: MFENCE - Memory fence
-
- Syntax: ``MFENCE resource``
-
- Example: ``MFENCE RES[0]``
-
- This opcode forces strong ordering between any memory access
- operations that affect the specified resource. This means that
- previous loads and stores (and only those) will be performed and
- visible to other threads before the program execution continues.
-
-
-.. opcode:: LFENCE - Load memory fence
-
- Syntax: ``LFENCE resource``
-
- Example: ``LFENCE RES[0]``
-
- Similar to MFENCE, but it only affects the ordering of memory loads.
-
-
-.. opcode:: SFENCE - Store memory fence
-
- Syntax: ``SFENCE resource``
-
- Example: ``SFENCE RES[0]``
-
- Similar to MFENCE, but it only affects the ordering of memory stores.
-
-
.. opcode:: BARRIER - Thread group barrier
``BARRIER``
This opcode suspends the execution of the current thread until all
the remaining threads in the working group reach the same point of
the program. Results are unspecified if any of the remaining
threads terminates or never reaches an executed BARRIER instruction.
.. opcode:: MEMBAR - Memory barrier
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
index 0b1f550..23c7d10 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_from_tgsi.cpp
@@ -987,23 +987,20 @@ static nv50_ir::operation translateOpcode(uint opcode)
NV50_IR_OPCODE_CASE(END, EXIT);
default:
return nv50_ir::OP_NOP;
}
}
static uint16_t opcodeToSubOp(uint opcode)
{
switch (opcode) {
- case TGSI_OPCODE_LFENCE: return NV50_IR_SUBOP_MEMBAR(L, GL);
- case TGSI_OPCODE_SFENCE: return NV50_IR_SUBOP_MEMBAR(S, GL);
- case TGSI_OPCODE_MFENCE: return NV50_IR_SUBOP_MEMBAR(M, GL);
case TGSI_OPCODE_ATOMUADD: return NV50_IR_SUBOP_ATOM_ADD;
case TGSI_OPCODE_ATOMXCHG: return NV50_IR_SUBOP_ATOM_EXCH;
case TGSI_OPCODE_ATOMCAS: return NV50_IR_SUBOP_ATOM_CAS;
case TGSI_OPCODE_ATOMAND: return NV50_IR_SUBOP_ATOM_AND;
case TGSI_OPCODE_ATOMOR: return NV50_IR_SUBOP_ATOM_OR;
case TGSI_OPCODE_ATOMXOR: return NV50_IR_SUBOP_ATOM_XOR;
case TGSI_OPCODE_ATOMUMIN: return NV50_IR_SUBOP_ATOM_MIN;
case TGSI_OPCODE_ATOMIMIN: return NV50_IR_SUBOP_ATOM_MIN;
case TGSI_OPCODE_ATOMUMAX: return NV50_IR_SUBOP_ATOM_MAX;
case TGSI_OPCODE_ATOMIMAX: return NV50_IR_SUBOP_ATOM_MAX;
@@ -3776,27 +3773,20 @@ Converter::handleInstruction(const struct tgsi_full_instruction *insn)
handleLOAD(dst0);
break;
case TGSI_OPCODE_STORE:
handleSTORE();
break;
case TGSI_OPCODE_BARRIER:
geni = mkOp2(OP_BAR, TYPE_U32, NULL, mkImm(0), mkImm(0));
geni->fixed = 1;
geni->subOp = NV50_IR_SUBOP_BAR_SYNC;
break;
- case TGSI_OPCODE_MFENCE:
- case TGSI_OPCODE_LFENCE:
- case TGSI_OPCODE_SFENCE:
- geni = mkOp(OP_MEMBAR, TYPE_NONE, NULL);
- geni->fixed = 1;
- geni->subOp = tgsi::opcodeToSubOp(tgsi.getOpcode());
- break;
case TGSI_OPCODE_MEMBAR:
{
uint32_t level = tgsi.getSrc(0).getValueU32(0, info);
geni = mkOp(OP_MEMBAR, TYPE_NONE, NULL);
geni->fixed = 1;
if (!(level & ~(TGSI_MEMBAR_THREAD_GROUP | TGSI_MEMBAR_SHARED)))
geni->subOp = NV50_IR_SUBOP_MEMBAR(M, CTA);
else
geni->subOp = NV50_IR_SUBOP_MEMBAR(M, GL);
}
diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c
index 74f5add..d4eece3 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -9224,23 +9224,23 @@ static const struct r600_shader_tgsi_instruction r600_shader_tgsi_instruction[]
[TGSI_OPCODE_GATHER4] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SVIEWINFO] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SAMPLE_POS] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SAMPLE_INFO] = { 0, tgsi_unsupported},
[TGSI_OPCODE_UARL] = { ALU_OP1_MOVA_INT, tgsi_r600_arl},
[TGSI_OPCODE_UCMP] = { ALU_OP0_NOP, tgsi_ucmp},
[TGSI_OPCODE_IABS] = { 0, tgsi_iabs},
[TGSI_OPCODE_ISSG] = { 0, tgsi_issg},
[TGSI_OPCODE_LOAD] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_STORE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_MFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_LFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_SFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
+ [163] = { ALU_OP0_NOP, tgsi_unsupported},
+ [164] = { ALU_OP0_NOP, tgsi_unsupported},
+ [165] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_BARRIER] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMUADD] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMXCHG] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMCAS] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMAND] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMOR] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMXOR] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMUMIN] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMUMAX] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMIMIN] = { ALU_OP0_NOP, tgsi_unsupported},
@@ -9422,23 +9422,23 @@ static const struct r600_shader_tgsi_instruction eg_shader_tgsi_instruction[] =
[TGSI_OPCODE_GATHER4] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SVIEWINFO] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SAMPLE_POS] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SAMPLE_INFO] = { 0, tgsi_unsupported},
[TGSI_OPCODE_UARL] = { ALU_OP1_MOVA_INT, tgsi_eg_arl},
[TGSI_OPCODE_UCMP] = { ALU_OP0_NOP, tgsi_ucmp},
[TGSI_OPCODE_IABS] = { 0, tgsi_iabs},
[TGSI_OPCODE_ISSG] = { 0, tgsi_issg},
[TGSI_OPCODE_LOAD] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_STORE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_MFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_LFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_SFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
+ [163] = { ALU_OP0_NOP, tgsi_unsupported},
+ [164] = { ALU_OP0_NOP, tgsi_unsupported},
+ [165] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_BARRIER] = { ALU_OP0_GROUP_BARRIER, tgsi_barrier},
[TGSI_OPCODE_ATOMUADD] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMXCHG] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMCAS] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMAND] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMOR] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMXOR] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMUMIN] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMUMAX] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMIMIN] = { ALU_OP0_NOP, tgsi_unsupported},
@@ -9645,23 +9645,23 @@ static const struct r600_shader_tgsi_instruction cm_shader_tgsi_instruction[] =
[TGSI_OPCODE_GATHER4] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SVIEWINFO] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SAMPLE_POS] = { 0, tgsi_unsupported},
[TGSI_OPCODE_SAMPLE_INFO] = { 0, tgsi_unsupported},
[TGSI_OPCODE_UARL] = { ALU_OP1_MOVA_INT, tgsi_eg_arl},
[TGSI_OPCODE_UCMP] = { ALU_OP0_NOP, tgsi_ucmp},
[TGSI_OPCODE_IABS] = { 0, tgsi_iabs},
[TGSI_OPCODE_ISSG] = { 0, tgsi_issg},
[TGSI_OPCODE_LOAD] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_STORE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_MFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_LFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
- [TGSI_OPCODE_SFENCE] = { ALU_OP0_NOP, tgsi_unsupported},
+ [163] = { ALU_OP0_NOP, tgsi_unsupported},
+ [164] = { ALU_OP0_NOP, tgsi_unsupported},
+ [165] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_BARRIER] = { ALU_OP0_GROUP_BARRIER, tgsi_barrier},
[TGSI_OPCODE_ATOMUADD] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMXCHG] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMCAS] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMAND] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMOR] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMXOR] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMUMIN] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMUMAX] = { ALU_OP0_NOP, tgsi_unsupported},
[TGSI_OPCODE_ATOMIMIN] = { ALU_OP0_NOP, tgsi_unsupported},
diff --git a/src/gallium/include/pipe/p_shader_tokens.h b/src/gallium/include/pipe/p_shader_tokens.h
index 502446d..2254d3f 100644
--- a/src/gallium/include/pipe/p_shader_tokens.h
+++ b/src/gallium/include/pipe/p_shader_tokens.h
@@ -499,24 +499,21 @@ struct tgsi_property_data {
#define TGSI_OPCODE_SAMPLE_POS 155
#define TGSI_OPCODE_SAMPLE_INFO 156
#define TGSI_OPCODE_UARL 157
#define TGSI_OPCODE_UCMP 158
#define TGSI_OPCODE_IABS 159
#define TGSI_OPCODE_ISSG 160
#define TGSI_OPCODE_LOAD 161
#define TGSI_OPCODE_STORE 162
-
-#define TGSI_OPCODE_MFENCE 163
-#define TGSI_OPCODE_LFENCE 164
-#define TGSI_OPCODE_SFENCE 165
+/* gap */
#define TGSI_OPCODE_BARRIER 166
#define TGSI_OPCODE_ATOMUADD 167
#define TGSI_OPCODE_ATOMXCHG 168
#define TGSI_OPCODE_ATOMCAS 169
#define TGSI_OPCODE_ATOMAND 170
#define TGSI_OPCODE_ATOMOR 171
#define TGSI_OPCODE_ATOMXOR 172
#define TGSI_OPCODE_ATOMUMIN 173
#define TGSI_OPCODE_ATOMUMAX 174
--
2.7.4
More information about the mesa-dev
mailing list