diff --git a/core/libs/prx/libSceAgcDriver/tests/execution/Dpp8.cpp b/core/libs/prx/libSceAgcDriver/tests/execution/Dpp8.cpp new file mode 100644 index 000000000..61d69c415 --- /dev/null +++ b/core/libs/prx/libSceAgcDriver/tests/execution/Dpp8.cpp @@ -0,0 +1,285 @@ +#include "prx/libSceAgcDriver/Execution/include/VulkanDevice.hpp" +#include "prx/libSceAgcDriver/Graphics/include/Draw.hpp" +#include "Recompiler.hpp" +#include "VulkanTestDevice.hpp" +#include +#include +#include +#include +#include +#include +#include +#include + +namespace { + +using AgcDriver::Graphics::Require; +using ShaderRecompiler::ShaderStage; + +constexpr std::uint32_t MaxThreads = 64; +constexpr std::uint32_t Inputs = 4; +constexpr std::uint32_t Results = 16; +constexpr std::uint32_t Checked = 12; +alignas(256) std::array Input{}; +alignas(256) std::array Output{}; + +alignas(256) constexpr std::array Wave32Code{ + 0x34020084, 0x34060086, 0xe0381000, 0x80000401, 0xbf8c3f70, 0x7e1402ff, 0xdeaddead, 0x7e1602ff, + 0xdeaddead, 0x7e1802ff, 0xdeaddead, 0x7e1a02ff, 0xdeaddead, 0x7e1c02ff, 0xdeaddead, 0x7e1e02ff, + 0xdeaddead, 0x7e2002ff, 0xdeaddead, 0x7e2202ff, 0xdeaddead, 0x7e2402ff, 0xdeaddead, 0x7e2602ff, + 0xdeaddead, 0x7e2802ff, 0xdeaddead, 0x7e2a02ff, 0xdeaddead, 0x7e1402e9, 0x78afc504, 0x7e1602ea, + 0x05397704, 0x4a180ae9, 0x00024904, 0x061a0ee9, 0x97705306, 0x7e1c0306, 0x561c0ee9, 0xa5602406, + 0x7d880b04, 0x021e0ae9, 0x78afc504, 0x7e200ae9, 0x97705304, 0x50220ae9, 0x05397704, 0x7e1202ff, + 0x12345678, 0xbefe03ff, 0x5a5af0f3, 0x7e2402e9, 0x78afc504, 0x7e2602ea, 0x78afc504, 0x4c280ae9, + 0xa5602404, 0x7e2a02e9, 0x05397709, 0xbefe03c1, 0xe0781000, 0x80010a03, 0xe0781010, 0x80010e03, + 0xe0781020, 0x80011203, 0xbf810000, +}; + +alignas(256) constexpr std::array Wave64Code{ + 0x34020084, 0x34060086, 0xe0381000, 0x80000401, 0xbf8c3f70, 0x7e1402ff, 0xdeaddead, 0x7e1602ff, + 0xdeaddead, 0x7e1802ff, 0xdeaddead, 0x7e1a02ff, 0xdeaddead, 0x7e1c02ff, 0xdeaddead, 0x7e1e02ff, + 0xdeaddead, 0x7e2002ff, 0xdeaddead, 0x7e2202ff, 0xdeaddead, 0x7e2402ff, 0xdeaddead, 0x7e2602ff, + 0xdeaddead, 0x7e2802ff, 0xdeaddead, 0x7e2a02ff, 0xdeaddead, 0x7e1402e9, 0x78afc504, 0x7e1602ea, + 0x05397704, 0x4a180ae9, 0x00024904, 0x061a0ee9, 0x97705306, 0x7e1c0306, 0x561c0ee9, 0xa5602406, + 0x7d880b04, 0x021e0ae9, 0x78afc504, 0x7e200ae9, 0x97705304, 0x50220ae9, 0x05397704, 0x7e1202ff, + 0x12345678, 0xbefe03ff, 0x5a5af0f3, 0xbeff03ff, 0xc3a5960f, 0x7e2402e9, 0x78afc504, 0x7e2602ea, + 0x78afc504, 0x4c280ae9, 0xa5602404, 0x7e2a02e9, 0x05397709, 0xbefe04c1, 0xe0781000, 0x80010a03, + 0xe0781010, 0x80010e03, 0xe0781020, 0x80011203, 0xbf810000, +}; + +constexpr std::uint32_t Rows[64][4] = { + {0x1e7ea419u, 0x51c9bc70u, 0x42800000u, 0xc2180000u}, + {0xe255accbu, 0x39292d22u, 0x422c0000u, 0x42740000u}, + {0xc0433cbdu, 0xc5e818fau, 0x42400000u, 0xc0400000u}, + {0x00a61f93u, 0x9d3c7decu, 0xc2300000u, 0xc2100000u}, + {0x49889310u, 0xd11745adu, 0xc21c0000u, 0x424c0000u}, + {0x02f0ee99u, 0xd0944996u, 0x42740000u, 0x41800000u}, + {0x35d14880u, 0x65b00a2du, 0x00000000u, 0x41c80000u}, + {0xfadb8908u, 0xffb88309u, 0x41d80000u, 0x42000000u}, + {0xffe976abu, 0xbef7e268u, 0xc2340000u, 0x41b80000u}, + {0x16f44881u, 0x8eb5140fu, 0x41200000u, 0x41100000u}, + {0x751b4c83u, 0x24114258u, 0x41700000u, 0xc2680000u}, + {0xd9090b89u, 0xb5fb12e0u, 0x41f00000u, 0x41e80000u}, + {0x7608d942u, 0x6c167229u, 0xc2240000u, 0x42180000u}, + {0xe41686cdu, 0x95f19a51u, 0x427c0000u, 0xc20c0000u}, + {0x6ce9da66u, 0x81a0ba05u, 0x42740000u, 0x42140000u}, + {0xeab06e9bu, 0x864fa3f3u, 0x40000000u, 0x422c0000u}, + {0x90624fe3u, 0xed1d9d16u, 0x42680000u, 0xc2680000u}, + {0x93550840u, 0x397a7623u, 0xc1f80000u, 0xc2500000u}, + {0xf675299bu, 0xb464c554u, 0xc2180000u, 0x42340000u}, + {0x78549014u, 0x2475263cu, 0x426c0000u, 0xc0c00000u}, + {0xd9814559u, 0xe2cbbb93u, 0xc2040000u, 0x42500000u}, + {0xac9f21dfu, 0x782afe6bu, 0x00000000u, 0x42180000u}, + {0xab74fe57u, 0xff8b2a6au, 0x41600000u, 0x42800000u}, + {0xb2c55523u, 0x7a98b9acu, 0x42180000u, 0x42380000u}, + {0x33d91808u, 0x4b5c1a95u, 0x40800000u, 0xc2780000u}, + {0x0879d955u, 0x265c28eau, 0x42540000u, 0x42740000u}, + {0x5c24c1aeu, 0xebe80fa9u, 0xc1500000u, 0x40000000u}, + {0xb1515fffu, 0x7c4e4248u, 0x425c0000u, 0x427c0000u}, + {0xced66b44u, 0x6f29a9f1u, 0xc2600000u, 0x41200000u}, + {0x511070a7u, 0x7528ea79u, 0xc21c0000u, 0x42400000u}, + {0xb07822dbu, 0xb76dc0c3u, 0x40000000u, 0x424c0000u}, + {0xec0643b1u, 0xf71bd135u, 0xc1900000u, 0x42300000u}, + {0xd7aa2208u, 0xba5c875cu, 0x42680000u, 0xc2400000u}, + {0xa60741f3u, 0x44371ff3u, 0x427c0000u, 0x41f00000u}, + {0x18bee074u, 0x31d06d9cu, 0x42240000u, 0xc1d80000u}, + {0x730b89dcu, 0xea9e7ab5u, 0xc2740000u, 0xc2240000u}, + {0x000e05d0u, 0x7383d496u, 0xc22c0000u, 0xc1600000u}, + {0x3f724926u, 0x1eedfcfcu, 0xc2540000u, 0x40800000u}, + {0xab215122u, 0xc1f6192bu, 0x41d80000u, 0xc1c80000u}, + {0x01504585u, 0x503dc86bu, 0x42740000u, 0xc1f00000u}, + {0x8bb9c912u, 0x3911c9b0u, 0x42640000u, 0xc1f80000u}, + {0xf551abfdu, 0x991f77c9u, 0x41200000u, 0xc22c0000u}, + {0x6af38f6cu, 0xab266981u, 0xc1c00000u, 0xc1f00000u}, + {0xc88f63d6u, 0xc84c1884u, 0x41600000u, 0x42240000u}, + {0x63f1bbbcu, 0xced8c284u, 0xc1d00000u, 0xc1600000u}, + {0x6041f10eu, 0x039e257au, 0xc2140000u, 0x420c0000u}, + {0xe344f1c3u, 0x12cc86e3u, 0xc24c0000u, 0x41c00000u}, + {0xa5721c6au, 0x5a789b32u, 0xc2680000u, 0xc2680000u}, + {0x82a8c712u, 0x79dcbc81u, 0x41980000u, 0x41500000u}, + {0x733c6676u, 0x5377899au, 0xc2040000u, 0x427c0000u}, + {0xf2e36355u, 0x7771f894u, 0xc1a80000u, 0xc1c80000u}, + {0x975cef7au, 0x850567c2u, 0xc1400000u, 0x423c0000u}, + {0x9f93693fu, 0x561f8bfeu, 0x42540000u, 0xc0a00000u}, + {0xadb21095u, 0xb5fc684au, 0xc23c0000u, 0x42180000u}, + {0x08be3b07u, 0x320be3f8u, 0xc1a00000u, 0xc2540000u}, + {0xa5f27419u, 0x8b75d02au, 0xc2500000u, 0x424c0000u}, + {0xde3b7dd3u, 0xc134a79bu, 0xc1800000u, 0x426c0000u}, + {0xb600860cu, 0xadbafed0u, 0xc26c0000u, 0xc1f80000u}, + {0xa5497863u, 0x87a9ec13u, 0xc1100000u, 0xc1e80000u}, + {0x290f5d0fu, 0xa945e7bbu, 0xc1880000u, 0x420c0000u}, + {0x45d6ac42u, 0x6ce4048fu, 0x42280000u, 0xc2300000u}, + {0x62186f4bu, 0x4e0e8896u, 0xc1880000u, 0x41c00000u}, + {0x2cb8cefcu, 0x43710bafu, 0x42580000u, 0x427c0000u}, + {0xffce6973u, 0xc7be5613u, 0x42280000u, 0x41100000u} +}; + +constexpr std::uint32_t Expected32[32][12] = { + {0x02f0ee99u, 0xfadb8908u, 0x341f693bu, 0xc2a40000u, 0x44c14000u, 0x02f0ee99u, 0x4b261f93u, 0x4ca54578u, 0x02f0ee99u, 0x02f0ee99u, 0xf7bed6a0u, 0x12345678u}, + {0x1e7ea419u, 0x35d14880u, 0x1b7ed9edu, 0x42da0000u, 0xc5120000u, 0x39292d22u, 0xce7ef30du, 0x6efa75a3u, 0x1e7ea419u, 0x1e7ea419u, 0x105f65eeu, 0x12345678u}, + {0xfadb8908u, 0x02f0ee99u, 0xa83dc5c5u, 0x42200000u, 0xc3100000u, 0xfadb8908u, 0xcded529au, 0xc8d90793u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xfadb8908u, 0x49889310u, 0x7f922ab7u, 0x41e00000u, 0xc512c000u, 0xfadb8908u, 0x4df3f521u, 0xe6c510fcu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xc0433cbdu, 0x00a61f93u, 0xef95e9c6u, 0x429c0000u, 0xc21c0000u, 0xc0433cbdu, 0xcca48edfu, 0xd1bd6540u, 0x00000000u, 0xc0433cbdu, 0x64ba02d3u, 0x00000000u}, + {0xe255accbu, 0xc0433cbdu, 0xef12edafu, 0x41800000u, 0x444f4000u, 0xe255accbu, 0x4e574522u, 0x90d78653u, 0xe255accbu, 0xe255accbu, 0x2f6bb66au, 0x00000000u}, + {0x35d14880u, 0xe255accbu, 0x842eae46u, 0x42ac0000u, 0x44866000u, 0x35d14880u, 0x4c3c3ba6u, 0x4805b6f8u, 0x35d14880u, 0x35d14880u, 0x7ca5a29eu, 0x12345678u}, + {0x00a61f93u, 0x1e7ea419u, 0x1e372722u, 0xc0e00000u, 0x44f76000u, 0x00a61f93u, 0x4e931126u, 0x1e372722u, 0x00000000u, 0x00a61f93u, 0x03386b90u, 0x12345678u}, + {0xe41686cdu, 0xeab06e9bu, 0xd5ec2ae9u, 0x42540000u, 0xc4770000u, 0xbef7e268u, 0xce1bdbd2u, 0xa9a85104u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xffe976abu, 0x6ce9da66u, 0xa5a95c90u, 0x41c00000u, 0xc3b38000u, 0xffe976abu, 0x4eea3699u, 0xfb9eee75u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xeab06e9bu, 0xe41686cdu, 0x3b058ad9u, 0xc2400000u, 0x45241000u, 0x24114258u, 0x4db7a244u, 0x0827c926u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xeab06e9bu, 0x7608d942u, 0xccef5b61u, 0xc1800000u, 0xc49f6000u, 0xb5fb12e0u, 0xc9b44aa8u, 0x2c03ec23u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x751b4c83u, 0xd9090b89u, 0x6bffe8d4u, 0x42200000u, 0x450e5000u, 0x6c167229u, 0xcdaa7c8bu, 0x451f7db3u, 0x00000000u, 0x751b4c83u, 0x00d3683du, 0x00000000u}, + {0x16f44881u, 0x751b4c83u, 0x95db10fcu, 0x41d00000u, 0xc3e70000u, 0x95f19a51u, 0x4ed9d3b5u, 0x0b0ce6d5u, 0x00000000u, 0x16f44881u, 0x6a0e65afu, 0x00000000u}, + {0x6ce9da66u, 0x16f44881u, 0x818a30b0u, 0x42c80000u, 0x43d78000u, 0x6ce9da66u, 0xcddf4bcau, 0x98950286u, 0x6ce9da66u, 0x6ce9da66u, 0x7e5f45fbu, 0x00000000u}, + {0xd9090b89u, 0xffe976abu, 0x86391a9eu, 0x40000000u, 0x45297000u, 0x864fa3f3u, 0x4eec11b3u, 0x86391a9fu, 0x00000000u, 0xd9090b89u, 0x5dc6e2dau, 0x00000000u}, + {0xac9f21dfu, 0xb2c55523u, 0x8072a556u, 0x3f800000u, 0x44f68000u, 0xac9f21dfu, 0x4ef0a920u, 0x9fe2f239u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x90624fe3u, 0xab74fe57u, 0xcccf7e63u, 0xc2b40000u, 0x44d2a000u, 0x397a7623u, 0xcd18ad66u, 0xe4ef747bu, 0x00000000u, 0x90624fe3u, 0xa006cf36u, 0x12345678u}, + {0xb2c55523u, 0xac9f21dfu, 0x47b9cd94u, 0x41600000u, 0x4520c000u, 0xb464c554u, 0xced955f0u, 0x6103e734u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xb2c55523u, 0xd9814559u, 0xb7ca2e7cu, 0x42500000u, 0xc3908000u, 0x2475263cu, 0xcedf3b60u, 0xfdf66b96u, 0x00000000u, 0xb2c55523u, 0xdb8ad9c4u, 0x12345678u}, + {0xf675299bu, 0x78549014u, 0x732e0b76u, 0x42b40000u, 0x442dc000u, 0xf675299bu, 0xce9a7556u, 0x5b204ba7u, 0x00000000u, 0xf675299bu, 0xc8a942c4u, 0x12345678u}, + {0x93550840u, 0xf675299bu, 0x088d4e4eu, 0x42500000u, 0xc4b48000u, 0x782afe6bu, 0xcea91603u, 0x6ea02807u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xab74fe57u, 0x93550840u, 0x8fed7a4du, 0x42800000u, 0xc4f64000u, 0xab74fe57u, 0xcea6c1bcu, 0x92e032aau, 0xab74fe57u, 0xab74fe57u, 0x93c9ddd6u, 0x12345678u}, + {0x78549014u, 0x90624fe3u, 0x0afb098fu, 0x41500000u, 0x42180000u, 0x7a98b9acu, 0xce19faebu, 0x0afb0990u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x511070a7u, 0xec0643b1u, 0x53d5f3eau, 0xc0e00000u, 0x45594000u, 0x511070a7u, 0xce9d5d40u, 0x37625e46u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x33d91808u, 0xb07822dbu, 0x2ed6023fu, 0x42400000u, 0xc5523000u, 0x33d91808u, 0x4eb84983u, 0xd6d44bc5u, 0x00000000u, 0x33d91808u, 0xa87a425au, 0x12345678u}, + {0xec0643b1u, 0x511070a7u, 0xf461e8feu, 0x425c0000u, 0xc0a00000u, 0xec0643b1u, 0x4d079d95u, 0x3cf88050u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xec0643b1u, 0xced66b44u, 0x84c81b9du, 0x42860000u, 0x43998000u, 0x7c4e4248u, 0x4e4f6460u, 0x4b24ad8du, 0x00000000u, 0xec0643b1u, 0x83b1bdb8u, 0x12345678u}, + {0x5c24c1aeu, 0xb1515fffu, 0xa302c1f9u, 0xc1000000u, 0xc2100000u, 0x6f29a9f1u, 0xcd9fcde2u, 0x207b09f1u, 0x00000000u, 0x5c24c1aeu, 0x414e78eau, 0x12345678u}, + {0x0879d955u, 0x5c24c1aeu, 0xa9020281u, 0x42480000u, 0xc425c000u, 0x0879d955u, 0xce9f0fbau, 0xd14dac27u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xb07822dbu, 0x0879d955u, 0xeb46d8cbu, 0x41400000u, 0x45291000u, 0xb07822dbu, 0x4ea220e1u, 0xbfe79a18u, 0xb07822dbu, 0xb07822dbu, 0x510c1892u, 0x12345678u}, + {0xb1515fffu, 0x33d91808u, 0x2af4e93du, 0xc1400000u, 0xc4d8c000u, 0xb1515fffu, 0xce44a653u, 0x2af4e93du, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu} +}; +constexpr std::uint32_t Expected64[64][12] = { + {0x02f0ee99u, 0xfadb8908u, 0x341f693bu, 0xc2a40000u, 0x44c14000u, 0x02f0ee99u, 0x4b261f93u, 0x4ca54578u, 0x02f0ee99u, 0x02f0ee99u, 0xf7bed6a0u, 0x12345678u}, + {0x1e7ea419u, 0x35d14880u, 0x1b7ed9edu, 0x42da0000u, 0xc5120000u, 0x39292d22u, 0xce7ef30du, 0x6efa75a3u, 0x1e7ea419u, 0x1e7ea419u, 0x105f65eeu, 0x12345678u}, + {0xfadb8908u, 0x02f0ee99u, 0xa83dc5c5u, 0x42200000u, 0xc3100000u, 0xfadb8908u, 0xcded529au, 0xc8d90793u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xfadb8908u, 0x49889310u, 0x7f922ab7u, 0x41e00000u, 0xc512c000u, 0xfadb8908u, 0x4df3f521u, 0xe6c510fcu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xc0433cbdu, 0x00a61f93u, 0xef95e9c6u, 0x429c0000u, 0xc21c0000u, 0xc0433cbdu, 0xcca48edfu, 0xd1bd6540u, 0x00000000u, 0xc0433cbdu, 0x64ba02d3u, 0x00000000u}, + {0xe255accbu, 0xc0433cbdu, 0xef12edafu, 0x41800000u, 0x444f4000u, 0xe255accbu, 0x4e574522u, 0x90d78653u, 0xe255accbu, 0xe255accbu, 0x2f6bb66au, 0x00000000u}, + {0x35d14880u, 0xe255accbu, 0x842eae46u, 0x42ac0000u, 0x44866000u, 0x35d14880u, 0x4c3c3ba6u, 0x4805b6f8u, 0x35d14880u, 0x35d14880u, 0x7ca5a29eu, 0x12345678u}, + {0x00a61f93u, 0x1e7ea419u, 0x1e372722u, 0xc0e00000u, 0x44f76000u, 0x00a61f93u, 0x4e931126u, 0x1e372722u, 0x00000000u, 0x00a61f93u, 0x03386b90u, 0x12345678u}, + {0xe41686cdu, 0xeab06e9bu, 0xd5ec2ae9u, 0x42540000u, 0xc4770000u, 0xbef7e268u, 0xce1bdbd2u, 0xa9a85104u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xffe976abu, 0x6ce9da66u, 0xa5a95c90u, 0x41c00000u, 0xc3b38000u, 0xffe976abu, 0x4eea3699u, 0xfb9eee75u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xeab06e9bu, 0xe41686cdu, 0x3b058ad9u, 0xc2400000u, 0x45241000u, 0x24114258u, 0x4db7a244u, 0x0827c926u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xeab06e9bu, 0x7608d942u, 0xccef5b61u, 0xc1800000u, 0xc49f6000u, 0xb5fb12e0u, 0xc9b44aa8u, 0x2c03ec23u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x751b4c83u, 0xd9090b89u, 0x6bffe8d4u, 0x42200000u, 0x450e5000u, 0x6c167229u, 0xcdaa7c8bu, 0x451f7db3u, 0x00000000u, 0x751b4c83u, 0x00d3683du, 0x00000000u}, + {0x16f44881u, 0x751b4c83u, 0x95db10fcu, 0x41d00000u, 0xc3e70000u, 0x95f19a51u, 0x4ed9d3b5u, 0x0b0ce6d5u, 0x00000000u, 0x16f44881u, 0x6a0e65afu, 0x00000000u}, + {0x6ce9da66u, 0x16f44881u, 0x818a30b0u, 0x42c80000u, 0x43d78000u, 0x6ce9da66u, 0xcddf4bcau, 0x98950286u, 0x6ce9da66u, 0x6ce9da66u, 0x7e5f45fbu, 0x00000000u}, + {0xd9090b89u, 0xffe976abu, 0x86391a9eu, 0x40000000u, 0x45297000u, 0x864fa3f3u, 0x4eec11b3u, 0x86391a9fu, 0x00000000u, 0xd9090b89u, 0x5dc6e2dau, 0x00000000u}, + {0xac9f21dfu, 0xb2c55523u, 0x8072a556u, 0x3f800000u, 0x44f68000u, 0xac9f21dfu, 0x4ef0a920u, 0x9fe2f239u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x90624fe3u, 0xab74fe57u, 0xcccf7e63u, 0xc2b40000u, 0x44d2a000u, 0x397a7623u, 0xcd18ad66u, 0xe4ef747bu, 0x00000000u, 0x90624fe3u, 0xa006cf36u, 0x12345678u}, + {0xb2c55523u, 0xac9f21dfu, 0x47b9cd94u, 0x41600000u, 0x4520c000u, 0xb464c554u, 0xced955f0u, 0x6103e734u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xb2c55523u, 0xd9814559u, 0xb7ca2e7cu, 0x42500000u, 0xc3908000u, 0x2475263cu, 0xcedf3b60u, 0xfdf66b96u, 0x00000000u, 0xb2c55523u, 0xdb8ad9c4u, 0x12345678u}, + {0xf675299bu, 0x78549014u, 0x732e0b76u, 0x42b40000u, 0x442dc000u, 0xf675299bu, 0xce9a7556u, 0x5b204ba7u, 0x00000000u, 0xf675299bu, 0xc8a942c4u, 0x12345678u}, + {0x93550840u, 0xf675299bu, 0x088d4e4eu, 0x42500000u, 0xc4b48000u, 0x782afe6bu, 0xcea91603u, 0x6ea02807u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xab74fe57u, 0x93550840u, 0x8fed7a4du, 0x42800000u, 0xc4f64000u, 0xab74fe57u, 0xcea6c1bcu, 0x92e032aau, 0xab74fe57u, 0xab74fe57u, 0x93c9ddd6u, 0x12345678u}, + {0x78549014u, 0x90624fe3u, 0x0afb098fu, 0x41500000u, 0x42180000u, 0x7a98b9acu, 0xce19faebu, 0x0afb0990u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x511070a7u, 0xec0643b1u, 0x53d5f3eau, 0xc0e00000u, 0x45594000u, 0x511070a7u, 0xce9d5d40u, 0x37625e46u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x33d91808u, 0xb07822dbu, 0x2ed6023fu, 0x42400000u, 0xc5523000u, 0x33d91808u, 0x4eb84983u, 0xd6d44bc5u, 0x00000000u, 0x33d91808u, 0xa87a425au, 0x12345678u}, + {0xec0643b1u, 0x511070a7u, 0xf461e8feu, 0x425c0000u, 0xc0a00000u, 0xec0643b1u, 0x4d079d95u, 0x3cf88050u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xec0643b1u, 0xced66b44u, 0x84c81b9du, 0x42860000u, 0x43998000u, 0x7c4e4248u, 0x4e4f6460u, 0x4b24ad8du, 0x00000000u, 0xec0643b1u, 0x83b1bdb8u, 0x12345678u}, + {0x5c24c1aeu, 0xb1515fffu, 0xa302c1f9u, 0xc1000000u, 0xc2100000u, 0x6f29a9f1u, 0xcd9fcde2u, 0x207b09f1u, 0x00000000u, 0x5c24c1aeu, 0x414e78eau, 0x12345678u}, + {0x0879d955u, 0x5c24c1aeu, 0xa9020281u, 0x42480000u, 0xc425c000u, 0x0879d955u, 0xce9f0fbau, 0xd14dac27u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xb07822dbu, 0x0879d955u, 0xeb46d8cbu, 0x41400000u, 0x45291000u, 0xb07822dbu, 0x4ea220e1u, 0xbfe79a18u, 0xb07822dbu, 0xb07822dbu, 0x510c1892u, 0x12345678u}, + {0xb1515fffu, 0x33d91808u, 0x2af4e93du, 0xc1400000u, 0xc4d8c000u, 0xb1515fffu, 0xce44a653u, 0x2af4e93du, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x3f724926u, 0x01504585u, 0x6063c94fu, 0xc2da0000u, 0x4504a000u, 0xba5c875cu, 0x4ee61714u, 0xbbaccce2u, 0x00000000u, 0x3f724926u, 0x45a378a4u, 0x00000000u}, + {0xd7aa2208u, 0xab215122u, 0xea3e61e6u, 0x428e0000u, 0xc4996000u, 0x44371ff3u, 0x4dc5f704u, 0xef587116u, 0xd7aa2208u, 0xd7aa2208u, 0xbbc8e00du, 0x00000000u}, + {0x01504585u, 0x3f724926u, 0xd7d7af8fu, 0x42100000u, 0xc4bea000u, 0x01504585u, 0xceb3f17cu, 0x7142b6c2u, 0x00000000u, 0x01504585u, 0xa5d9b46cu, 0x00000000u}, + {0x01504585u, 0x000e05d0u, 0x90a5bca8u, 0x41880000u, 0xc5187000u, 0x01504585u, 0xce215778u, 0xeaac8085u, 0x00000000u, 0x01504585u, 0xed0ba753u, 0x00000000u}, + {0x18bee074u, 0x730b89dcu, 0x4b2df69eu, 0x423c0000u, 0xc3d28000u, 0x18bee074u, 0x4ba822c2u, 0xe68f5e72u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xa60741f3u, 0x18bee074u, 0xf6981f04u, 0x41f80000u, 0x42de0000u, 0x1eedfcfcu, 0xcea9bd5eu, 0x37acdd71u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xab215122u, 0xa60741f3u, 0x99a03b33u, 0xc29c0000u, 0xc4c18000u, 0xab215122u, 0x4e7dc925u, 0x67fd5b1eu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x730b89dcu, 0xd7aa2208u, 0x27e7ea73u, 0xc2920000u, 0x44ce6000u, 0x730b89dcu, 0x49605d00u, 0x27e7ea73u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x6041f10eu, 0xa5721c6au, 0x2e6375adu, 0xc1880000u, 0x4457c000u, 0x3911c9b0u, 0xce5dc271u, 0xde83e61bu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x8bb9c912u, 0xe344f1c3u, 0x8e7123c6u, 0xc2860000u, 0x448d0000u, 0x991f77c9u, 0x4ed5e71fu, 0x7c64698du, 0x00000000u, 0x8bb9c912u, 0xcad243f3u, 0x00000000u}, + {0xa5721c6au, 0x6041f10eu, 0xa078157eu, 0xc1a00000u, 0xc4d8c000u, 0xa5721c6au, 0xcd2ae540u, 0x0b685a8fu, 0xa5721c6au, 0xa5721c6au, 0x54d9967fu, 0x00000000u}, + {0xa5721c6au, 0x63f1bbbcu, 0xbd9dc481u, 0x42c40000u, 0x4512f000u, 0xc84c1884u, 0xcee88c6eu, 0x2c3dd441u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x6af38f6cu, 0xc88f63d6u, 0x5a928b96u, 0xc2900000u, 0x442c0000u, 0x6af38f6cu, 0xceb51bc7u, 0x9768265au, 0x6af38f6cu, 0x6af38f6cu, 0x31273d7cu, 0x00000000u}, + {0xf551abfdu, 0x6af38f6cu, 0x8f57ee8cu, 0xc1800000u, 0xc45b4000u, 0x039e257au, 0xcde5d872u, 0x6e91b4e7u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xe344f1c3u, 0xf551abfdu, 0x9e864ff5u, 0xc1500000u, 0x433d0000u, 0x12cc86e3u, 0x4ec083e2u, 0x081e32e1u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xc88f63d6u, 0x8bb9c912u, 0xe6326444u, 0xc2a80000u, 0x45028000u, 0x5a789b32u, 0x4ec7e377u, 0xe6326445u, 0x00000000u, 0xc88f63d6u, 0xa58764ceu, 0x00000000u}, + {0xadb21095u, 0xa5f27419u, 0xed1922f7u, 0x3f800000u, 0x44310000u, 0x79dcbc81u, 0xced14621u, 0x1fcf309bu, 0xadb21095u, 0xadb21095u, 0x8623437fu, 0x12345678u}, + {0x82a8c712u, 0x08be3b07u, 0xc6b3f010u, 0x42280000u, 0x454ea000u, 0x5377899au, 0xcd51c9cbu, 0x5c35c4a2u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xa5f27419u, 0xadb21095u, 0xeaae5f0au, 0xc2680000u, 0xc3f80000u, 0x7771f894u, 0x4ee678cdu, 0x2524092au, 0xa5f27419u, 0xa5f27419u, 0x0b36ce7eu, 0x12345678u}, + {0xa5f27419u, 0x9f93693fu, 0xf841ce38u, 0x42840000u, 0x445c4000u, 0x850567c2u, 0xcefaae72u, 0x2498d102u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xf2e36355u, 0x975cef7au, 0xd8c85310u, 0xc2640000u, 0x43190000u, 0x561f8bfeu, 0xceb41b18u, 0xed7c7b79u, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x733c6676u, 0xf2e36355u, 0x38a52f5cu, 0x41900000u, 0xc4534000u, 0x733c6676u, 0x4d0be3b0u, 0xa8dfcb9fu, 0x00000000u, 0x733c6676u, 0x3ce6fb0bu, 0x12345678u}, + {0x08be3b07u, 0x733c6676u, 0xb4b4ab0au, 0xc2c80000u, 0x44d82000u, 0x08be3b07u, 0xcea49bdfu, 0xa5484a6eu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x975cef7au, 0x82a8c712u, 0x0e1e973cu, 0x42d00000u, 0xc5191000u, 0x8b75d02au, 0xcec0d92eu, 0x0e1e973du, 0x00000000u, 0x975cef7au, 0x223c406bu, 0x12345678u}, + {0x62186f4bu, 0xffce6973u, 0x77352da7u, 0x42280000u, 0x4519e000u, 0xc134a79bu, 0x4e243d74u, 0xc103110fu, 0x00000000u, 0x62186f4bu, 0x3ecb5865u, 0x12345678u}, + {0xde3b7dd3u, 0x2cb8cefcu, 0x63bb84dcu, 0xc2200000u, 0xc4aa2000u, 0xadbafed0u, 0xceb56d0fu, 0xda73cdcdu, 0xde3b7dd3u, 0xde3b7dd3u, 0x52450130u, 0x12345678u}, + {0xffce6973u, 0x62186f4bu, 0x3daa721fu, 0xc2b00000u, 0x43e38000u, 0x87a9ec13u, 0xce93fef4u, 0xe9c25b5fu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xffce6973u, 0x45d6ac42u, 0x5f466dc7u, 0x41980000u, 0xc4104000u, 0xffce6973u, 0xce071209u, 0xef1c93fdu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xa5497863u, 0x290f5d0fu, 0x4b1f8262u, 0xc0000000u, 0xc511e000u, 0xa5497863u, 0xca465a34u, 0x95f3619eu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0xb600860cu, 0xa5497863u, 0x2c4a0669u, 0x429c0000u, 0xc3690000u, 0x4e0e8896u, 0x4e32e33cu, 0xf35800fau, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu, 0xdeaddeadu}, + {0x2cb8cefcu, 0xb600860cu, 0x21ac8982u, 0x42380000u, 0xc564f000u, 0x2cb8cefcu, 0x4ec430dfu, 0xf97191bbu, 0x2cb8cefcu, 0x2cb8cefcu, 0x728f7a5du, 0x12345678u}, + {0x290f5d0fu, 0xde3b7dd3u, 0xa5f9d3e6u, 0x424c0000u, 0xc2de0000u, 0xc7be5613u, 0x4e8bad59u, 0xa5f9d3e7u, 0x00000000u, 0x290f5d0fu, 0x3841a9edu, 0x12345678u} +}; + +constexpr const char* Names[Checked] = {"mov", "mov_fi", "add_nc_u32", "add_f32", "fmac_f32", "cndmask", "cvt_f32_i32", "add_co_ci_u32", "mov_inactive", "mov_inactive_fi", "sub_nc_u32_inactive", "mov_uniform_inactive"}; + +std::array BufferDescriptor(const void* data, std::uint32_t bytes) { + const auto address = reinterpret_cast(data); + return {static_cast(address), static_cast((address >> 32u) & 0xffffu), bytes, 0x01016facu}; +} + +std::string Hex(std::uint32_t value) { + char text[16]; + std::snprintf(text, sizeof(text), "0x%08x", value); + return text; +} + +void Run(AgcDriver::VulkanDevice& device, std::span code, std::uint32_t waveSize, const ShaderRecompiler::SpirvTarget& target) { + for (std::uint32_t tid = 0; tid < MaxThreads; ++tid) std::copy(std::begin(Rows[tid]), std::end(Rows[tid]), &Input[tid * Inputs]); + Output.fill(0xdeadbeefu); + std::vector userData(8, 0u); + const auto input = BufferDescriptor(Input.data(), static_cast(Input.size() * 4u)); + const auto output = BufferDescriptor(Output.data(), static_cast(Output.size() * 4u)); + std::copy(input.begin(), input.end(), userData.begin()); + std::copy(output.begin(), output.end(), userData.begin() + 4); + const std::array memory{{{reinterpret_cast(code.data()), std::as_bytes(code)}}}; + const ShaderRecompiler::ShaderComputeStageInfo compute{{waveSize, 1, 1}, 0u, {false, false, false}, false, 1}; + ShaderRecompiler::RecompileRequest request{ + {ShaderStage::Compute, reinterpret_cast(code.data()), code, 0, {}}, + {waveSize, 0, userData, compute, std::nullopt, std::nullopt, memory}, + target, + {0, 0, 0, 128} + }; + request.useCache = false; + const auto result = ShaderRecompiler::Recompile(request); + device.Dispatch(result, 1, 1, 1, {}, reinterpret_cast(code.data())); + device.WaitIdle(); +} + +template +void Check(const std::uint32_t (&expected)[Lanes][Checked]) { + for (std::uint32_t tid = 0; tid < Lanes; ++tid) { + for (std::uint32_t index = 0; index < Checked; ++index) { + const auto actual = Output[tid * Results + index]; + Require(actual == expected[tid][index], "dpp8 wave" + std::to_string(Lanes) + ": lane " + std::to_string(tid) + " " + Names[index] + " is " + Hex(actual) + ", expected " + Hex(expected[tid][index])); + } + } +} + +} + +int main() { + try { + const auto device = OpenVulkanTestDevice(); + if (!device) return VulkanTestSkipped; + if (device->Target().subgroupSize < 32) { + std::printf("skipped, subgroup size %u cannot hold a wave32\n", device->Target().subgroupSize); + return VulkanTestSkipped; + } + Run(*device, Wave32Code, 32, device->ComputeTarget(32)); + Check(Expected32); + Run(*device, Wave64Code, 64, device->Target()); + Check(Expected64); + Run(*device, Wave64Code, 64, device->ComputeTarget(32)); + Check(Expected64); + std::puts("dpp8 tests passed"); + return 0; + } catch (const std::exception& error) { + std::cerr << error.what() << '\n'; + return 1; + } +} diff --git a/core/libs/tests/Wave32WideSubgroup.cpp b/core/libs/tests/Wave32WideSubgroup.cpp index 7635e864c..af28fb59d 100644 --- a/core/libs/tests/Wave32WideSubgroup.cpp +++ b/core/libs/tests/Wave32WideSubgroup.cpp @@ -150,7 +150,7 @@ void Check(std::uint32_t size, const Value& masks) { const auto readFirst = EmitReadFirstLane(context, first); const auto readLane = EmitReadLane(context, read); const auto active = EmitBallotLaneActiveBool(state, ballot, requestedId); - const auto quad = EmitDppQuadPermTargetLane(state, logicalId, 0x1bu); + const auto quad = EmitDppGroupPermTargetLane(state, logicalId, 0x1bu, 2u); const auto quadValue = context.Shuffle(read, 0, quad.lane); const auto hardwareActive = EmitSubgroupLaneActiveBool(state, requestedId); const auto swizzled = EmitSwizzleU32(context, swizzle); diff --git a/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hpp b/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hpp index 3ba9c509f..c7c17fe26 100644 --- a/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hpp +++ b/core/shader/recompiler/IntermediateRepresentation/include/IntermediateRepresentation/IrOpcode.hpp @@ -440,7 +440,8 @@ struct ImageOpcodeInfo { }; struct DppMoveFlags { - std::uint16_t control = 0; + static constexpr std::uint32_t Lanes8 = 0x1000000u; + std::uint32_t control = 0; std::uint8_t rowMask = 0xf; std::uint8_t bankMask = 0xf; bool fetchInactive = false; diff --git a/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaInstruction.hpp b/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaInstruction.hpp index e27d5fb18..a3b7ea54c 100644 --- a/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaInstruction.hpp +++ b/core/shader/recompiler/RdnaDecoder/include/RdnaDecoder/RdnaInstruction.hpp @@ -100,6 +100,7 @@ struct RdnaOperand { bool absolute = false; bool clamp = false; bool dpp = false; + bool dpp8 = false; }; struct RdnaInstruction { diff --git a/core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp b/core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp index e70717129..9ddc3f21c 100644 --- a/core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp +++ b/core/shader/recompiler/RdnaDecoder/src/RdnaVectorOpDecoder.cpp @@ -691,6 +691,38 @@ bool isPermlaneOpcode(RdnaOpcode opcode) { return opcode == RdnaOpcode::VPermlane16B32 || opcode == RdnaOpcode::VPermlanex16B32; } +bool acceptsDpp8(RdnaOpcode opcode) { + switch (opcode) { + case RdnaOpcode::VReadfirstlaneB32: + case RdnaOpcode::VCvtI32F64: + case RdnaOpcode::VCvtF64I32: + case RdnaOpcode::VCvtF32F64: + case RdnaOpcode::VCvtF64F32: + case RdnaOpcode::VCvtU32F64: + case RdnaOpcode::VCvtF64U32: + case RdnaOpcode::VTruncF64: + case RdnaOpcode::VCeilF64: + case RdnaOpcode::VRndneF64: + case RdnaOpcode::VFloorF64: + case RdnaOpcode::VFrexpExpI32F64: + case RdnaOpcode::VFrexpMantF64: + case RdnaOpcode::VFractF64: + case RdnaOpcode::VSwapB32: + case RdnaOpcode::VSwaprelB32: + case RdnaOpcode::VMacLegacyF32: + case RdnaOpcode::VMadmkF32: + case RdnaOpcode::VMadakF32: + case RdnaOpcode::VFmamkF16: + case RdnaOpcode::VFmaakF16: + case RdnaOpcode::VPkFmacF16: + case RdnaOpcode::VMovrelsB32: + case RdnaOpcode::VMovrelsdB32: + case RdnaOpcode::VMovrelsd2B32: + return false; + default: return true; + } +} + bool isNativeVop3F16TernaryOpcode(RdnaOpcode opcode) { return opcode == RdnaOpcode::VMin3F16 || opcode == RdnaOpcode::VMax3F16 || opcode == RdnaOpcode::VMed3F16 || opcode == RdnaOpcode::VDivFixupF16 || @@ -1152,7 +1184,14 @@ void applyDppModifier(RdnaOperand& operand, std::uint32_t modifier) { operand.dppRowMask = (modifier >> 28u) & 0xfu; } -void decodeVop1Dpp(std::uint32_t programCounter, std::span code, std::uint32_t wordIndex, std::uint32_t vdst, RdnaInstruction& instruction) { +void applyDpp8Modifier(RdnaOperand& operand, std::uint32_t modifier, bool fetchInactive) { + operand.dpp = true; + operand.dpp8 = true; + operand.dppCtrl = modifier >> 8u; + operand.dppFetchInactive = fetchInactive; +} + +void decodeVop1Dpp(std::uint32_t programCounter, std::span code, std::uint32_t wordIndex, std::uint32_t form, std::uint32_t vdst, RdnaInstruction& instruction) { if (static_cast(wordIndex) + 1u >= code.size()) { throw std::out_of_range("truncated VOP1 DPP instruction"); } @@ -1164,7 +1203,13 @@ void decodeVop1Dpp(std::uint32_t programCounter, std::span ? DecodeRdnaScalarDestination(vdst, programCounter) : DecodeRdnaVectorGpr(vdst); instruction.source0 = DecodeRdnaScalarSource(src0 + 256u, programCounter); - applyDppModifier(instruction.source0, modifier); + if (form == 250u) { + applyDppModifier(instruction.source0, modifier); + } else if (acceptsDpp8(instruction.op)) { + applyDpp8Modifier(instruction.source0, modifier, form == 234u); + } else { + throw std::invalid_argument("DPP8 modifier is not supported for opcode"); + } instruction.sourceCount = 1; if (!isVop1FloatSourceOpcode(instruction.op) && (instruction.source0.negate || instruction.source0.absolute)) { @@ -1346,7 +1391,7 @@ void decodeVop2Sdwa(std::uint32_t programCounter, std::span finalizeVop2Instruction(code, wordIndex, instruction); } -void decodeVop2Dpp(std::uint32_t programCounter, std::span code, std::uint32_t wordIndex, std::uint32_t opcode, std::uint32_t vdst, std::uint32_t vsrc1, RdnaInstruction& instruction) { +void decodeVop2Dpp(std::uint32_t programCounter, std::span code, std::uint32_t wordIndex, std::uint32_t form, std::uint32_t vdst, std::uint32_t vsrc1, RdnaInstruction& instruction) { if (static_cast(wordIndex) + 1u >= code.size()) { throw std::out_of_range("truncated VOP2 DPP instruction"); } @@ -1357,9 +1402,15 @@ void decodeVop2Dpp(std::uint32_t programCounter, std::span instruction.destination = DecodeRdnaVectorGpr(vdst); instruction.source1 = DecodeRdnaVectorGpr(vsrc1); instruction.source0 = DecodeRdnaScalarSource(src0 + 256u, programCounter); - applyDppModifier(instruction.source0, modifier); - instruction.source1.negate = ((modifier >> 22u) & 0x1u) != 0u; - instruction.source1.absolute = ((modifier >> 23u) & 0x1u) != 0u; + if (form == 250u) { + applyDppModifier(instruction.source0, modifier); + instruction.source1.negate = ((modifier >> 22u) & 0x1u) != 0u; + instruction.source1.absolute = ((modifier >> 23u) & 0x1u) != 0u; + } else if (acceptsDpp8(instruction.op)) { + applyDpp8Modifier(instruction.source0, modifier, form == 234u); + } else { + throw std::invalid_argument("DPP8 modifier is not supported for opcode"); + } const bool packedFmac = instruction.op == RdnaOpcode::VPkFmacF16; if (packedFmac) { instruction.source0.negateHi = instruction.source0.negate; @@ -1955,8 +2006,8 @@ RdnaInstruction DecodeRdnaVop1(std::uint32_t programCounter, std::span= 0x101u && control <= 0x10fu) { return EmitDppRowShiftTargetLane(state, subid, control & 0xfu, true); diff --git a/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp b/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp index 235393ebe..98ae5480b 100644 --- a/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp +++ b/core/shader/recompiler/Translation/src/TranslationContext/OperandAccess.cpp @@ -5,6 +5,15 @@ namespace ShaderRecompiler { +namespace { + +DppMoveFlags dppFlags(const RdnaOperand& operand) { + const auto control = operand.dpp8 ? DppMoveFlags::Lanes8 | operand.dppCtrl : operand.dppCtrl; + return {control, static_cast(operand.dppRowMask), static_cast(operand.dppBankMask), operand.dppFetchInactive, operand.dppBoundCtrl}; +} + +} + const RdnaOperand& TranslationContext::sourceAt(const RdnaInstruction& inst, std::uint32_t index) { switch (index) { case 0u: return inst.source0; @@ -26,6 +35,7 @@ RdnaOperand TranslationContext::destinationOperand(const RdnaInstruction& inst) continue; } destination.dpp = true; + destination.dpp8 = source.dpp8; destination.dppCtrl = source.dppCtrl; destination.dppRowMask = source.dppRowMask; destination.dppBankMask = source.dppBankMask; @@ -111,6 +121,7 @@ RdnaOperand TranslationContext::plainOperand(const RdnaOperand& operand) { result.dppFetchInactive = false; result.dppBoundCtrl = false; result.dpp = false; + result.dpp8 = false; return result; } @@ -223,7 +234,7 @@ void TranslationContext::writeOperand(const RdnaOperand& operand, IrValue* value IrU32 TranslationContext::applyBitSourceModifiers(const RdnaOperand& operand, IrU32 value) { if (operand.dpp) { - const DppMoveFlags flags{static_cast(operand.dppCtrl), static_cast(operand.dppRowMask), static_cast(operand.dppBankMask), operand.dppFetchInactive, operand.dppBoundCtrl}; + const auto flags = dppFlags(operand); value = IrU32(ir.Emit(IrOpcode::DppMoveU32, IrType::U32, {&value.Value(), &ir.GetExec()}, flags)); } if (operand.sdwaSel != 6u) { @@ -355,7 +366,7 @@ void TranslationContext::writeRawU32(const RdnaOperand& operand, IrU32 value) { const VectorReg reg = static_cast(operand.reg); IrValue& old = ir.GetVectorReg(reg); if (operand.dpp) { - const DppMoveFlags flags{static_cast(operand.dppCtrl), static_cast(operand.dppRowMask), static_cast(operand.dppBankMask), operand.dppFetchInactive, operand.dppBoundCtrl}; + const auto flags = dppFlags(operand); value = IrU32(ir.Emit(IrOpcode::DppUpdateU32, IrType::U32, {&value.Value(), &old, &ir.GetExec()}, flags)); } else { value = IrU32(ir.Select(ir.GetExec(), value.Value(), old));