[Beignet] [PATCH V2] Refine the shared function ID define.

Zhigang Gong zhigang.gong at linux.intel.com
Mon Oct 13 20:58:08 PDT 2014


LGTM, just pushed, thanks.

On Mon, Oct 13, 2014 at 09:54:22PM +0800, junyan.he at inbox.com wrote:
> From: Junyan He <junyan.he at linux.intel.com>
> 
> The old sfid define is obsolete and confusing.
> Correct the names and delete the invalid ones.
> The math shared function is no longer included in sfid,
> and some modification for disasm to print the math
> related infomation correctly.
> 
> Signed-off-by: Junyan He <junyan.he at linux.intel.com>
> ---
>  backend/src/backend/gen/gen_mesa_disasm.c |   58 ++++++++++++++---------------
>  backend/src/backend/gen75_encoder.cpp     |    6 +--
>  backend/src/backend/gen8_encoder.cpp      |    6 +--
>  backend/src/backend/gen_defs.hpp          |   16 ++++----
>  backend/src/backend/gen_encoder.cpp       |   16 ++++----
>  5 files changed, 51 insertions(+), 51 deletions(-)
> 
> diff --git a/backend/src/backend/gen/gen_mesa_disasm.c b/backend/src/backend/gen/gen_mesa_disasm.c
> index 1a53310..231185a 100644
> --- a/backend/src/backend/gen/gen_mesa_disasm.c
> +++ b/backend/src/backend/gen/gen_mesa_disasm.c
> @@ -308,31 +308,35 @@ static const char *end_of_thread[2] = {
>    [1] = "EOT"
>  };
>  
> -static const char *target_function_gen6[16] = {
> +static const char *target_function_gen7[16] = {
>    [GEN_SFID_NULL] = "null",
> -  [GEN_SFID_MATH] = "math",
> +  [GEN_SFID_RESERVED] = NULL,
>    [GEN_SFID_SAMPLER] = "sampler",
>    [GEN_SFID_MESSAGE_GATEWAY] = "gateway",
> +  [GEN_SFID_DATAPORT_SAMPLER] = "dataport_sampler",
> +  [GEN_SFID_DATAPORT_RENDER] = "render",
>    [GEN_SFID_URB] = "urb",
>    [GEN_SFID_THREAD_SPAWNER] = "thread_spawner",
> -  [GEN6_SFID_DATAPORT_SAMPLER_CACHE] = "sampler",
> -  [GEN6_SFID_DATAPORT_RENDER_CACHE] = "render",
> -  [GEN6_SFID_DATAPORT_CONSTANT_CACHE] = "const",
> -  [GEN_SFID_DATAPORT_DATA_CACHE] = "data"
> +  [GEN_SFID_VIDEO_MOTION_EST] = "video_motion_estimation",
> +  [GEN_SFID_DATAPORT_CONSTANT] = "const",
> +  [GEN_SFID_DATAPORT_DATA] = "data",
> +  [GEN_SFID_PIXEL_INTERPOLATOR] = "pix_interpolator",
>  };
>  
>  static const char *target_function_gen75[16] = {
>    [GEN_SFID_NULL] = "null",
> -  [GEN_SFID_MATH] = "math",
> +  [GEN_SFID_RESERVED] = NULL,
>    [GEN_SFID_SAMPLER] = "sampler",
>    [GEN_SFID_MESSAGE_GATEWAY] = "gateway",
> +  [GEN_SFID_DATAPORT_SAMPLER] = "dataport_sampler",
> +  [GEN_SFID_DATAPORT_RENDER] = "render",
>    [GEN_SFID_URB] = "urb",
>    [GEN_SFID_THREAD_SPAWNER] = "thread_spawner",
> -  [GEN6_SFID_DATAPORT_SAMPLER_CACHE] = "sampler",
> -  [GEN6_SFID_DATAPORT_RENDER_CACHE] = "render",
> -  [GEN6_SFID_DATAPORT_CONSTANT_CACHE] = "const",
> -  [GEN_SFID_DATAPORT_DATA_CACHE] = "data (0)",
> -  [GEN_SFID_DATAPORT1_DATA_CACHE] = "data (1)"
> +  [GEN_SFID_VIDEO_MOTION_EST] = "video_motion_estimation",
> +  [GEN_SFID_DATAPORT_CONSTANT] = "const",
> +  [GEN_SFID_DATAPORT_DATA] = "data (0)",
> +  [GEN_SFID_PIXEL_INTERPOLATOR] = "pix_interpolator",
> +  [GEN_SFID_DATAPORT1_DATA] = "data (1)",
>  };
>  
>  static const char *gateway_sub_function[8] = {
> @@ -1128,7 +1132,15 @@ int gen_disasm (FILE *file, const void *opaque_insn, uint32_t deviceID, uint32_t
>    if (inst->header.opcode == GEN_OPCODE_MATH) {
>      string (file, " ");
>      err |= control (file, "function", math_function,
> -        inst->header.destreg_or_condmod, NULL);
> +                    inst->header.destreg_or_condmod, &space);
> +    err |= control (file, "math saturate", math_saturate,
> +                    inst->bits3.math_gen5.saturate, &space);
> +    err |= control (file, "math signed", math_signed,
> +                    inst->bits3.math_gen5.int_type, &space);
> +    err |= control (file, "math scalar", math_scalar,
> +                    inst->bits3.math_gen5.data_type, &space);
> +    err |= control (file, "math precision", math_precision,
> +                    inst->bits3.math_gen5.precision, &space);
>    } else if (inst->header.opcode != GEN_OPCODE_SEND &&
>        inst->header.opcode != GEN_OPCODE_SENDC) {
>      err |= control (file, "conditional modifier", conditional_modifier,
> @@ -1202,23 +1214,11 @@ int gen_disasm (FILE *file, const void *opaque_insn, uint32_t deviceID, uint32_t
>        err |= control (file, "target function", target_function_gen75,
>               target, &space);
>      } else {
> -      err |= control (file, "target function", target_function_gen6,
> +      err |= control (file, "target function", target_function_gen7,
>               target, &space);
>      }
>  
>      switch (target) {
> -      case GEN_SFID_MATH:
> -        err |= control (file, "math function", math_function,
> -            inst->bits3.math_gen5.function, &space);
> -        err |= control (file, "math saturate", math_saturate,
> -            inst->bits3.math_gen5.saturate, &space);
> -        err |= control (file, "math signed", math_signed,
> -            inst->bits3.math_gen5.int_type, &space);
> -        err |= control (file, "math scalar", math_scalar,
> -            inst->bits3.math_gen5.data_type, &space);
> -        err |= control (file, "math precision", math_precision,
> -            inst->bits3.math_gen5.precision, &space);
> -        break;
>        case GEN_SFID_SAMPLER:
>          format (file, " (%d, %d, %d, %d)",
>                  inst->bits3.sampler_gen7.bti,
> @@ -1226,7 +1226,7 @@ int gen_disasm (FILE *file, const void *opaque_insn, uint32_t deviceID, uint32_t
>                  inst->bits3.sampler_gen7.msg_type,
>                  inst->bits3.sampler_gen7.simd_mode);
>          break;
> -      case GEN_SFID_DATAPORT_DATA_CACHE:
> +      case GEN_SFID_DATAPORT_DATA:
>          if(inst->bits3.gen7_untyped_rw.category == 0) {
>            format (file, " (bti: %d, rgba: %d, %s, %s, %s)",
>                    inst->bits3.gen7_untyped_rw.bti,
> @@ -1243,7 +1243,7 @@ int gen_disasm (FILE *file, const void *opaque_insn, uint32_t deviceID, uint32_t
>                    data_port_scratch_msg_type[inst->bits3.gen7_scratch_rw.msg_type]);
>          }
>          break;
> -      case GEN_SFID_DATAPORT1_DATA_CACHE:
> +      case GEN_SFID_DATAPORT1_DATA:
>          format (file, " (bti: %d, rgba: %d, %s, %s, %s)",
>                  inst->bits3.gen7_untyped_rw.bti,
>                  inst->bits3.gen7_untyped_rw.rgba,
> @@ -1251,7 +1251,7 @@ int gen_disasm (FILE *file, const void *opaque_insn, uint32_t deviceID, uint32_t
>                  data_port_data_cache_category[inst->bits3.gen7_untyped_rw.category],
>                  data_port1_data_cache_msg_type[inst->bits3.gen7_untyped_rw.msg_type]);
>          break;
> -      case GEN6_SFID_DATAPORT_CONSTANT_CACHE:
> +      case GEN_SFID_DATAPORT_CONSTANT:
>          format (file, " (bti: %d, %s)",
>                  inst->bits3.gen7_dword_rw.bti,
>                  data_port_data_cache_msg_type[inst->bits3.gen7_dword_rw.msg_type]);
> diff --git a/backend/src/backend/gen75_encoder.cpp b/backend/src/backend/gen75_encoder.cpp
> index 10a9b5c..b9ac986 100644
> --- a/backend/src/backend/gen75_encoder.cpp
> +++ b/backend/src/backend/gen75_encoder.cpp
> @@ -70,7 +70,7 @@ namespace gbe
>                                      uint32_t response_length)
>    {
>      Gen7NativeInstruction *gen7_insn = &insn->gen7_insn;
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA;
>      setMessageDescriptor(insn, sfid, msg_length, response_length);
>      gen7_insn->bits3.gen7_untyped_rw.msg_type = msg_type;
>      gen7_insn->bits3.gen7_untyped_rw.bti = bti;
> @@ -87,7 +87,7 @@ namespace gbe
>                                            unsigned char msg_type, uint32_t msg_length, bool header_present)
>    {
>      Gen7NativeInstruction *gen7_insn = &insn->gen7_insn;
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA;
>      setMessageDescriptor(insn, sfid, msg_length, 0, header_present);
>      gen7_insn->bits3.gen7_typed_rw.bti = bti;
>      gen7_insn->bits3.gen7_typed_rw.msg_type = msg_type;
> @@ -116,7 +116,7 @@ namespace gbe
>      this->setSrc0(insn, GenRegister::ud8grf(src.nr, 0));
>      this->setSrc1(insn, GenRegister::immud(0));
>  
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA;
>      setMessageDescriptor(insn, sfid, msg_length, response_length);
>      gen7_insn->bits3.gen7_atomic_op.msg_type = GEN75_P1_UNTYPED_ATOMIC_OP;
>      gen7_insn->bits3.gen7_atomic_op.bti = bti;
> diff --git a/backend/src/backend/gen8_encoder.cpp b/backend/src/backend/gen8_encoder.cpp
> index 6cb6e70..4ca900d 100644
> --- a/backend/src/backend/gen8_encoder.cpp
> +++ b/backend/src/backend/gen8_encoder.cpp
> @@ -70,7 +70,7 @@ namespace gbe
>                                      uint32_t response_length)
>    {
>      Gen8NativeInstruction *gen8_insn = &insn->gen8_insn;
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA;
>      setMessageDescriptor(insn, sfid, msg_length, response_length);
>      gen8_insn->bits3.gen7_untyped_rw.msg_type = msg_type;
>      gen8_insn->bits3.gen7_untyped_rw.bti = bti;
> @@ -87,7 +87,7 @@ namespace gbe
>                                            unsigned char msg_type, uint32_t msg_length, bool header_present)
>    {
>      Gen8NativeInstruction *gen8_insn = &insn->gen8_insn;
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA;
>      setMessageDescriptor(insn, sfid, msg_length, 0, header_present);
>      gen8_insn->bits3.gen7_typed_rw.bti = bti;
>      gen8_insn->bits3.gen7_typed_rw.msg_type = msg_type;
> @@ -116,7 +116,7 @@ namespace gbe
>      this->setSrc0(insn, GenRegister::ud8grf(src.nr, 0));
>      this->setSrc1(insn, GenRegister::immud(0));
>  
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT1_DATA;
>      setMessageDescriptor(insn, sfid, msg_length, response_length);
>      gen8_insn->bits3.gen7_atomic_op.msg_type = GEN75_P1_UNTYPED_ATOMIC_OP;
>      gen8_insn->bits3.gen7_atomic_op.bti = bti;
> diff --git a/backend/src/backend/gen_defs.hpp b/backend/src/backend/gen_defs.hpp
> index 9b9dcb8..b40096d 100644
> --- a/backend/src/backend/gen_defs.hpp
> +++ b/backend/src/backend/gen_defs.hpp
> @@ -201,18 +201,18 @@ enum GenAtomicOpCode {
>  /*! Gen SFID */
>  enum GenMessageTarget {
>    GEN_SFID_NULL                     = 0,
> -  GEN_SFID_MATH                     = 1,
> +  GEN_SFID_RESERVED                 = 1,
>    GEN_SFID_SAMPLER                  = 2,
>    GEN_SFID_MESSAGE_GATEWAY          = 3,
> -  GEN_SFID_DATAPORT_READ            = 4,
> -  GEN_SFID_DATAPORT_WRITE           = 5,
> +  GEN_SFID_DATAPORT_SAMPLER         = 4,
> +  GEN_SFID_DATAPORT_RENDER          = 5,
>    GEN_SFID_URB                      = 6,
>    GEN_SFID_THREAD_SPAWNER           = 7,
> -  GEN6_SFID_DATAPORT_SAMPLER_CACHE  = 4,
> -  GEN6_SFID_DATAPORT_RENDER_CACHE   = 5,
> -  GEN6_SFID_DATAPORT_CONSTANT_CACHE = 9,
> -  GEN_SFID_DATAPORT_DATA_CACHE      = 10,
> -  GEN_SFID_DATAPORT1_DATA_CACHE     = 12,
> +  GEN_SFID_VIDEO_MOTION_EST         = 8,
> +  GEN_SFID_DATAPORT_CONSTANT        = 9,
> +  GEN_SFID_DATAPORT_DATA            = 10,
> +  GEN_SFID_PIXEL_INTERPOLATOR       = 11,
> +  GEN_SFID_DATAPORT1_DATA           = 12, /* New for HSW and BDW. */
>  };
>  
>  #define GEN_PREDICATE_NONE                    0
> diff --git a/backend/src/backend/gen_encoder.cpp b/backend/src/backend/gen_encoder.cpp
> index 29bc806..f799ad7 100644
> --- a/backend/src/backend/gen_encoder.cpp
> +++ b/backend/src/backend/gen_encoder.cpp
> @@ -115,7 +115,7 @@ namespace gbe
>                                          unsigned char msg_type, uint32_t msg_length,
>                                          bool header_present)
>    {
> -    const GenMessageTarget sfid = GEN6_SFID_DATAPORT_RENDER_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT_RENDER;
>      setMessageDescriptor(insn, sfid, msg_length, 0, header_present);
>      insn->bits3.gen7_typed_rw.bti = bti;
>      insn->bits3.gen7_typed_rw.msg_type = msg_type;
> @@ -125,7 +125,7 @@ namespace gbe
>                                    uint32_t rgba, uint32_t msg_type,
>                                    uint32_t msg_length, uint32_t response_length)
>    {
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA;
>      setMessageDescriptor(insn, sfid, msg_length, response_length);
>      insn->bits3.gen7_untyped_rw.msg_type = msg_type;
>      insn->bits3.gen7_untyped_rw.bti = bti;
> @@ -146,7 +146,7 @@ namespace gbe
>                                       uint32_t msg_length,
>                                       uint32_t response_length)
>    {
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA;
>      p->setMessageDescriptor(insn, sfid, msg_length, response_length);
>      insn->bits3.gen7_byte_rw.msg_type = msg_type;
>      insn->bits3.gen7_byte_rw.bti = bti;
> @@ -167,7 +167,7 @@ namespace gbe
>                            uint32_t msg_length,
>                            uint32_t response_length)
>    {
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA;
>      p->setMessageDescriptor(insn, sfid, msg_length, response_length);
>      assert(size == 2 || size == 4);
>      insn->bits3.gen7_oblock_rw.msg_type = msg_type;
> @@ -208,7 +208,7 @@ namespace gbe
>      // message causes a hang at unit test case compiler_global_constant.
>      // We workaround it to use DATA CACHE instead.
>      const GenMessageTarget sfid = (p->deviceID == PCI_CHIP_BAYTRAIL_T) ?
> -                                 GEN_SFID_DATAPORT_DATA_CACHE : GEN6_SFID_DATAPORT_CONSTANT_CACHE;
> +                                 GEN_SFID_DATAPORT_DATA : GEN_SFID_DATAPORT_CONSTANT;
>      p->setMessageDescriptor(insn, sfid, msg_length, response_length);
>      insn->bits3.gen7_dword_rw.msg_type = msg_type;
>      insn->bits3.gen7_dword_rw.bti = bti;
> @@ -399,7 +399,7 @@ namespace gbe
>      this->setSrc0(insn, GenRegister::ud8grf(src.nr, 0));
>      this->setSrc1(insn, GenRegister::immud(0));
>  
> -    const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
> +    const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA;
>      setMessageDescriptor(insn, sfid, msg_length, response_length);
>      insn->bits3.gen7_atomic_op.msg_type = GEN7_UNTYPED_ATOMIC_READ;
>      insn->bits3.gen7_atomic_op.bti = bti;
> @@ -791,7 +791,7 @@ namespace gbe
>      this->setHeader(insn);
>      this->setDst(insn, dst);
>      this->setSrc0(insn, dst);
> -    setMessageDescriptor(insn, GEN_SFID_DATAPORT_DATA_CACHE, 1, 1, 1);
> +    setMessageDescriptor(insn, GEN_SFID_DATAPORT_DATA, 1, 1, 1);
>      insn->bits3.gen7_memory_fence.msg_type = GEN_MEM_FENCE;
>      insn->bits3.gen7_memory_fence.commit_enable = 0x1;
>    }
> @@ -1055,7 +1055,7 @@ namespace gbe
>                                     uint32_t msg_length,
>                                     uint32_t response_length)
>    {
> -     const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA_CACHE;
> +     const GenMessageTarget sfid = GEN_SFID_DATAPORT_DATA;
>       p->setMessageDescriptor(insn, sfid, msg_length, response_length, true);
>       insn->bits3.gen7_scratch_rw.block_size = block_size;
>       insn->bits3.gen7_scratch_rw.msg_type = msg_type;
> -- 
> 1.7.9.5
> 
> 
> 
> _______________________________________________
> Beignet mailing list
> Beignet at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/beignet


More information about the Beignet mailing list