[Mesa-dev] [PATCH] i965: Fill in a bunch of gen7/hsw data cache-related disasm.

Matt Turner mattst88 at gmail.com
Thu Apr 10 15:29:37 PDT 2014


On Mon, Mar 31, 2014 at 1:48 PM, Eric Anholt <eric at anholt.net> wrote:
> This gets us disasm of atomic ops.
> ---
>  src/mesa/drivers/dri/i965/brw_disasm.c | 113 +++++++++++++++++++++++++++++++--
>  1 file changed, 106 insertions(+), 7 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_disasm.c b/src/mesa/drivers/dri/i965/brw_disasm.c
> index 8cd8a40..5222d53 100644
> --- a/src/mesa/drivers/dri/i965/brw_disasm.c
> +++ b/src/mesa/drivers/dri/i965/brw_disasm.c
> @@ -309,7 +309,8 @@ static const char * const target_function[16] = {
>      [BRW_SFID_DATAPORT_READ] = "read",
>      [BRW_SFID_DATAPORT_WRITE] = "write",
>      [BRW_SFID_URB] = "urb",
> -    [BRW_SFID_THREAD_SPAWNER] = "thread_spawner"
> +    [BRW_SFID_THREAD_SPAWNER] = "thread_spawner",
> +    [BRW_SFID_VME] = "vme",
>  };
>
>  static const char * const target_function_gen6[16] = {
> @@ -322,7 +323,10 @@ static const char * const target_function_gen6[16] = {
>      [GEN6_SFID_DATAPORT_SAMPLER_CACHE] = "sampler",
>      [GEN6_SFID_DATAPORT_RENDER_CACHE] = "render",
>      [GEN6_SFID_DATAPORT_CONSTANT_CACHE] = "const",
> -    [GEN7_SFID_DATAPORT_DATA_CACHE] = "data"
> +    [GEN7_SFID_DATAPORT_DATA_CACHE] = "data",
> +    [GEN7_SFID_PIXEL_INTERPOLATOR] = "pixel interp",
> +    [HSW_SFID_DATAPORT_DATA_CACHE_1] = "dp data 1",
> +    [HSW_SFID_CRE] = "cre",
>  };
>
>  static const char * const dp_rc_msg_type_gen6[16] = {
> @@ -342,6 +346,54 @@ static const char * const dp_rc_msg_type_gen6[16] = {
>      [GEN6_DATAPORT_WRITE_MESSAGE_RENDER_TARGET_UNORM_WRITE] = "RT UNORMc write",
>  };
>
> +static const char *const dp_dc0_msg_type_gen7[16] = {
> +    [GEN7_DATAPORT_DC_OWORD_BLOCK_READ] = "DC OWORD block read",
> +    [GEN7_DATAPORT_DC_UNALIGNED_OWORD_BLOCK_READ] = "DC unaligned OWORD block read",
> +    [GEN7_DATAPORT_DC_OWORD_DUAL_BLOCK_READ] = "DC OWORD dual block read",
> +    [GEN7_DATAPORT_DC_DWORD_SCATTERED_READ] = "DC DWORD scattered read",
> +    [GEN7_DATAPORT_DC_BYTE_SCATTERED_READ] = "DC byte scattered read",
> +    [GEN7_DATAPORT_DC_UNTYPED_ATOMIC_OP] = "DC untyped atomic",
> +    [GEN7_DATAPORT_DC_MEMORY_FENCE] = "DC mfence",
> +    [GEN7_DATAPORT_DC_OWORD_BLOCK_WRITE] = "DC OWORD block write",
> +    [GEN7_DATAPORT_DC_OWORD_DUAL_BLOCK_WRITE] = "DC OWORD dual block write",
> +    [GEN7_DATAPORT_DC_DWORD_SCATTERED_WRITE] = "DC DWORD scatterd write",
> +    [GEN7_DATAPORT_DC_BYTE_SCATTERED_WRITE] = "DC byte scattered write",
> +    [GEN7_DATAPORT_DC_UNTYPED_SURFACE_WRITE] = "DC untyped surface write",
> +};
> +
> +static const char *const dp_dc1_msg_type_hsw[16] = {
> +    [HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_READ] = "untyped surface read",
> +    [HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP] = "DC untyped atomic op",
> +    [HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP_SIMD4X2] = "DC untyped 4x2 atomic op",
> +    [HSW_DATAPORT_DC_PORT1_MEDIA_BLOCK_READ] = "DC media block read",
> +    [HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_READ] = "DC typed surface read",
> +    [HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP] = "DC typed atomic",
> +    [HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP_SIMD4X2] = "DC typed 4x2 atomic op",
> +    [HSW_DATAPORT_DC_PORT1_UNTYPED_SURFACE_WRITE] = "DC untyped surface write",
> +    [HSW_DATAPORT_DC_PORT1_MEDIA_BLOCK_WRITE] = "DC media block write",
> +    [HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP] = "DC atomic counter op",
> +    [HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP_SIMD4X2] = "DC 4x2 atomic counter op",
> +    [HSW_DATAPORT_DC_PORT1_TYPED_SURFACE_WRITE] = "DC typed surface write",
> +};
> +
> +static const char * const aop[16] = {
> +   [BRW_AOP_AND] = "and",
> +   [BRW_AOP_OR] = "or",
> +   [BRW_AOP_XOR] = "xoo",
> +   [BRW_AOP_MOV] = "mov",
> +   [BRW_AOP_INC] = "inc",
> +   [BRW_AOP_DEC] = "dec",
> +   [BRW_AOP_ADD] = "add",
> +   [BRW_AOP_SUB] = "sub",
> +   [BRW_AOP_REVSUB] = "revsub",
> +   [BRW_AOP_IMAX] = "imax",
> +   [BRW_AOP_IMIN] = "imin",
> +   [BRW_AOP_UMAX] = "umax",
> +   [BRW_AOP_UMIN] = "umin",
> +   [BRW_AOP_CMPWR] = "cmpwr",
> +   [BRW_AOP_PREDEC] = "predec",
> +};
> +
>  static const char * const math_function[16] = {
>      [BRW_MATH_FUNCTION_INV] = "inv",
>      [BRW_MATH_FUNCTION_LOG] = "log",
> @@ -1312,12 +1364,59 @@ int brw_disasm (FILE *file, struct brw_instruction *inst, int gen)
>         case BRW_SFID_THREAD_SPAWNER:
>             break;
>         case GEN7_SFID_DATAPORT_DATA_CACHE:
> -           format (file, " (%d, %d, %d)",
> -                   inst->bits3.gen7_dp.binding_table_index,
> -                   inst->bits3.gen7_dp.msg_control,
> -                   inst->bits3.gen7_dp.msg_type);
> -           break;
> +           if (gen >= 7) {
> +              format (file, " (");
> +
> +              err |= control (file, "DP DC0 message type",
> +                              dp_dc0_msg_type_gen7,
> +                              inst->bits3.gen7_dp.msg_type, &space);
> +
> +              format (file, ", %d, ", inst->bits3.gen7_dp.binding_table_index);
> +
> +              switch (inst->bits3.gen7_dp.msg_type) {
> +              case GEN7_DATAPORT_DC_UNTYPED_ATOMIC_OP:
> +                 control (file, "atomic op", aop, inst->bits3.ud >> 8 & 0xf,
> +                          &space);
> +                 break;
> +              default:
> +                 format (file, "%d", inst->bits3.gen7_dp.msg_control);
> +              }
> +              format (file, ")");
> +            } else {
> +               /* FALLTHROUGH */
> +            }
> +            break;
> +
> +       case HSW_SFID_DATAPORT_DATA_CACHE_1:
> +           if (gen >= 7) {
> +               format (file, " (");
> +
> +               err |= control (file, "DP DC1 message type",
> +                               dp_dc1_msg_type_hsw,
> +                               inst->bits3.gen7_dp.msg_type, &space);
>
> +               format (file, ", %d, ",
> +                       inst->bits3.gen7_dp.binding_table_index);
> +
> +                switch (inst->bits3.gen7_dp.msg_type) {
> +                case HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP:
> +                case HSW_DATAPORT_DC_PORT1_UNTYPED_ATOMIC_OP_SIMD4X2:
> +                case HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP:
> +                case HSW_DATAPORT_DC_PORT1_TYPED_ATOMIC_OP_SIMD4X2:
> +                case HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP:
> +                case HSW_DATAPORT_DC_PORT1_ATOMIC_COUNTER_OP_SIMD4X2:
> +                   control (file, "atomic op", aop,
> +                            inst->bits3.ud >> 8 & 0xf, &space);
> +                   break;
> +                default:
> +                   format (file, "%d", inst->bits3.gen7_dp.msg_control);
> +                }
> +                format (file, ")");
> +                break;
> +            } else {
> +               /* FALLTHROUGH */
> +            }
> +            break;
>
>         default:
>             format (file, "unsupported target %d", target);
> --
> 1.9.1

I thought I'd sent review for this already. Apparently not.

With Ilia's change,

Reviewed-by: Matt Turner <mattst88 at gmail.com>


More information about the mesa-dev mailing list