Re: [Mesa-dev] [PATCH 3/3] i965/fs: Read all components of a SSBO field with one send
Reviewed-by: Jordan Justen On 2015-10-18 21:31:44, Kristian Høgsberg Kristensen wrote: > Instead of looping through single-component reads, read all components > in one go. > > Signed-off-by: Kristian Høgsberg Kristensen > --- > src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 25 +++-- > 1 file changed, 7 insertions(+), 18 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp > b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp > index 792663f..f09578c 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp > @@ -1509,24 +1509,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, > nir_intrinsic_instr *instr >} > >/* Read the vector */ > - for (int i = 0; i < instr->num_components; i++) { > - fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg, > -1 /* dims */, 1 /* size */, > -BRW_PREDICATE_NONE); > - read_result.type = dest.type; > - bld.MOV(dest, read_result); > - dest = offset(dest, bld, 1); > - > - /* Vector components are stored contiguous in memory */ > - if (i < instr->num_components) { > -if (!has_indirect) { > - const_offset_bytes += 4; > - bld.MOV(offset_reg, fs_reg(const_offset_bytes)); > -} else { > - bld.ADD(offset_reg, offset_reg, brw_imm_ud(4)); > -} > - } > - } > + fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg, > + 1 /* dims */, > + instr->num_components, > + BRW_PREDICATE_NONE); > + read_result.type = dest.type; > + for (int i = 0; i < instr->num_components; i++) > + bld.MOV(offset(dest, bld, i), offset(read_result, bld, i)); > >break; > } > -- > 2.6.2 > > ___ > 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 3/3] i965/fs: Read all components of a SSBO field with one send
On Sun, 2015-10-18 at 21:31 -0700, Kristian Høgsberg Kristensen wrote: > Instead of looping through single-component reads, read all components > in one go. > > Signed-off-by: Kristian Høgsberg Kristensen > --- > src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 25 +++-- > 1 file changed, 7 insertions(+), 18 deletions(-) > > diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp > b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp > index 792663f..f09578c 100644 > --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp > +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp > @@ -1509,24 +1509,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, > nir_intrinsic_instr *instr >} > >/* Read the vector */ > - for (int i = 0; i < instr->num_components; i++) { > - fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg, > -1 /* dims */, 1 /* size */, > -BRW_PREDICATE_NONE); > - read_result.type = dest.type; > - bld.MOV(dest, read_result); > - dest = offset(dest, bld, 1); > - > - /* Vector components are stored contiguous in memory */ > - if (i < instr->num_components) { > -if (!has_indirect) { > - const_offset_bytes += 4; > - bld.MOV(offset_reg, fs_reg(const_offset_bytes)); > -} else { > - bld.ADD(offset_reg, offset_reg, brw_imm_ud(4)); > -} > - } > - } > + fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg, > + 1 /* dims */, > + instr->num_components, > + BRW_PREDICATE_NONE); > + read_result.type = dest.type; > + for (int i = 0; i < instr->num_components; i++) > + bld.MOV(offset(dest, bld, i), offset(read_result, bld, i)); > >break; > } Thanks Kristian, this was silly, I wonder why I decided to do it like this to begin with, specially since I do full vector reads for vec4... Reviewed-by: Iago Toral Quiroga Iago ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev
[Mesa-dev] [PATCH 3/3] i965/fs: Read all components of a SSBO field with one send
Instead of looping through single-component reads, read all components in one go. Signed-off-by: Kristian Høgsberg Kristensen --- src/mesa/drivers/dri/i965/brw_fs_nir.cpp | 25 +++-- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp index 792663f..f09578c 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_nir.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_nir.cpp @@ -1509,24 +1509,13 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr } /* Read the vector */ - for (int i = 0; i < instr->num_components; i++) { - fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg, -1 /* dims */, 1 /* size */, -BRW_PREDICATE_NONE); - read_result.type = dest.type; - bld.MOV(dest, read_result); - dest = offset(dest, bld, 1); - - /* Vector components are stored contiguous in memory */ - if (i < instr->num_components) { -if (!has_indirect) { - const_offset_bytes += 4; - bld.MOV(offset_reg, fs_reg(const_offset_bytes)); -} else { - bld.ADD(offset_reg, offset_reg, brw_imm_ud(4)); -} - } - } + fs_reg read_result = emit_untyped_read(bld, surf_index, offset_reg, + 1 /* dims */, + instr->num_components, + BRW_PREDICATE_NONE); + read_result.type = dest.type; + for (int i = 0; i < instr->num_components; i++) + bld.MOV(offset(dest, bld, i), offset(read_result, bld, i)); break; } -- 2.6.2 ___ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev