@@ -797,7 +797,8 @@ static constexpr auto kAmdCardInfo = []() consteval
797797 " AMD Radeon(TM) Navi Graphics Custom Made for Magic Leap" },
798798 { kGfx10_3_3 , 0x163F , 0xE1 , kGfx10_3 , true , " gfx1033" ,
799799 " AMD Radeon(TM) Navi Graphics Custom Made for Magic Leap" },
800- { kGfx10_3_3 , 0x163F , 0xAF , kGfx10_3 , true , " gfx1033" , " AMD Radeon(TM) Graphics" },
800+ { kGfx10_3_3 , 0x163F , 0xAF , kGfx10_3 , true , " gfx1033" , " AMD Custom GPU 0405" },
801+ { kGfx10_3_3 , 0x1435 , 0xAE , kGfx10_3 , true , " gfx1033" , " AMD Custom GPU 0932" },
801802
802803 { kGfx10_3_4 , 0x7420 , 0x00 , kGfx10_3 , false , " gfx1034" , " AMD Radeon(TM) Graphics" },
803804 { kGfx10_3_4 , 0x7422 , 0x00 , kGfx10_3 , false , " gfx1034" , " AMD Radeon PRO W6400" },
@@ -1214,6 +1215,17 @@ static constexpr auto kAmdCardInfo = []() consteval
12141215 { kGfx11_5_1 , 0x1586 , 0xE2 , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8050S Graphics" },
12151216 { kGfx11_5_1 , 0x1586 , 0xE3 , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8050S Graphics" },
12161217
1218+ {kGfx11_5_1 , 0x1586 , 0xCA , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8065S Graphics" },
1219+ {kGfx11_5_1 , 0x1586 , 0xCB , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8060S Graphics" },
1220+ {kGfx11_5_1 , 0x1586 , 0xCC , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8050S Graphics" },
1221+ {kGfx11_5_1 , 0x1586 , 0xCD , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8060S Graphics" },
1222+ {kGfx11_5_1 , 0x1586 , 0xCE , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8050S Graphics" },
1223+ {kGfx11_5_1 , 0x1586 , 0xCF , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8040S Graphics" },
1224+ {kGfx11_5_1 , 0x1586 , 0xDA , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8065S Graphics" },
1225+ {kGfx11_5_1 , 0x1586 , 0xDB , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8050S Graphics" },
1226+ {kGfx11_5_1 , 0x1586 , 0xDC , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8050S Graphics" },
1227+ {kGfx11_5_1 , 0x1586 , 0xDD , kGfx11_5 , true , " gfx1151" , " AMD Radeon(TM) 8040S Graphics" },
1228+
12171229 { kGfx11_5_2 , 0x1114 , 0x00 , kGfx11_5 , true , " gfx1152" , " AMD Radeon(TM) Graphics" },
12181230 { kGfx11_5_2 , 0x1114 , 0xC1 , kGfx11_5 , true , " gfx1152" , " AMD Radeon(TM) Graphics" },
12191231 { kGfx11_5_2 , 0x1114 , 0xC2 , kGfx11_5 , true , " gfx1152" , " AMD Radeon(TM) 860M Graphics" },
@@ -1485,32 +1497,61 @@ static constexpr auto kDeviceInfo = std::to_array<DeviceInfo>({
14851497 return std::nullopt ;
14861498}
14871499
1488- [[nodiscard]] constexpr std::optional<uint32_t > GetTotalLdsSizeInBytesImpl (const HwGeneration gen,
1489- const uint8_t num_cus) noexcept
1490- {
1491- // Anything less than GFX9 is not supported.
1492- if (gen < kGfx9 ) [[unlikely]]
1493- {
1494- return std::nullopt ;
1495- }
1496-
1497- static_assert (kCdna4 < kGfx11_5 , " Update this check!" );
1498- if (gen == kCdna4 )
1499- {
1500- constexpr uint32_t kLdsBytesPerCu = 160 * 1024 ;
1501- return num_cus * kLdsBytesPerCu ;
1502- }
1500+ static_assert (
1501+ []() constexpr noexcept {
1502+ constexpr uint32_t kRevisions [] = {0xCA , 0xCB , 0xCC , 0xCD , 0xCE , 0xCF , 0xDA , 0xDB , 0xDC , 0xDD };
1503+ for (const uint32_t revision_id : kRevisions )
1504+ {
1505+ const auto card_info = GetCardInfoForDevice ({device_info::kAmdVendorId , 0x1586 , revision_id});
1506+ if (!card_info.has_value () || card_info->asic_type != device_info::AsicType::kGfx11_5_1 || card_info->generation != kGfx11_5 ||
1507+ !card_info->is_apu )
1508+ {
1509+ return false ;
1510+ }
1511+
1512+ const auto device_info = GetDeviceInfoForAsicType (card_info->asic_type );
1513+ if (!device_info.has_value () || device_info->num_cus != 40 )
1514+ {
1515+ return false ;
1516+ }
1517+ }
1518+ return true ;
1519+ }(),
1520+ " Device ID 0x1586 (revisions 0xCA-0xCF and 0xDA-0xDD) is not properly supported by GetCardInfoForDevice." );
15031521
1504- static_assert (kGfx11_5 > kGfx12 , " Update this check!" );
1505- if (gen <= kGfx11_5 )
1522+ [[nodiscard]] constexpr std::optional<uint32_t > GetTotalLdsSizeInBytesImpl (const HwGeneration gen, const uint8_t num_cus) noexcept
15061523 {
1507- constexpr uint32_t kLdsBytesPerCu = 64 * 1024 ;
1508- return num_cus * kLdsBytesPerCu ;
1524+ constexpr uint32_t kKiB = 1024 ;
1525+ uint32_t lds_bytes_per_cu = 0 ;
1526+ switch (gen)
1527+ {
1528+ case kGfx9 :
1529+ case kGfx10 :
1530+ case kGfx10_3 :
1531+ case kGfx11 :
1532+ case kGfx11_5 :
1533+ case kGfx12 :
1534+ case kCdna :
1535+ case kCdna2 :
1536+ case kCdna3 :
1537+ lds_bytes_per_cu = 64 * kKiB ;
1538+ break ;
1539+ case kCdna4 :
1540+ lds_bytes_per_cu = 160 * kKiB ;
1541+ break ;
1542+ case kUndefinedGeneration :
1543+ case kNvidia :
1544+ case kIntel :
1545+ case kSouthernIsland :
1546+ case kSeaIsland :
1547+ case kVolcanicIsland :
1548+ [[fallthrough]] ;
1549+ [[unlikely]] default :
1550+ return std::nullopt ;
1551+ }
1552+ return num_cus * lds_bytes_per_cu;
15091553 }
15101554
1511- return std::nullopt ;
1512- }
1513-
15141555// Compile-time tests — one per HW generation, with an arbitrary CU count of 4.
15151556static_assert (!GetTotalLdsSizeInBytesImpl(kUndefinedGeneration , 4 ).has_value());
15161557static_assert (!GetTotalLdsSizeInBytesImpl(kNvidia , 4 ).has_value());
0 commit comments