Changeset 4858 in CLRX


Ignore:
Timestamp:
Jul 28, 2019, 12:22:29 PM (4 months ago)
Author:
matszpk
Message:

CLRadeonExtender: GCNAsm: Fixed parsing dim modifier MIMG (GFX10). First testcases for MIMG encoding for GFX10.

Location:
CLRadeonExtender/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/GCNAsmEncode2.cpp

    r4857 r4858  
    489489struct GFX10MIMGDimInfoEntry
    490490{
    491     cxuint value;
    492491    cxuint dwordsNum;
    493492    cxuint derivsNum; // deriv dwords num
    494493};
    495494
     495static const GFX10MIMGDimInfoEntry gfx10MImgDimInfoTbl[8] =
     496{
     497    { 1, 2 }, { 2, 4 }, { 3, 6 }, { 3, 4 }, { 2, 2 }, { 3, 4 }, { 3, 4 }, { 4, 4 }
     498};
     499
     500
    496501// dim values names
    497 static const std::pair<const char*, GFX10MIMGDimInfoEntry> mimgDimNamesMap[] =
     502static const std::pair<const char*, cxuint> mimgDimNamesMap[] =
    498503{
    499     { "1d", { 0, 1, 2 } },
    500     { "1d_array",{ 4, 2, 2 } },
    501     { "2d", { 1, 2, 4 } },
    502     { "2d_array",{ 5, 3, 4 } },
    503     { "2d_msaa", { 6, 3, 4 } },
    504     { "2d_msaa_array", { 7, 4, 4 } },
    505     { "3d", { 2, 3, 6 } },
    506     { "cube", { 3, 3, 4 } },
     504    { "1d", 0 },
     505    { "1d_array",4 },
     506    { "2d", 1 },
     507    { "2d_array", 5 },
     508    { "2d_msaa", 6 },
     509    { "2d_msaa_array", 7 },
     510    { "3d", 2 },
     511    { "cube", 3 }
    507512};
    508513
     
    584589    bool haveDlc = false, haveDim = false;
    585590    cxbyte dimVal = 0;
    586     cxuint dimDwordsNum = 0, dimDerivsNum = 0;
    587591    cxbyte dmask = 0x1;
    588592    /* modifiers and modifiers */
     
    624628                        if (!parseImm(asmr, linePtr, dimVal, nullptr, 3, WS_UNSIGNED))
    625629                            good = false;
     630                        if (good)
     631                        {
     632                            if (haveDim)
     633                                asmr.printWarning(modPlace, "Dim is already defined");
     634                            haveDim = true;
     635                        }
    626636                    }
    627637                    else if (getMUBUFFmtNameArg(
     
    637647                        if (dimIdx!=8)
    638648                        {
    639                             dimVal = mimgDimNamesMap[dimIdx].second.value;
    640                             dimDwordsNum = mimgDimNamesMap[dimIdx].second.dwordsNum;
    641                             dimDerivsNum = mimgDimNamesMap[dimIdx].second.derivsNum;
     649                            dimVal = mimgDimNamesMap[dimIdx].second;
    642650                            if (haveDim)
    643651                                asmr.printWarning(modPlace, "Dim is already defined");
     
    738746       
    739747        // check number of VADDR registers
    740         cxuint daddrsNum = dimDwordsNum;
     748        cxuint daddrsNum = gfx10MImgDimInfoTbl[dimVal].dwordsNum;
    741749        if ((gcnInsn.mode & GCN_MIMG_VADERIV)!=0)
    742             daddrsNum += dimDerivsNum;
     750            daddrsNum += gfx10MImgDimInfoTbl[dimVal].derivsNum;
    743751        daddrsNum += ((gcnInsn.mode & GCN_MIMG_VA_MIP)!=0) +
    744752                    ((gcnInsn.mode & GCN_MIMG_VA_C)!=0) +
  • CLRadeonExtender/trunk/tests/amdasm/GCNAsmOpc15.cpp

    r4854 r4858  
    31933193    { "v_pk_fma_f16 v55, s71, v166, 0x3d4c /* 1.3242h */ op_sel_hi:[0,0,0]\n",
    31943194        { 0xcc0e0037U, 0x03ff4c47U, 0x3d4c }, 3, true, "" },
     3195    /* MIMG encoding */
     3196    { "image_load      v[157:160], v121, s[84:87] dmask:11 dim:1d unorm glc slc "
     3197        "r128 tfe lwe\n", { 0xf203bb00U, 0x00159d79U }, 2, true, "" },
     3198    /* MIMG flags */
     3199    { "image_load      v[157:159], v121, s[84:87] dmask:11 dim:1d unorm glc slc "
     3200        "r128 tfe lwe d16\n", { 0xf203bb00U, 0x80159d79U }, 2, true, "" },
     3201    { "image_load      v[157:159], v121, s[84:87] dmask:11 dim:1d unorm slc r128 "
     3202        "tfe lwe d16\n", { 0xf2039b00U, 0x80159d79U }, 2, true, "" },
     3203    { "image_load      v[157:159], v121, s[84:87] dmask:11 dim:1d slc r128 tfe lwe d16\n",
     3204        { 0xf2038b00U, 0x80159d79U }, 2, true, "" },
     3205    { "image_load      v[157:160], v121, s[84:91] dmask:11 dim:1d unorm glc slc tfe lwe\n",
     3206        { 0xf2033b00U, 0x00159d79U }, 2, true, "" },
     3207    { "image_load      v[157:160], v121, s[84:91] dmask:11 dim:1d unorm glc tfe lwe\n",
     3208        { 0xf0033b00U, 0x00159d79U }, 2, true, "" },
     3209    { "image_load      v[157:159], v121, s[84:91] dmask:11 dim:1d unorm glc slc lwe\n",
     3210        { 0xf2023b00U, 0x00159d79U }, 2, true, "" },
     3211    { "image_load      v[157:159], v121, s[84:91] dmask:11 dim:1d unorm glc slc\n",
     3212        { 0xf2003b00U, 0x00159d79U }, 2, true, "" },
     3213    /* MIMG dims */
     3214    { "image_load      v[157:159], v[121:122], s[84:91] dmask:11 dim:2d unorm glc slc\n",
     3215        { 0xf2003b08U, 0x00159d79U }, 2, true, "" },
     3216    { "image_load      v[157:159], v[121:123], s[84:91] dmask:11 dim:3d unorm glc slc\n",
     3217        { 0xf2003b10U, 0x00159d79U }, 2, true, "" },
     3218    { "image_load      v[157:159], v[121:123], s[84:91] dmask:11 dim:cube unorm glc slc\n",
     3219        { 0xf2003b18U, 0x00159d79U }, 2, true, "" },
     3220    { "image_load      v[157:159], v[121:122], s[84:91] dmask:11 dim:1d_array "
     3221        "unorm glc slc\n", { 0xf2003b20U, 0x00159d79U }, 2, true, "" },
     3222    { "image_load      v[157:159], v[121:123], s[84:91] dmask:11 dim:2d_array unorm "
     3223        "glc slc\n", { 0xf2003b28U, 0x00159d79U }, 2, true, "" },
     3224    { "image_load      v[157:159], v[121:123], s[84:91] dmask:11 dim:2d_msaa unorm "
     3225        "glc slc\n", { 0xf2003b30U, 0x00159d79U }, 2, true, "" },
     3226    { "image_load      v[157:159], v[121:124], s[84:91] dmask:11 dim:2d_msaa_array "
     3227        "unorm glc slc\n", { 0xf2003b38U, 0x00159d79U }, 2, true, "" },
     3228    { "image_load      v[157:159], v[121:122], s[84:91] dmask:11 dim:@1 unorm glc slc\n",
     3229        { 0xf2003b08U, 0x00159d79U }, 2, true, "" },
     3230    { "image_load      v[157:159], v[121:123], s[84:91] dmask:11 dim:@3 unorm glc slc\n",
     3231        { 0xf2003b18U, 0x00159d79U }, 2, true, "" },
    31953232    { nullptr, { }, 0, false, 0 }
    31963233};
Note: See TracChangeset for help on using the changeset viewer.