Re: [Mesa-dev] nir: find_msb vs clz

2020-04-07 Thread Ian Romanick
On 4/1/20 11:52 AM, Eric Anholt wrote: > I would generally be of the opinion that we should have NIR opcodes > that match any common hardware instructions, and lowering in algebraic > to help turn input patterns into clean sequences of hardware > instructions. There is quite a bit of benefit to ha

Re: [Mesa-dev] nir: find_msb vs clz

2020-04-02 Thread Ian Romanick
On 4/1/20 11:39 AM, Erik Faye-Lund wrote: > While working on the NIR to DXIL conversion code for D3D12, I've > noticed that we're not exactly doing the best we could here. > > First some background: > > NIR currently has a few instructions that does kinda the same: > > 1. nir_op_ufind_msb: Finds

Re: [Mesa-dev] nir: find_msb vs clz

2020-04-02 Thread Jason Ekstrand
On Thu, Apr 2, 2020 at 7:23 AM Daniel Schürmann wrote: > > W.r.t AMD hardware, it seems to map quite exactly the DX behavior, > so given that I would, of course favor a NIR instruction which maps that :) I'm a bit surprised. I thought AMD HW usually had 25 opcodes whenever 3 were needed just so

Re: [Mesa-dev] nir: find_msb vs clz

2020-04-02 Thread Daniel Schürmann
W.r.t AMD hardware, it seems to map quite exactly the DX behavior, so given that I would, of course favor a NIR instruction which maps that :) Small overview (scalar and vector): S_FLBIT_I32_{B32,B64} - D = the number of zeros before the first one starting from the MSB.Returns -1 if none. S_FLBI

Re: [Mesa-dev] nir: find_msb vs clz

2020-04-01 Thread Jason Ekstrand
On Wed, Apr 1, 2020 at 1:52 PM Eric Anholt wrote: > > On Wed, Apr 1, 2020 at 11:39 AM Erik Faye-Lund > wrote: > > > > While working on the NIR to DXIL conversion code for D3D12, I've > > noticed that we're not exactly doing the best we could here. > > > > First some background: > > > > NIR curren

Re: [Mesa-dev] nir: find_msb vs clz

2020-04-01 Thread Eric Anholt
On Wed, Apr 1, 2020 at 11:39 AM Erik Faye-Lund wrote: > > While working on the NIR to DXIL conversion code for D3D12, I've > noticed that we're not exactly doing the best we could here. > > First some background: > > NIR currently has a few instructions that does kinda the same: > > 1. nir_op_ufin

Re: [Mesa-dev] nir: find_msb vs clz

2020-04-01 Thread Ilia Mirkin
On Wed, Apr 1, 2020 at 2:39 PM Erik Faye-Lund wrote: > > While working on the NIR to DXIL conversion code for D3D12, I've > noticed that we're not exactly doing the best we could here. > > First some background: > > NIR currently has a few instructions that does kinda the same: > > 1. nir_op_ufind

[Mesa-dev] nir: find_msb vs clz

2020-04-01 Thread Erik Faye-Lund
While working on the NIR to DXIL conversion code for D3D12, I've noticed that we're not exactly doing the best we could here. First some background: NIR currently has a few instructions that does kinda the same: 1. nir_op_ufind_msb: Finds the index of the most significant bit, counting from the