Commit ab210f92 by Antonio Maiorano

Vulkan: include backend name in deviceName

* Add rr::BackendName() to dynamically return the name of the backend * Set VkPhysicalDeviceProperties::deviceName to include backend name Bug: b/130459196 Change-Id: I028f3607e4eda9de55bc4cec8af78e7b4793160d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/39552 Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarAntonio Maiorano <amaiorano@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent f47a73af
...@@ -1000,6 +1000,11 @@ void createScatter(llvm::Value *base, llvm::Value *val, llvm::Value *offsets, ll ...@@ -1000,6 +1000,11 @@ void createScatter(llvm::Value *base, llvm::Value *val, llvm::Value *offsets, ll
namespace rr { namespace rr {
std::string BackendName()
{
return std::string("LLVM ") + LLVM_VERSION_STRING;
}
const Capabilities Caps = { const Capabilities Caps = {
true, // CoroutinesSupported true, // CoroutinesSupported
}; };
......
...@@ -50,6 +50,8 @@ void FlushDebug(); ...@@ -50,6 +50,8 @@ void FlushDebug();
namespace rr { namespace rr {
std::string BackendName();
struct Capabilities struct Capabilities
{ {
bool CoroutinesSupported; // Support for rr::Coroutine<F> bool CoroutinesSupported; // Support for rr::Coroutine<F>
......
...@@ -170,6 +170,11 @@ static_assert(!subzeroEmitTextAsm, "Compile Subzero with ALLOW_DUMP=1 for subzer ...@@ -170,6 +170,11 @@ static_assert(!subzeroEmitTextAsm, "Compile Subzero with ALLOW_DUMP=1 for subzer
namespace rr { namespace rr {
std::string BackendName()
{
return "Subzero";
}
const Capabilities Caps = { const Capabilities Caps = {
false, // CoroutinesSupported false, // CoroutinesSupported
}; };
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "VkConfig.h" #include "VkConfig.h"
#include "Pipeline/SpirvShader.hpp" // sw::SIMD::Width #include "Pipeline/SpirvShader.hpp" // sw::SIMD::Width
#include "Reactor/Reactor.hpp"
#include <cstring> #include <cstring>
#include <limits> #include <limits>
...@@ -286,18 +287,27 @@ const VkPhysicalDeviceLimits &PhysicalDevice::getLimits() const ...@@ -286,18 +287,27 @@ const VkPhysicalDeviceLimits &PhysicalDevice::getLimits() const
const VkPhysicalDeviceProperties &PhysicalDevice::getProperties() const const VkPhysicalDeviceProperties &PhysicalDevice::getProperties() const
{ {
static const VkPhysicalDeviceProperties properties{ auto getProperties = [&]() -> VkPhysicalDeviceProperties {
VkPhysicalDeviceProperties properties = {
API_VERSION, API_VERSION,
DRIVER_VERSION, DRIVER_VERSION,
VENDOR_ID, VENDOR_ID,
DEVICE_ID, DEVICE_ID,
VK_PHYSICAL_DEVICE_TYPE_CPU, // deviceType VK_PHYSICAL_DEVICE_TYPE_CPU, // deviceType
SWIFTSHADER_DEVICE_NAME, // deviceName "", // deviceName
SWIFTSHADER_UUID, // pipelineCacheUUID SWIFTSHADER_UUID, // pipelineCacheUUID
getLimits(), // limits getLimits(), // limits
{} // sparseProperties {} // sparseProperties
}; };
// Append Reactor JIT backend name and version
snprintf(properties.deviceName, VK_MAX_PHYSICAL_DEVICE_NAME_SIZE,
"%s (%s)", SWIFTSHADER_DEVICE_NAME, rr::BackendName().c_str());
return properties;
};
static const VkPhysicalDeviceProperties properties = getProperties();
return properties; return properties;
} }
......
...@@ -102,7 +102,7 @@ TEST_F(SwiftShaderVulkanTest, Version) ...@@ -102,7 +102,7 @@ TEST_F(SwiftShaderVulkanTest, Version)
EXPECT_EQ(physicalDeviceProperties.deviceID, 0xC0DEU); EXPECT_EQ(physicalDeviceProperties.deviceID, 0xC0DEU);
EXPECT_EQ(physicalDeviceProperties.deviceType, VK_PHYSICAL_DEVICE_TYPE_CPU); EXPECT_EQ(physicalDeviceProperties.deviceType, VK_PHYSICAL_DEVICE_TYPE_CPU);
EXPECT_EQ(strncmp(physicalDeviceProperties.deviceName, "SwiftShader Device", VK_MAX_PHYSICAL_DEVICE_NAME_SIZE), 0); EXPECT_NE(strstr(physicalDeviceProperties.deviceName, "SwiftShader Device"), nullptr);
VkPhysicalDeviceProperties2 physicalDeviceProperties2; VkPhysicalDeviceProperties2 physicalDeviceProperties2;
VkPhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties; VkPhysicalDeviceDriverPropertiesKHR physicalDeviceDriverProperties;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment