Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-20 Thread Jose Fonseca

On 19/11/14 21:17, Ilia Mirkin wrote:

On Wed, Nov 19, 2014 at 3:45 PM, Jose Fonseca  wrote:

On 19/11/14 19:45, Ilia Mirkin wrote:


On Wed, Nov 19, 2014 at 2:32 PM, Eric Anholt  wrote:


Eric Anholt  writes:


This series removes a bunch of unused opcodes, mostly from TGSI.  It
doesn't go as far as we could possibly go -- while I welcome discussion
for future patch series deleting more, I hope that discussion doesn't
derail the review process for these changes.

I haven't messed with the subroutine stuff, since I don't know what
people
are planning with that.  I also haven't messed with the pack/unpack
opcodes in TGSI, since they might be useful for some of the GLSL packing
stuff.

Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.



Lots of "looks good", no Reviewed-by (other than Ian on the Mesa side).
I'm probably going to push soon anyway if somebody doesn't actually give
Reviewed-by or NAK.



st/nine got merged. It uses ARR. And at the very least references
TGSI_OPCODE_NRM even if it doesn't use it. It also has code that uses
CND and DP2A although it's presently disabled via #define's.



The patch attached should do it.


I'm pretty sure that your series will cause st/nine to fail compiling.



BTW, given it's not trivial to compile nine state-tracker, I think it might
be better to not obfuscate which opcodes or symbols it uses with macros.  It
pays off to be upfront with these things, so that `git grep foo` finds
everything that should be found.


Hmmm... why is it not easy to build st/nine? I haven't looked at that
in detail yet, but whatever's hard about it should get fixed.


I somehow assumed it dependend on wine headers (*), but I was wrong -- I 
just tried and one can build with alone.  It's actually straightforward. 
 So apologies for mis-information.


Jose

(*) which is a problem for me as I can't even install wine on my Ubuntu 
devel machine as wine indirectly conflicts with nvidia drivers, as it 
depends on an opencl package that conflicts with nvidia opencl package)

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


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-19 Thread Jose Fonseca
> Does anyone remember if there was a reason that the TGSI_OPCODE_ tokens are 
> #defines instead of an enumeration?

I think it was because enums are not allowed in struct bit fields, furthermore 
C++ will complain about enum<->int conversion without cast.  (IIRC this is the 
reason many things in src/gallium/include/pipe/p_defines.h were defines.)

That said, I think we should revisit this. At for TGSI opcodes, relatively few 
lines of code access packed tgsi tokens directly. And enums look nicer when 
debugging.

Jose

From: mesa-dev  on behalf of Brian Paul 

Sent: 13 November 2014 16:27
To: Eric Anholt; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

On 11/12/2014 06:18 PM, Eric Anholt wrote:
> This series removes a bunch of unused opcodes, mostly from TGSI.  It
> doesn't go as far as we could possibly go -- while I welcome discussion
> for future patch series deleting more, I hope that discussion doesn't
> derail the review process for these changes.
>
> I haven't messed with the subroutine stuff, since I don't know what people
> are planning with that.  I also haven't messed with the pack/unpack
> opcodes in TGSI, since they might be useful for some of the GLSL packing
> stuff.
>
> Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.

Except for what Jose said, this looks fine to me.

Does anyone remember if there was a reason that the TGSI_OPCODE_ tokens
are #defines instead of an enumeration?

-Brian


___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=MUbS190yOjHL36ha_AaaQFM1__dfKUWsBqH34fL_9GU&s=c06VM0QMqrPh3u4ifx1opmH41ktcGp-6VAhIkN8gkz0&e=
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-19 Thread David Heidelberg

> The patch attached should do it.

just small nitpick, please drop "/* for radeons */" comment from DP2ADD, 
thanks


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


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-19 Thread Ilia Mirkin
On Wed, Nov 19, 2014 at 3:45 PM, Jose Fonseca  wrote:
> On 19/11/14 19:45, Ilia Mirkin wrote:
>>
>> On Wed, Nov 19, 2014 at 2:32 PM, Eric Anholt  wrote:
>>>
>>> Eric Anholt  writes:
>>>
 This series removes a bunch of unused opcodes, mostly from TGSI.  It
 doesn't go as far as we could possibly go -- while I welcome discussion
 for future patch series deleting more, I hope that discussion doesn't
 derail the review process for these changes.

 I haven't messed with the subroutine stuff, since I don't know what
 people
 are planning with that.  I also haven't messed with the pack/unpack
 opcodes in TGSI, since they might be useful for some of the GLSL packing
 stuff.

 Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.
>>>
>>>
>>> Lots of "looks good", no Reviewed-by (other than Ian on the Mesa side).
>>> I'm probably going to push soon anyway if somebody doesn't actually give
>>> Reviewed-by or NAK.
>>
>>
>> st/nine got merged. It uses ARR. And at the very least references
>> TGSI_OPCODE_NRM even if it doesn't use it. It also has code that uses
>> CND and DP2A although it's presently disabled via #define's.
>
>
> The patch attached should do it.
>
>> I'm pretty sure that your series will cause st/nine to fail compiling.
>
>
> BTW, given it's not trivial to compile nine state-tracker, I think it might
> be better to not obfuscate which opcodes or symbols it uses with macros.  It
> pays off to be upfront with these things, so that `git grep foo` finds
> everything that should be found.

Hmmm... why is it not easy to build st/nine? I haven't looked at that
in detail yet, but whatever's hard about it should get fixed. [Not
Eric's problem, of course.]
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-19 Thread Jose Fonseca

On 19/11/14 19:45, Ilia Mirkin wrote:

On Wed, Nov 19, 2014 at 2:32 PM, Eric Anholt  wrote:

Eric Anholt  writes:


This series removes a bunch of unused opcodes, mostly from TGSI.  It
doesn't go as far as we could possibly go -- while I welcome discussion
for future patch series deleting more, I hope that discussion doesn't
derail the review process for these changes.

I haven't messed with the subroutine stuff, since I don't know what people
are planning with that.  I also haven't messed with the pack/unpack
opcodes in TGSI, since they might be useful for some of the GLSL packing
stuff.

Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.


Lots of "looks good", no Reviewed-by (other than Ian on the Mesa side).
I'm probably going to push soon anyway if somebody doesn't actually give
Reviewed-by or NAK.


st/nine got merged. It uses ARR. And at the very least references
TGSI_OPCODE_NRM even if it doesn't use it. It also has code that uses
CND and DP2A although it's presently disabled via #define's.


The patch attached should do it.


I'm pretty sure that your series will cause st/nine to fail compiling.


BTW, given it's not trivial to compile nine state-tracker, I think it 
might be better to not obfuscate which opcodes or symbols it uses with 
macros.  It pays off to be upfront with these things, so that `git grep 
foo` finds everything that should be found.


Jose

diff --git a/src/gallium/state_trackers/nine/nine_shader.c b/src/gallium/state_trackers/nine/nine_shader.c
index cc027b4..4c4d38e 100644
--- a/src/gallium/state_trackers/nine/nine_shader.c
+++ b/src/gallium/state_trackers/nine/nine_shader.c
@@ -38,7 +38,6 @@
 #if 1
 #define NINE_TGSI_LAZY_DEVS /* don't use TGSI_OPCODE_BREAKC */
 #endif
-#define NINE_TGSI_LAZY_R600 /* don't use TGSI_OPCODE_DP2A */
 
 #define DUMP(args...) _nine_debug_printf(DBG_CHANNEL, NULL, args)
 
@@ -1374,7 +1373,6 @@ DECL_SPECIAL(CND)
 }
 
 cnd = tx_src_param(tx, &tx->insn.src[0]);
-#ifdef NINE_TGSI_LAZY_R600
 cgt = tx_scratch(tx);
 
 if (tx->version.major == 1 && tx->version.minor < 4) {
@@ -1387,13 +1385,6 @@ DECL_SPECIAL(CND)
 ureg_CMP(tx->ureg, dst,
  tx_src_param(tx, &tx->insn.src[1]),
  tx_src_param(tx, &tx->insn.src[2]), ureg_negate(cnd));
-#else
-if (tx->version.major == 1 && tx->version.minor < 4)
-cnd = ureg_scalar(cnd, TGSI_SWIZZLE_W);
-ureg_CND(tx->ureg, dst,
- tx_src_param(tx, &tx->insn.src[1]),
- tx_src_param(tx, &tx->insn.src[2]), cnd);
-#endif
 return D3D_OK;
 }
 
@@ -1980,7 +1971,6 @@ DECL_SPECIAL(NRM)
 
 DECL_SPECIAL(DP2ADD)
 {
-#ifdef NINE_TGSI_LAZY_R600
 struct ureg_dst tmp = tx_scratch_scalar(tx);
 struct ureg_src dp2 = tx_src_scalar(tmp);
 struct ureg_dst dst = tx_dst_param(tx, &tx->insn.dst[0]);
@@ -1994,9 +1984,6 @@ DECL_SPECIAL(DP2ADD)
 ureg_ADD(tx->ureg, dst, src[2], dp2);
 
 return D3D_OK;
-#else
-return NineTranslateInstruction_Generic(tx);
-#endif
 }
 
 DECL_SPECIAL(TEXCOORD)
@@ -2316,7 +2303,7 @@ struct sm1_op_info inst_table[] =
 _OPI(CRS, XPD, V(0,0), V(3,0), V(0,0), V(3,0), 1, 2, NULL), /* XXX: .w */
 _OPI(SGN, SSG, V(2,0), V(3,0), V(0,0), V(0,0), 1, 3, SPECIAL(SGN)), /* ignore src1,2 */
 _OPI(ABS, ABS, V(0,0), V(3,0), V(0,0), V(3,0), 1, 1, NULL),
-_OPI(NRM, NRM, V(0,0), V(3,0), V(0,0), V(3,0), 1, 1, SPECIAL(NRM)), /* NRM doesn't fit */
+_OPI(NRM, NOP, V(0,0), V(3,0), V(0,0), V(3,0), 1, 1, SPECIAL(NRM)), /* NRM doesn't fit */
 
 _OPI(SINCOS, SCS, V(2,0), V(2,1), V(2,0), V(2,1), 1, 3, SPECIAL(SINCOS)),
 _OPI(SINCOS, SCS, V(3,0), V(3,0), V(3,0), V(3,0), 1, 1, SPECIAL(SINCOS)),
@@ -2371,7 +2358,7 @@ struct sm1_op_info inst_table[] =
 /* Misc */
 _OPI(CMP,CMP,  V(0,0), V(0,0), V(1,2), V(3,0), 1, 3, SPECIAL(CMP)), /* reversed */
 _OPI(BEM,NOP,  V(0,0), V(0,0), V(1,4), V(1,4), 0, 0, SPECIAL(BEM)),
-_OPI(DP2ADD, DP2A, V(0,0), V(0,0), V(2,0), V(3,0), 1, 3, SPECIAL(DP2ADD)), /* for radeons */
+_OPI(DP2ADD, NOP,  V(0,0), V(0,0), V(2,0), V(3,0), 1, 3, SPECIAL(DP2ADD)), /* for radeons */
 _OPI(DSX,DDX,  V(0,0), V(0,0), V(2,1), V(3,0), 1, 1, NULL),
 _OPI(DSY,DDY,  V(0,0), V(0,0), V(2,1), V(3,0), 1, 1, NULL),
 _OPI(TEXLDD, TXD,  V(0,0), V(0,0), V(2,1), V(3,0), 1, 4, SPECIAL(TEXLDD)),
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-19 Thread Jose Fonseca

On 19/11/14 19:32, Eric Anholt wrote:

Eric Anholt  writes:


This series removes a bunch of unused opcodes, mostly from TGSI.  It
doesn't go as far as we could possibly go -- while I welcome discussion
for future patch series deleting more, I hope that discussion doesn't
derail the review process for these changes.

I haven't messed with the subroutine stuff, since I don't know what people
are planning with that.  I also haven't messed with the pack/unpack
opcodes in TGSI, since they might be useful for some of the GLSL packing
stuff.

Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.


Lots of "looks good", no Reviewed-by (other than Ian on the Mesa side).
I'm probably going to push soon anyway if somebody doesn't actually give
Reviewed-by or NAK.


By "looks good" is my shorthand for reviewed-by.  But here it is:

  Reviewed-by: Jose Fonseca 

to patches 4-5,7-13 in the series, and v2 of patch 6.  (That is, we're 
fine removing all except ARR.)


Jose

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


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-19 Thread Ilia Mirkin
On Wed, Nov 19, 2014 at 2:32 PM, Eric Anholt  wrote:
> Eric Anholt  writes:
>
>> This series removes a bunch of unused opcodes, mostly from TGSI.  It
>> doesn't go as far as we could possibly go -- while I welcome discussion
>> for future patch series deleting more, I hope that discussion doesn't
>> derail the review process for these changes.
>>
>> I haven't messed with the subroutine stuff, since I don't know what people
>> are planning with that.  I also haven't messed with the pack/unpack
>> opcodes in TGSI, since they might be useful for some of the GLSL packing
>> stuff.
>>
>> Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.
>
> Lots of "looks good", no Reviewed-by (other than Ian on the Mesa side).
> I'm probably going to push soon anyway if somebody doesn't actually give
> Reviewed-by or NAK.

st/nine got merged. It uses ARR. And at the very least references
TGSI_OPCODE_NRM even if it doesn't use it. It also has code that uses
CND and DP2A although it's presently disabled via #define's.

I'm pretty sure that your series will cause st/nine to fail compiling.

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


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-19 Thread Eric Anholt
Eric Anholt  writes:

> This series removes a bunch of unused opcodes, mostly from TGSI.  It
> doesn't go as far as we could possibly go -- while I welcome discussion
> for future patch series deleting more, I hope that discussion doesn't
> derail the review process for these changes.
>
> I haven't messed with the subroutine stuff, since I don't know what people
> are planning with that.  I also haven't messed with the pack/unpack
> opcodes in TGSI, since they might be useful for some of the GLSL packing
> stuff.
>
> Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.

Lots of "looks good", no Reviewed-by (other than Ian on the Mesa side).
I'm probably going to push soon anyway if somebody doesn't actually give
Reviewed-by or NAK.


pgp8XAGogg0I2.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Roland Scheidegger
FWIW opencl explicit conversion instructions have optional rounding mode
modifiers.

Roland

Am 13.11.2014 um 21:19 schrieb Jose Fonseca:
> I've eliminated our internal dependency on TGSI_OPCODE_CND (by replacing 
> SUB+CMP).   So you can commit the change to remove it as far as I'm concerned.
> 
> I have mixed feelings about ARR, because the operation it does is essentially 
> an "iround()", i.e., "(int)roundf()", and at least when targeting x86, we can 
> generate better code with the combination.
> 
> That said neither D3D10,  GLSL, or OpenCL C code has built-ins for iround(), 
> so to be of benefit we'd need to do pattern matching.  So I'm not sure if 
> it's worth to keep this around just for that...
> 
> Jose
> 
> 
> From: Jose Fonseca
> Sent: 13 November 2014 13:06
> To: Eric Anholt; mesa-dev@lists.freedesktop.org
> Subject: RE: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)
> 
> Thanks for doing this.  It's has been long overdue.
> 
> Unfortunately we are relying on TGSI_OPCODE_CND/TGSI_OPCODE_ARR internally.  
> I'm also interested in cutting down used opcodes, so I'll try to replace 
> their usage with something else.  But until then please hold on to those two 
> patches.
> 
> The rest looks good AFAICT.
> 
> Concerning subroutines, we rely on BGNSUB/ENDSUB/CAL extensively.  They are 
> quite convenient when translating D3D 9/10 shaders, which also have them.  
> And if one day we need to support recursive subroutines (CUDA 4.0 appears to 
> have them; not sure about OpenCL, but I suppose it's only a matter of time), 
> then they'll be unavoidable, as in-lining subroutines won't work anymore.
> 
> Jose
> 
> 
> 
> ____________
> From: mesa-dev  on behalf of Eric 
> Anholt 
> Sent: 13 November 2014 01:18
> To: mesa-dev@lists.freedesktop.org
> Subject: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)
> 
> This series removes a bunch of unused opcodes, mostly from TGSI.  It
> doesn't go as far as we could possibly go -- while I welcome discussion
> for future patch series deleting more, I hope that discussion doesn't
> derail the review process for these changes.
> 
> I haven't messed with the subroutine stuff, since I don't know what people
> are planning with that.  I also haven't messed with the pack/unpack
> opcodes in TGSI, since they might be useful for some of the GLSL packing
> stuff.
> 
> Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.
> 
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=KrBch2e5-gJGE_5bIs9RInABCFoKy7me_0oysUie4JI&s=w3G1SjuOy0EbCJjVrC1tDok52z4eMzIiKu63rvxI7SY&e=
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=5I_PKJFWlfqxJa2pURZQFykxOixuGPmVNdNc0FEBojM&s=cacpp7IDyYxBIzOO6UYU6IzVdrr6EoyBV66p1rS2Vu0&e=
>  
> 

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


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Jose Fonseca
I've eliminated our internal dependency on TGSI_OPCODE_CND (by replacing 
SUB+CMP).   So you can commit the change to remove it as far as I'm concerned.

I have mixed feelings about ARR, because the operation it does is essentially 
an "iround()", i.e., "(int)roundf()", and at least when targeting x86, we can 
generate better code with the combination.

That said neither D3D10,  GLSL, or OpenCL C code has built-ins for iround(), so 
to be of benefit we'd need to do pattern matching.  So I'm not sure if it's 
worth to keep this around just for that...

Jose


From: Jose Fonseca
Sent: 13 November 2014 13:06
To: Eric Anholt; mesa-dev@lists.freedesktop.org
Subject: RE: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

Thanks for doing this.  It's has been long overdue.

Unfortunately we are relying on TGSI_OPCODE_CND/TGSI_OPCODE_ARR internally.  
I'm also interested in cutting down used opcodes, so I'll try to replace their 
usage with something else.  But until then please hold on to those two patches.

The rest looks good AFAICT.

Concerning subroutines, we rely on BGNSUB/ENDSUB/CAL extensively.  They are 
quite convenient when translating D3D 9/10 shaders, which also have them.  And 
if one day we need to support recursive subroutines (CUDA 4.0 appears to have 
them; not sure about OpenCL, but I suppose it's only a matter of time), then 
they'll be unavoidable, as in-lining subroutines won't work anymore.

Jose




From: mesa-dev  on behalf of Eric 
Anholt 
Sent: 13 November 2014 01:18
To: mesa-dev@lists.freedesktop.org
Subject: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

This series removes a bunch of unused opcodes, mostly from TGSI.  It
doesn't go as far as we could possibly go -- while I welcome discussion
for future patch series deleting more, I hope that discussion doesn't
derail the review process for these changes.

I haven't messed with the subroutine stuff, since I don't know what people
are planning with that.  I also haven't messed with the pack/unpack
opcodes in TGSI, since they might be useful for some of the GLSL packing
stuff.

Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=KrBch2e5-gJGE_5bIs9RInABCFoKy7me_0oysUie4JI&s=w3G1SjuOy0EbCJjVrC1tDok52z4eMzIiKu63rvxI7SY&e=
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Jose Fonseca
Initially TGSI used to be an union of all possible opcodes (NV/ARB fp/vp, Mesa 
IR, D3D Shader Model 1.x, 2.x, more recently D3D10).

But in practice it's just too much of a hassle, and many of the opcodes were 
never handled or generated. Many received little to no testing.

Particularly when implementing drivers for modern hardware that doesn't have 
opcodes to match with the Shader Model 1.x and 2.x quirky semantics, they are 
distractions.  Furthermore the apps who used to generate them are simple by 
nowadays standards and run fine on fast modern hardware.

By having a smaller set of opcodes they can be tested more easily, so one can 
have more confidence that they do actually work as intended; and developing 
analysis/optimization/transformation passes becomes easier too.


But I have no definite answer on which should or not be in TGSI.  D3D10/11 
assembly is not a bad reference, but it has some omissions   It's a matter of 
deciding on case by case..

Jose


From: ibmir...@gmail.com  on behalf of Ilia Mirkin 

Sent: 13 November 2014 17:13
To: Marek Olšák
Cc: Jose Fonseca; Eric Anholt; mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

As long as we have NAND, pretty much anything can be lowered to
that... I am, of course, not advocating keeping around every insane
instruction, but it does seem a bit arbitrary as to which ones we have
and which ones we don't... I am personally guilty of adding a bunch,
and it was never clear to me how much should be left to the backend
optimizer to un-lower and how much should be done as separate
instructions.

My take was that as long there was a state tracker providing it as
input, it made sense to keep the instruction. But perhaps there's a
different policy that'd work better.

Cheers,

  -ilia


On Thu, Nov 13, 2014 at 11:40 AM, Marek Olšák  wrote:
> Nine can lower ARR into ROUND+ARL easily.
>
> Marek
>
> On Thu, Nov 13, 2014 at 3:33 PM, Jose Fonseca  wrote:
>> It looks like ARR is generated, as 
>> src/gallium/state_trackers/nine/nine_shader.c has
>>
>> #define _OPI(o,t,vv1,vv2,pv1,pv2,d,s,h) \
>> { D3DSIO_##o, TGSI_OPCODE_##t, { vv1, vv2 }, { pv1, pv2, }, d, s, h }
>>
>> [...]
>>
>>   _OPI(MOVA, ARR, V(2,0), V(3,0), V(0,0), V(0,0), 1, 1, NULL),
>>
>>
>> Jose
>>
>> 
>> From: mesa-dev  on behalf of Eric 
>> Anholt 
>> Sent: 13 November 2014 01:43
>> To: Ilia Mirkin
>> Cc: mesa-dev@lists.freedesktop.org
>> Subject: Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)
>>
>> Ilia Mirkin  writes:
>>
>>> AFAIK at least some of these (NRM, ARR, probably others) were being used by
>>> the d3d9 state tracker. Not sure what its status is, but I believe the hope
>>> was to eventually get it into the tree.
>>
>> They've got code for lowering NRM and CND to sanity, and no use of ARR,
>> ARA, X2D, RFL, STR, SFL, or BRA.
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIFaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=j854NOxlaV5nq8kWcima4dP_7hhtaOc2Uj1eJJzZOUM&s=51MpEXASrETyaVvEjR8y1V-NPHxlTTfeHhX4Bb8TgKE&e=
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Roland Scheidegger
It looks like ARR is mildly useful though as hw often can implement it
natively and it benefits at least one state tracker (not that and
optimizing backend couldn't recognize round+arl but llvmpipe wouldn't at
least right now).
So, maybe it would be better to keep it for now.

Roland

Am 13.11.2014 um 17:40 schrieb Marek Olšák:
> Nine can lower ARR into ROUND+ARL easily.
> 
> Marek
> 
> On Thu, Nov 13, 2014 at 3:33 PM, Jose Fonseca  wrote:
>> It looks like ARR is generated, as 
>> src/gallium/state_trackers/nine/nine_shader.c has
>>
>> #define _OPI(o,t,vv1,vv2,pv1,pv2,d,s,h) \
>> { D3DSIO_##o, TGSI_OPCODE_##t, { vv1, vv2 }, { pv1, pv2, }, d, s, h }
>>
>> [...]
>>
>>   _OPI(MOVA, ARR, V(2,0), V(3,0), V(0,0), V(0,0), 1, 1, NULL),
>>
>>
>> Jose
>>
>> 
>> From: mesa-dev  on behalf of Eric 
>> Anholt 
>> Sent: 13 November 2014 01:43
>> To: Ilia Mirkin
>> Cc: mesa-dev@lists.freedesktop.org
>> Subject: Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)
>>
>> Ilia Mirkin  writes:
>>
>>> AFAIK at least some of these (NRM, ARR, probably others) were being used by
>>> the d3d9 state tracker. Not sure what its status is, but I believe the hope
>>> was to eventually get it into the tree.
>>
>> They've got code for lowering NRM and CND to sanity, and no use of ARR,
>> ARA, X2D, RFL, STR, SFL, or BRA.
>> ___
>> mesa-dev mailing list
>> mesa-dev@lists.freedesktop.org
>> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=Taa6YbyiGX2xsMrwlSrA_lcjzjGuuBWzdEII8T8CFQQ&s=3g-djpg3gj45XldHXhQL-VFVLYNCS2hdSP8pfrU-tJ4&e=
>>  
> ___
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=Vjtt0vs_iqoI31UfJxBl7yv9I2FeiaeAYgMTLKRBc_I&m=Taa6YbyiGX2xsMrwlSrA_lcjzjGuuBWzdEII8T8CFQQ&s=3g-djpg3gj45XldHXhQL-VFVLYNCS2hdSP8pfrU-tJ4&e=
>  
> 

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


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Ilia Mirkin
As long as we have NAND, pretty much anything can be lowered to
that... I am, of course, not advocating keeping around every insane
instruction, but it does seem a bit arbitrary as to which ones we have
and which ones we don't... I am personally guilty of adding a bunch,
and it was never clear to me how much should be left to the backend
optimizer to un-lower and how much should be done as separate
instructions.

My take was that as long there was a state tracker providing it as
input, it made sense to keep the instruction. But perhaps there's a
different policy that'd work better.

Cheers,

  -ilia


On Thu, Nov 13, 2014 at 11:40 AM, Marek Olšák  wrote:
> Nine can lower ARR into ROUND+ARL easily.
>
> Marek
>
> On Thu, Nov 13, 2014 at 3:33 PM, Jose Fonseca  wrote:
>> It looks like ARR is generated, as 
>> src/gallium/state_trackers/nine/nine_shader.c has
>>
>> #define _OPI(o,t,vv1,vv2,pv1,pv2,d,s,h) \
>> { D3DSIO_##o, TGSI_OPCODE_##t, { vv1, vv2 }, { pv1, pv2, }, d, s, h }
>>
>> [...]
>>
>>   _OPI(MOVA, ARR, V(2,0), V(3,0), V(0,0), V(0,0), 1, 1, NULL),
>>
>>
>> Jose
>>
>> 
>> From: mesa-dev  on behalf of Eric 
>> Anholt 
>> Sent: 13 November 2014 01:43
>> To: Ilia Mirkin
>> Cc: mesa-dev@lists.freedesktop.org
>> Subject: Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)
>>
>> Ilia Mirkin  writes:
>>
>>> AFAIK at least some of these (NRM, ARR, probably others) were being used by
>>> the d3d9 state tracker. Not sure what its status is, but I believe the hope
>>> was to eventually get it into the tree.
>>
>> They've got code for lowering NRM and CND to sanity, and no use of ARR,
>> ARA, X2D, RFL, STR, SFL, or BRA.
>> ___
>> 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] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Marek Olšák
This looks good to me. Other candidates for removal:

SUB (same as ADD with the Negate bit inverted)
CLAMP (same as MIN+MAX), some drivers don't implement this
ABS (same as MOV with the Abs bit set)

Marek



On Thu, Nov 13, 2014 at 2:18 AM, Eric Anholt  wrote:
> This series removes a bunch of unused opcodes, mostly from TGSI.  It
> doesn't go as far as we could possibly go -- while I welcome discussion
> for future patch series deleting more, I hope that discussion doesn't
> derail the review process for these changes.
>
> I haven't messed with the subroutine stuff, since I don't know what people
> are planning with that.  I also haven't messed with the pack/unpack
> opcodes in TGSI, since they might be useful for some of the GLSL packing
> stuff.
>
> Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.
>
> ___
> 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] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Marek Olšák
Nine can lower ARR into ROUND+ARL easily.

Marek

On Thu, Nov 13, 2014 at 3:33 PM, Jose Fonseca  wrote:
> It looks like ARR is generated, as 
> src/gallium/state_trackers/nine/nine_shader.c has
>
> #define _OPI(o,t,vv1,vv2,pv1,pv2,d,s,h) \
> { D3DSIO_##o, TGSI_OPCODE_##t, { vv1, vv2 }, { pv1, pv2, }, d, s, h }
>
> [...]
>
>   _OPI(MOVA, ARR, V(2,0), V(3,0), V(0,0), V(0,0), 1, 1, NULL),
>
>
> Jose
>
> 
> From: mesa-dev  on behalf of Eric 
> Anholt 
> Sent: 13 November 2014 01:43
> To: Ilia Mirkin
> Cc: mesa-dev@lists.freedesktop.org
> Subject: Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)
>
> Ilia Mirkin  writes:
>
>> AFAIK at least some of these (NRM, ARR, probably others) were being used by
>> the d3d9 state tracker. Not sure what its status is, but I believe the hope
>> was to eventually get it into the tree.
>
> They've got code for lowering NRM and CND to sanity, and no use of ARR,
> ARA, X2D, RFL, STR, SFL, or BRA.
> ___
> 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] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Brian Paul

On 11/12/2014 06:18 PM, Eric Anholt wrote:

This series removes a bunch of unused opcodes, mostly from TGSI.  It
doesn't go as far as we could possibly go -- while I welcome discussion
for future patch series deleting more, I hope that discussion doesn't
derail the review process for these changes.

I haven't messed with the subroutine stuff, since I don't know what people
are planning with that.  I also haven't messed with the pack/unpack
opcodes in TGSI, since they might be useful for some of the GLSL packing
stuff.

Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.


Except for what Jose said, this looks fine to me.

Does anyone remember if there was a reason that the TGSI_OPCODE_ tokens 
are #defines instead of an enumeration?


-Brian


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


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Jose Fonseca
It looks like ARR is generated, as 
src/gallium/state_trackers/nine/nine_shader.c has

#define _OPI(o,t,vv1,vv2,pv1,pv2,d,s,h) \
{ D3DSIO_##o, TGSI_OPCODE_##t, { vv1, vv2 }, { pv1, pv2, }, d, s, h }

[...]

  _OPI(MOVA, ARR, V(2,0), V(3,0), V(0,0), V(0,0), 1, 1, NULL),


Jose


From: mesa-dev  on behalf of Eric 
Anholt 
Sent: 13 November 2014 01:43
To: Ilia Mirkin
Cc: mesa-dev@lists.freedesktop.org
Subject: Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

Ilia Mirkin  writes:

> AFAIK at least some of these (NRM, ARR, probably others) were being used by
> the d3d9 state tracker. Not sure what its status is, but I believe the hope
> was to eventually get it into the tree.

They've got code for lowering NRM and CND to sanity, and no use of ARR,
ARA, X2D, RFL, STR, SFL, or BRA.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-13 Thread Jose Fonseca
Thanks for doing this.  It's has been long overdue.

Unfortunately we are relying on TGSI_OPCODE_CND/TGSI_OPCODE_ARR internally.  
I'm also interested in cutting down used opcodes, so I'll try to replace their 
usage with something else.  But until then please hold on to those two patches.

The rest looks good AFAICT.

Concerning subroutines, we rely on BGNSUB/ENDSUB/CAL extensively.  They are 
quite convenient when translating D3D 9/10 shaders, which also have them.  And 
if one day we need to support recursive subroutines (CUDA 4.0 appears to have 
them; not sure about OpenCL, but I suppose it's only a matter of time), then 
they'll be unavoidable, as in-lining subroutines won't work anymore.

Jose




From: mesa-dev  on behalf of Eric 
Anholt 
Sent: 13 November 2014 01:18
To: mesa-dev@lists.freedesktop.org
Subject: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

This series removes a bunch of unused opcodes, mostly from TGSI.  It
doesn't go as far as we could possibly go -- while I welcome discussion
for future patch series deleting more, I hope that discussion doesn't
derail the review process for these changes.

I haven't messed with the subroutine stuff, since I don't know what people
are planning with that.  I also haven't messed with the pack/unpack
opcodes in TGSI, since they might be useful for some of the GLSL packing
stuff.

Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.freedesktop.org_mailman_listinfo_mesa-2Ddev&d=AAIGaQ&c=Sqcl0Ez6M0X8aeM67LKIiDJAXVeAw-YihVMNtXt-uEs&r=zfmBZnnVGHeYde45pMKNnVyzeaZbdIqVLprmZCM2zzE&m=KrBch2e5-gJGE_5bIs9RInABCFoKy7me_0oysUie4JI&s=w3G1SjuOy0EbCJjVrC1tDok52z4eMzIiKu63rvxI7SY&e=
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-12 Thread Eric Anholt
Ilia Mirkin  writes:

> AFAIK at least some of these (NRM, ARR, probably others) were being used by
> the d3d9 state tracker. Not sure what its status is, but I believe the hope
> was to eventually get it into the tree.

They've got code for lowering NRM and CND to sanity, and no use of ARR,
ARA, X2D, RFL, STR, SFL, or BRA.


pgpaKu7b6qZ2h.pgp
Description: PGP signature
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-12 Thread Ilia Mirkin
AFAIK at least some of these (NRM, ARR, probably others) were being used by
the d3d9 state tracker. Not sure what its status is, but I believe the hope
was to eventually get it into the tree.

On Wed, Nov 12, 2014 at 8:18 PM, Eric Anholt  wrote:

> This series removes a bunch of unused opcodes, mostly from TGSI.  It
> doesn't go as far as we could possibly go -- while I welcome discussion
> for future patch series deleting more, I hope that discussion doesn't
> derail the review process for these changes.
>
> I haven't messed with the subroutine stuff, since I don't know what people
> are planning with that.  I also haven't messed with the pack/unpack
> opcodes in TGSI, since they might be useful for some of the GLSL packing
> stuff.
>
> Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.
>
> ___
> 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


[Mesa-dev] Removing unused opcodes (TGSI, Mesa IR)

2014-11-12 Thread Eric Anholt
This series removes a bunch of unused opcodes, mostly from TGSI.  It
doesn't go as far as we could possibly go -- while I welcome discussion
for future patch series deleting more, I hope that discussion doesn't
derail the review process for these changes.

I haven't messed with the subroutine stuff, since I don't know what people
are planning with that.  I also haven't messed with the pack/unpack
opcodes in TGSI, since they might be useful for some of the GLSL packing
stuff.

Testing status: compile-tested ilo/r600/softpipe, touch-tested softpipe.

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