Skip to content

Commit

Permalink
Started adding support for VkCooperativeMatrixPropertiesKHR
Browse files Browse the repository at this point in the history
Refs #190
  • Loading branch information
SaschaWillems committed Dec 16, 2023
1 parent 37a0069 commit 8cdd571
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 1 deletion.
20 changes: 20 additions & 0 deletions VulkanDeviceInfoExtensions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,26 @@ void VulkanDeviceInfoExtensions::readPhysicalProperties_KHR() {
vulkanContext.vkGetPhysicalDeviceProperties2KHR(device, &deviceProps2);
pushProperty2(extension, "cooperativeMatrixSupportedStages", QVariant(extProps->cooperativeMatrixSupportedStages));
delete extProps;
// @todo: work-in-progress
auto vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR = reinterpret_cast<PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR>(vkGetInstanceProcAddr(vulkanContext.instance, "vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR"));
uint32_t count{ 0 };
vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR(device, &count, nullptr);
std::vector<VkCooperativeMatrixPropertiesKHR> props(count);
vkGetPhysicalDeviceCooperativeMatrixPropertiesKHR(device, &count, props.data());
QVariantList qvl{};
for (auto& prop : props) {
QVariantMap qvm{};
qvm["MSize"] = prop.MSize;
qvm["NSize"] = prop.NSize;
qvm["KSize"] = prop.KSize;
qvm["AType"] = prop.AType;
qvm["BType"] = prop.BType;
qvm["CType"] = prop.CType;
qvm["saturatingAccumulation"] = prop.saturatingAccumulation;
qvm["scope"] = prop.scope;
qvl.push_back(qvm);
}
pushProperty2(extension, "cooperativeMatrixProperties", qvl);
}
if (extensionSupported("VK_KHR_vertex_attribute_divisor")) {
const char* extension("VK_KHR_vertex_attribute_divisor");
Expand Down
30 changes: 29 additions & 1 deletion vulkancapsviewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1161,6 +1161,13 @@ void addPropertiesRow(QStandardItem* parent, const QVariantMap::const_iterator&
parent->appendRow(item);
}

void addCaptionedRow(QStandardItem* parent, QString caption, QString value) {
QList<QStandardItem*> item;
item << new QStandardItem(caption);
item << new QStandardItem(value);
parent->appendRow(item);
}

void addExtensionPropertiesRow(QList<QStandardItem*> item, Property2 property)
{
QList<QStandardItem*> propertyItem;
Expand All @@ -1180,6 +1187,7 @@ void addExtensionPropertiesRow(QList<QStandardItem*> item, Property2 property)
}

if (property.value.canConvert(QVariant::List)) {
bool displayRawValue{ true };
if ((strcmp(property.extension, VK_EXT_HOST_IMAGE_COPY_EXTENSION_NAME) == 0) && ((property.name == "pCopySrcLayouts") || (property.name == "pCopyDstLayouts"))) {
QList<QVariant> list = property.value.toList();
for (auto i = 0; i < list.size(); i++) {
Expand All @@ -1188,7 +1196,27 @@ void addExtensionPropertiesRow(QList<QStandardItem*> item, Property2 property)
propertyItem.first()->appendRow(formatItem);
}
}
propertyItem << new QStandardItem(arrayToStr(property.value));
if ((strcmp(property.extension, VK_KHR_COOPERATIVE_MATRIX_EXTENSION_NAME) == 0) && (property.name == "cooperativeMatrixProperties")) {
QList<QVariant> list = property.value.toList();
for (auto i = 0; i < list.size(); i++) {
QStandardItem* entryItem = new QStandardItem();
QVariantMap value = list[i].toMap();
entryItem->setText("[" + QString::number(i) + "]");
addCaptionedRow(entryItem, "MSize", value["MSize"].toString());
addCaptionedRow(entryItem, "NSize", value["NSize"].toString());
addCaptionedRow(entryItem, "KSize", value["KSize"].toString());
addCaptionedRow(entryItem, "AType", vulkanResources::VkComponentTypeKHRString((VkComponentTypeKHR)value["AType"].toInt()));
addCaptionedRow(entryItem, "BType", vulkanResources::VkComponentTypeKHRString((VkComponentTypeKHR)value["BType"].toInt()));
addCaptionedRow(entryItem, "CType", vulkanResources::VkComponentTypeKHRString((VkComponentTypeKHR)value["CType"].toInt()));
addCaptionedRow(entryItem, "saturatingAccumulation", value["saturatingAccumulation"].toString()); // @todo: boolean
addCaptionedRow(entryItem, "scope", vulkanResources::VkScopeKHRString((VkScopeKHR)value["scope"].toInt()));
propertyItem.first()->appendRow(entryItem);
}
displayRawValue = false;
}
if (displayRawValue) {
propertyItem << new QStandardItem(arrayToStr(property.value));
}
}
else {
switch (property.value.type()) {
Expand Down
33 changes: 33 additions & 0 deletions vulkanresources.h
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,39 @@ namespace vulkanResources {
};
}

inline QString VkComponentTypeKHRString(const VkComponentTypeKHR value)
{
switch (value) {
#define STR(r) case VK_COMPONENT_TYPE_##r: return #r
STR(FLOAT16_KHR);
STR(FLOAT32_KHR);
STR(FLOAT64_KHR);
STR(SINT8_KHR);
STR(SINT16_KHR);
STR(SINT32_KHR);
STR(SINT64_KHR);
STR(UINT8_KHR);
STR(UINT16_KHR);
STR(UINT32_KHR);
STR(UINT64_KHR);
#undef STR
default: QString::fromStdString("UNKNOWN_ENUM (" + toHexString(value) + ")");
};
}

inline QString VkScopeKHRString(const VkScopeKHR value)
{
switch (value) {
#define STR(r) case VK_SCOPE_##r: return #r
STR(DEVICE_KHR);
STR(WORKGROUP_KHR);
STR(SUBGROUP_KHR);
STR(QUEUE_FAMILY_KHR);
#undef STR
default: QString::fromStdString("UNKNOWN_ENUM (" + toHexString(value) + ")");
};
}

inline std::string joinString(const char separator, const std::vector<std::string>& stringList)
{
std::stringstream ss;
Expand Down

0 comments on commit 8cdd571

Please sign in to comment.