Compare commits

...
Author SHA1 Message Date
YXC0915 730a1db383 fix: respect runtime Vulkan shaderInt64 compatibility 2026-12-03 06:35:04 +08:00
23 changed files with 325 additions and 54 deletions

No files matched your search

+7
View File
@@ -0,0 +1,7 @@
{
"group": "fixes",
"order": 0,
"authors": ["yxc0915"],
"zh": "根据当前运行时判断缺少 Vulkan `shaderInt64` 的显卡是否可用。兼容模式可用时允许选择该显卡,并优先推荐原生支持的显卡。",
"en": "Check GPUs without Vulkan `shaderInt64` against the active runtime. Allow them when the runtime supports Vulkan compatibility mode, and prefer GPUs with native support."
}
+4
View File
@@ -48,10 +48,12 @@ export const coreZh: Record<string, string> = {
"footerRunningVMs": "{n, plural, other {# 台运行中}}",
"forceStop": "硬关机",
"gpuErrMissingExt": "缺少必需 Vulkan 扩展({ext}),请更新显卡驱动或改用 VMware SVGA",
"gpuErrMissingShaderInt64": "当前运行时需要显卡驱动支持 shaderInt64。可切换运行时或改用 VMware SVGA",
"gpuErrVulkanCpu": "软件 Vulkan 实现不满足 vGPU 加速要求,请改用 VMware SVGA",
"gpuErrVulkanTooOld": "Vulkan {ver} 低于 1.3 最低要求,请更新显卡驱动或改用 VMware SVGA",
"gpuWarnAmdLegacy": "AMD Vega/Polaris 在 Windows 闭源驱动下存在上游已知黑屏/设备丢失问题({ref});若有其他独显请改选独显,否则建议暂用 VMware SVGA",
"gpuWarnAmdRdna2": "该 AMD 显卡在 Windows 下存在上游已知设备丢失风险({ref});若卡死黑屏请升级驱动或暂用 VMware SVGA",
"gpuWarnShaderInt64Fallback": "此显卡使用当前运行时的 Vulkan 兼容模式",
"guestKbdPinyin": "拼音键盘",
"guestKbdUS": "美式键盘",
"guestKbdUSRecommended": "美式键盘,推荐",
@@ -242,10 +244,12 @@ export const coreEn: Record<string, string> = {
"footerRunningVMs": "{n, plural, one {# running} other {# running}}",
"forceStop": "Force shut down",
"gpuErrMissingExt": "Missing required Vulkan extensions ({ext}); update GPU drivers or use VMware SVGA",
"gpuErrMissingShaderInt64": "The active runtime requires shaderInt64, which this GPU driver lacks. Switch runtimes or use VMware SVGA",
"gpuErrVulkanCpu": "Software Vulkan implementation cannot accelerate vGPU; use VMware SVGA",
"gpuErrVulkanTooOld": "Vulkan {ver} is below the required 1.3 floor; update GPU drivers or use VMware SVGA",
"gpuWarnAmdLegacy": "AMD Vega/Polaris on Windows hits known upstream black-screen/device-loss issues ({ref}); prefer another discrete GPU or use VMware SVGA for now",
"gpuWarnAmdRdna2": "This AMD GPU hits known Windows device-loss issues upstream ({ref}); update drivers or use VMware SVGA if it freezes",
"gpuWarnShaderInt64Fallback": "This GPU uses the active runtime's Vulkan compatibility mode",
"guestKbdPinyin": "Pinyin",
"guestKbdUS": "US Keyboard",
"guestKbdUSRecommended": "US Keyboard, recommended",
+2
View File
@@ -342,6 +342,7 @@ export type I18nKey =
| "gpuCustomIcd"
| "gpuDiscrete"
| "gpuErrMissingExt"
| "gpuErrMissingShaderInt64"
| "gpuErrVulkanCpu"
| "gpuErrVulkanTooOld"
| "gpuIntegrated"
@@ -356,6 +357,7 @@ export type I18nKey =
| "gpuVirtual"
| "gpuWarnAmdLegacy"
| "gpuWarnAmdRdna2"
| "gpuWarnShaderInt64Fallback"
| "graphicsBackend"
| "graphicsReimsDesc"
| "graphicsReimsShort"
+4
View File
@@ -126,6 +126,10 @@ export function gpuCompatHint(locale: Locale, g?: GPUInfo): string {
return t(locale, 'gpuErrVulkanTooOld', { ver: g.compat_detail || g.vulkan_version || '?' })
case 'vulkan_missing_extensions':
return t(locale, 'gpuErrMissingExt', { ext: g.compat_detail || '' })
case 'vulkan_missing_shader_int64':
return t(locale, 'gpuErrMissingShaderInt64')
case 'vulkan_shader_int64_fallback':
return t(locale, 'gpuWarnShaderInt64Fallback')
case 'vulkan_cpu':
return t(locale, 'gpuErrVulkanCpu')
default:
+1 -1
View File
@@ -751,9 +751,9 @@ func (a *App) GetState() AppState {
rootStatus := a.root
a.mu.Unlock()
rep := host.Inspect(cfgCopy.DataRoot)
runtimes, _ := rt.List(&cfgCopy)
active, _ := rt.ResolveActive(&cfgCopy)
rep := rt.HostReportForRuntime(host.Inspect(cfgCopy.DataRoot), active)
// The poller's list (≤ polledMaxAge old, and invalidated by wakePoll after
// start/stop/delete) instead of another `reims-ctl list` per refresh.
var vms []driver.VMListItem
+1 -1
View File
@@ -142,8 +142,8 @@ func (a *App) ExportDiagnosticsWithDriver(driverID, name string) (string, error)
cfgCopy := *a.cfg
appLogs := append([]string(nil), a.recentLogs...)
a.mu.Unlock()
rep := host.Inspect(cfgCopy.DataRoot)
active, _ := rt.ResolveActive(&cfgCopy)
rep := rt.HostReportForRuntime(host.Inspect(cfgCopy.DataRoot), active)
bundle := diagnosticsBundle{}
label := "host"
pluginKey := ""
+5 -1
View File
@@ -154,8 +154,8 @@ func cmdDoctor(cfg *config.Config, loc i18n.Locale, args []string) error {
if err := fs.Parse(args); err != nil {
return err
}
rep := host.Inspect(cfg.DataRoot)
active, _ := rt.ResolveActive(cfg)
rep := rt.HostReportForRuntime(host.Inspect(cfg.DataRoot), active)
if *asJSON {
payload := map[string]any{
@@ -274,6 +274,10 @@ func formatGPUCompatNote(loc i18n.Locale, g host.GPUInfo) string {
return i18n.T(loc, "doctor.gpu.err.vulkan_too_old", g.CompatDetail)
case "vulkan_missing_extensions":
return i18n.T(loc, "doctor.gpu.err.missing_ext", g.CompatDetail)
case host.GPUCompatCodeMissingShaderInt64:
return i18n.T(loc, "doctor.gpu.err.missing_shader_int64")
case host.GPUCompatCodeShaderInt64Fallback:
return i18n.T(loc, "doctor.gpu.warn.shader_int64_fallback")
case "vulkan_cpu":
return i18n.T(loc, "doctor.gpu.err.vulkan_cpu")
default:
+32 -6
View File
@@ -3,9 +3,15 @@ package host
import (
"fmt"
"regexp"
"slices"
"strings"
)
const (
GPUCompatCodeMissingShaderInt64 = "vulkan_missing_shader_int64"
GPUCompatCodeShaderInt64Fallback = "vulkan_shader_int64_fallback"
)
// RequiredVulkanExtensions mirrors the mandatory device extensions enforced by
// upstream metal2vulkan-runtime (crates/metal2vulkan-runtime/src/floor.rs:36-41).
var RequiredVulkanExtensions = []string{
@@ -18,12 +24,13 @@ var RequiredVulkanExtensions = []string{
// VulkanDeviceProbe holds raw Vulkan physical-device properties queried via
// vulkan-1.dll on Windows.
type VulkanDeviceProbe struct {
Name string
VendorID uint32
DeviceID uint32
DeviceType uint32 // VkPhysicalDeviceType: 1=integrated, 2=discrete, 3=virtual, 4=cpu
APIVersion uint32
Extensions map[string]bool
Name string
VendorID uint32
DeviceID uint32
DeviceType uint32 // VkPhysicalDeviceType: 1=integrated, 2=discrete, 3=virtual, 4=cpu
APIVersion uint32
Extensions map[string]bool
ShaderInt64 *bool // nil when the core features were not queried
}
var (
@@ -175,6 +182,12 @@ func EvaluateGPUCompat(g GPUInfo, probe *VulkanDeviceProbe) GPUInfo {
return g
}
}
if probe.ShaderInt64 != nil && !*probe.ShaderInt64 {
g.Compat = GPUCompatUnsupported
g.CompatCode = GPUCompatCodeMissingShaderInt64
g.CompatDetail = "shaderInt64"
return g
}
}
if isAMDLegacyVegaOrPolaris(g.VendorID, g.DeviceID, g.Name) {
@@ -200,6 +213,19 @@ func EvaluateGPUCompat(g GPUInfo, probe *VulkanDeviceProbe) GPUInfo {
return g
}
// AllowVulkanShaderInt64Fallback regrades adapters for a runtime that can
// emulate shaderInt64, leaving the cached host probe and other checks intact.
func AllowVulkanShaderInt64Fallback(gpus []GPUInfo) []GPUInfo {
adapted := slices.Clone(gpus)
for i := range adapted {
if adapted[i].CompatCode == GPUCompatCodeMissingShaderInt64 {
adapted[i].Compat = GPUCompatWarn
adapted[i].CompatCode = GPUCompatCodeShaderInt64Fallback
}
}
return adapted
}
// MergeRegistryAndVulkanGPUs reconciles Windows display-class registry entries
// with live Vulkan physical devices from vulkan-1.dll, preserving ICD paths and
// driver versions while enriching each GPU with real Vulkan 1.3 capability and
+7 -4
View File
@@ -173,15 +173,18 @@ func isIntegratedIntelArcName(low string) bool {
// PickRecommendedGPU selects the best Vulkan GPU, preferring verified-supported
// discrete GPUs over integrated ones, skipping virtual and unsupported GPUs,
// and falling back to warned GPUs only when no cleaner option exists.
// and using shaderInt64 emulation only when no other candidate is available.
func PickRecommendedGPU(gpus []GPUInfo) *GPUInfo {
compatRank := func(c GPUCompat) int {
switch c {
compatRank := func(g GPUInfo) int {
switch g.Compat {
case GPUCompatSupported, "":
return 0
case GPUCompatUnknown:
return 1
case GPUCompatWarn:
if g.CompatCode == GPUCompatCodeShaderInt64Fallback {
return 3
}
return 2
default: // GPUCompatUnsupported
return 99
@@ -207,7 +210,7 @@ func PickRecommendedGPU(gpus []GPUInfo) *GPUInfo {
if g.VulkanICD == "" && g.VulkanVersion == "" {
continue
}
score := compatRank(g.Compat)*10 + kindRank(g.Kind)
score := compatRank(g)*10 + kindRank(g.Kind)
if score < bestScore {
bestScore = score
bestIdx = i
+36
View File
@@ -167,6 +167,42 @@ func TestGPUCompatibilityGradingAndRecommendation(t *testing.T) {
}
}
func TestGPUCompatibilityRequiresShaderInt64(t *testing.T) {
extensions := make(map[string]bool, len(RequiredVulkanExtensions))
for _, extension := range RequiredVulkanExtensions {
extensions[extension] = true
}
gpu := GPUInfo{Name: "Intel(R) UHD Graphics", Kind: GPUIntegrated}
probe := VulkanDeviceProbe{
VendorID: 0x8086,
DeviceID: 0x8a56,
DeviceType: 1,
APIVersion: (1 << 22) | (3 << 12) | 215,
Extensions: extensions,
ShaderInt64: new(false),
}
rejected := EvaluateGPUCompat(gpu, &probe)
if rejected.Compat != GPUCompatUnsupported || rejected.CompatCode != GPUCompatCodeMissingShaderInt64 || rejected.CompatDetail != "shaderInt64" {
t.Fatalf("missing shaderInt64 should reject a Vulkan 1.3 GPU: %+v", rejected)
}
if got := PickRecommendedGPU([]GPUInfo{rejected}); got != nil {
t.Fatalf("GPU missing shaderInt64 should not be recommended: %+v", got)
}
*probe.ShaderInt64 = true
if got := EvaluateGPUCompat(gpu, &probe); got.Compat != GPUCompatSupported {
t.Fatalf("GPU reporting shaderInt64 should pass: %+v", got)
}
*probe.ShaderInt64 = false
delete(probe.Extensions, "VK_EXT_robustness2")
missingExtension := EvaluateGPUCompat(gpu, &probe)
got := AllowVulkanShaderInt64Fallback([]GPUInfo{missingExtension})[0]
if got.Compat != GPUCompatUnsupported || got.CompatCode != "vulkan_missing_extensions" {
t.Fatalf("shaderInt64 emulation must not bypass other Vulkan requirements: %+v", got)
}
}
func TestAffinityMaskHelpers(t *testing.T) {
if got := AllCPUsMask(8); got != 0xFF {
t.Fatalf("AllCPUsMask(8) = 0x%X, want 0xFF", got)
+9
View File
@@ -22,6 +22,15 @@ func DiagnoseGPULog(output string) (code, detail string) {
continue
}
low := strings.ToLower(line)
// Skipping one adapter is normal when another can satisfy the runtime.
if strings.Contains(low, "not a candidate for the rt platform's device:") {
continue
}
if strings.Contains(low, "mtlcreatesystemdefaultdevice: metal2vulkan-runtime refused it (") &&
strings.Contains(low, "below the runtime's floor") &&
strings.Contains(low, "; refused (rt-refused-no-device)") {
return "gpu_vulkan_floor", line
}
if strings.Contains(line, "VK_ERROR_INCOMPATIBLE_DRIVER") || strings.Contains(low, "no vulkan gpu found") || strings.Contains(low, "meets the floor") || strings.Contains(low, "below the floor") || strings.Contains(low, "no physical device") {
return "gpu_vulkan_floor", line
}
+53
View File
@@ -0,0 +1,53 @@
package host
import (
"strings"
"testing"
)
func TestDiagnoseGPULogRuntimeFloor(t *testing.T) {
const skipped = "reims-vgpu INFO reims_vgpu_vulkan::rt_platform: not a candidate for the rt platform's device: Intel(R) UHD Graphics: the device is below the runtime's floor: it lacks VkPhysicalDeviceFeatures.shaderInt64"
const noCandidate = "reims-vgpu INFO reims_vgpu_vulkan::device_choice: no candidate was listed"
const refusal = "reims-vgpu: MTLCreateSystemDefaultDevice: metal2vulkan-runtime refused it (Intel(R) UHD Graphics: the device is below the runtime's floor: it lacks VkPhysicalDeviceFeatures.shaderInt64); refused (rt-refused-no-device), the first of its kind"
const selected = "reims-vgpu INFO reims_vgpu_vulkan::rt_platform: the rt platform's device: NVIDIA GeForce RTX 4070 Ti (10de:2782), driver NVIDIA 610.88"
const unrelated = "qemu-system-x86_64.exe: Failed to bind socket: Address already in use"
const counter = "reims-vgpu: degradation counts: rt-refused-no-device 1"
tests := []struct {
name string
lines []string
wantCode string
wantDetail string
}{
{
name: "no compatible adapter",
lines: []string{skipped, noCandidate, refusal, counter},
wantCode: "gpu_vulkan_floor",
wantDetail: refusal,
},
{
name: "running with a compatible adapter",
lines: []string{skipped, selected},
},
{
name: "compatible adapter followed by an unrelated failure",
lines: []string{skipped, selected, unrelated},
},
{
name: "older wording for a skipped adapter",
lines: []string{strings.Replace(skipped, "below the runtime's floor", "below the floor", 1), selected, unrelated},
},
{
name: "counter alone",
lines: []string{skipped, counter},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
code, detail := DiagnoseGPULog(strings.Join(tt.lines, "\n"))
if code != tt.wantCode || detail != tt.wantDetail {
t.Fatalf("DiagnoseGPULog = (%q, %q), want (%q, %q)", code, detail, tt.wantCode, tt.wantDetail)
}
})
}
}
+28 -15
View File
@@ -11,13 +11,13 @@ import (
)
const (
vkSuccess = 0
vkIncomplete = 5
vkErrorIncompatibleDriver = -9
vkStructureTypeAppInfo = 0
vkStructureTypeInstCreate = 1
vkAPIVersion10 = (1 << 22)
vkAPIVersion13 = (1 << 22) | (3 << 12)
vkSuccess = 0
vkIncomplete = 5
vkErrorIncompatibleDriver = -9
vkStructureTypeAppInfo = 0
vkStructureTypeInstCreate = 1
vkAPIVersion10 = (1 << 22)
vkAPIVersion13 = (1 << 22) | (3 << 12)
)
// vkApplicationInfo matches VkApplicationInfo on x86-64 Windows (48 bytes).
@@ -49,9 +49,16 @@ type vkExtensionProperties struct {
SpecVersion uint32
}
// VkPhysicalDeviceFeatures contains 55 VkBool32 fields. shaderInt64 is field 41.
type vkPhysicalDeviceFeatures struct {
_ [40]uint32
shaderInt64 uint32
_ [14]uint32
}
// probeVulkanDevices loads vulkan-1.dll and enumerates all visible Vulkan
// physical devices along with their API version, PCI IDs, device type, and
// advertised device extensions. An empty list with no error means enumeration succeeded.
// advertised core features and device extensions. An empty list with no error means enumeration succeeded.
func probeVulkanDevices() ([]VulkanDeviceProbe, error) {
dll := syscall.NewLazyDLL("vulkan-1.dll")
if err := dll.Load(); err != nil {
@@ -61,8 +68,9 @@ func probeVulkanDevices() ([]VulkanDeviceProbe, error) {
pDestroyInst := dll.NewProc("vkDestroyInstance")
pEnumPhys := dll.NewProc("vkEnumeratePhysicalDevices")
pGetProps := dll.NewProc("vkGetPhysicalDeviceProperties")
pGetFeatures := dll.NewProc("vkGetPhysicalDeviceFeatures")
pEnumExts := dll.NewProc("vkEnumerateDeviceExtensionProperties")
for _, proc := range []*syscall.LazyProc{pCreateInst, pDestroyInst, pEnumPhys, pGetProps, pEnumExts} {
for _, proc := range []*syscall.LazyProc{pCreateInst, pDestroyInst, pEnumPhys, pGetProps, pGetFeatures, pEnumExts} {
if err := proc.Find(); err != nil {
return nil, err
}
@@ -133,13 +141,18 @@ func probeVulkanDevices() ([]VulkanDeviceProbe, error) {
var propsBuf [2048]byte
pGetProps.Call(pd, uintptr(unsafe.Pointer(&propsBuf[0])))
var features vkPhysicalDeviceFeatures
pGetFeatures.Call(pd, uintptr(unsafe.Pointer(&features)))
shaderInt64 := features.shaderInt64 != 0
probe := VulkanDeviceProbe{
APIVersion: binary.LittleEndian.Uint32(propsBuf[0:4]),
VendorID: binary.LittleEndian.Uint32(propsBuf[8:12]),
DeviceID: binary.LittleEndian.Uint32(propsBuf[12:16]),
DeviceType: binary.LittleEndian.Uint32(propsBuf[16:20]),
Name: cstrFromBytes(propsBuf[20:276]),
Extensions: probeVulkanDeviceExtensions(pEnumExts, pd),
APIVersion: binary.LittleEndian.Uint32(propsBuf[0:4]),
VendorID: binary.LittleEndian.Uint32(propsBuf[8:12]),
DeviceID: binary.LittleEndian.Uint32(propsBuf[12:16]),
DeviceType: binary.LittleEndian.Uint32(propsBuf[16:20]),
Name: cstrFromBytes(propsBuf[20:276]),
Extensions: probeVulkanDeviceExtensions(pEnumExts, pd),
ShaderInt64: &shaderInt64,
}
out = append(out, probe)
}
+10 -2
View File
@@ -99,6 +99,7 @@ var catalog = map[Locale]map[string]string{
"doctor.gpu.compat.unsupported": "不支持加速",
"doctor.gpu.compat.warn": "已知兼容性风险",
"doctor.gpu.err.missing_ext": "缺少必需 Vulkan 扩展({ext}),请更新显卡驱动或改用 VMware SVGA",
"doctor.gpu.err.missing_shader_int64": "当前运行时需要显卡驱动支持 shaderInt64。可切换运行时或改用 VMware SVGA",
"doctor.gpu.err.vulkan_cpu": "软件渲染 Vulkan 实现不满足 vGPU 硬件加速要求,请改用 VMware SVGA",
"doctor.gpu.err.vulkan_too_old": "Vulkan 版本 {ver} 低于 1.3 最低要求,请更新显卡驱动或改用 VMware SVGA",
"doctor.gpu.none": "未检测到已注册的 Vulkan ICD 显卡驱动",
@@ -106,6 +107,7 @@ var catalog = map[Locale]map[string]string{
"doctor.gpu.recommended": "推荐",
"doctor.gpu.warn.amd_legacy": "AMD Vega/Polaris 在 Windows 闭源驱动下存在上游已知黑屏/设备丢失问题({ref}),建议使用其他独显或在虚拟机设置改用 VMware SVGA",
"doctor.gpu.warn.amd_rdna2": "该 AMD 显卡在 Windows 下存在上游已知设备丢失风险({ref}),若黑屏/卡死请升级驱动或临时改用 VMware SVGA",
"doctor.gpu.warn.shader_int64_fallback": "此显卡使用当前运行时的 Vulkan 兼容模式",
"doctor.os": "操作系统",
"doctor.pcores": "P-Core 性能核",
"doctor.pcores.detail": "{count} 核,掩码 {mask}(CPU {cpus})",
@@ -146,7 +148,7 @@ var catalog = map[Locale]map[string]string{
"err.fullscreen_vmware_svga": "在 {name} 的 QEMU 窗口中按 Ctrl+Alt+F 切换全屏",
"err.gpu_device_lost": "宿主显卡 Vulkan 设备丢失(ERROR_DEVICE_LOST)。请更新显卡驱动;若为 AMD Vega/Polaris 等受影响显卡,请改用其他独显或在设置中将虚拟显卡切为 VMware SVGA",
"err.gpu_icd_stale": "原显卡的 Vulkan ICD 文件已不存在({path})。在设置 → 图形与显示器中重新选择显卡,或选择自动",
"err.gpu_vulkan_floor": "宿主显卡不满足 Reims vGPU 的 Vulkan 1.3 硬件要求。请更新显卡驱动,或在设置中将虚拟显卡切为 VMware SVGA(软件渲染)",
"err.gpu_vulkan_floor": "Reims vGPU 找不到具备所需 Vulkan 功能的显卡。更新显卡驱动,或在虚拟机设置中切换到 VMware SVGA(软件渲染)",
"err.guest_tools_disabled": "Guest Tools 传输服务已在插件页停用,启用后才能使用剪贴板、共享文件夹与防休眠",
"err.macos.disabled": "「macOS 虚拟机支持」插件已停用,请先在插件页启用",
"err.plugin.high_risk_unapproved": "插件「{id}」包含高危权限,需要先确认授权后才能启用",
@@ -209,10 +211,12 @@ var catalog = map[Locale]map[string]string{
"footerRunningVMs": "{n, plural, other {# 台运行中}}",
"forceStop": "硬关机",
"gpuErrMissingExt": "缺少必需 Vulkan 扩展({ext}),请更新显卡驱动或改用 VMware SVGA",
"gpuErrMissingShaderInt64": "当前运行时需要显卡驱动支持 shaderInt64。可切换运行时或改用 VMware SVGA",
"gpuErrVulkanCpu": "软件 Vulkan 实现不满足 vGPU 加速要求,请改用 VMware SVGA",
"gpuErrVulkanTooOld": "Vulkan {ver} 低于 1.3 最低要求,请更新显卡驱动或改用 VMware SVGA",
"gpuWarnAmdLegacy": "AMD Vega/Polaris 在 Windows 闭源驱动下存在上游已知黑屏/设备丢失问题({ref});若有其他独显请改选独显,否则建议暂用 VMware SVGA",
"gpuWarnAmdRdna2": "该 AMD 显卡在 Windows 下存在上游已知设备丢失风险({ref});若卡死黑屏请升级驱动或暂用 VMware SVGA",
"gpuWarnShaderInt64Fallback": "此显卡使用当前运行时的 Vulkan 兼容模式",
"guestKbdPinyin": "拼音键盘",
"guestKbdUS": "美式键盘",
"guestKbdUSRecommended": "美式键盘,推荐",
@@ -759,6 +763,7 @@ var catalog = map[Locale]map[string]string{
"doctor.gpu.compat.unsupported": "Unsupported for vGPU",
"doctor.gpu.compat.warn": "Known compatibility issue",
"doctor.gpu.err.missing_ext": "Missing required Vulkan extensions ({ext}); update your GPU driver or use VMware SVGA",
"doctor.gpu.err.missing_shader_int64": "The active runtime requires shaderInt64, which this GPU driver lacks. Switch runtimes or use VMware SVGA",
"doctor.gpu.err.vulkan_cpu": "Software Vulkan implementation does not meet the vGPU floor; use VMware SVGA instead",
"doctor.gpu.err.vulkan_too_old": "Vulkan {ver} is below the required 1.3 floor; update your GPU driver or use VMware SVGA",
"doctor.gpu.none": "No registered Vulkan ICD driver found",
@@ -766,6 +771,7 @@ var catalog = map[Locale]map[string]string{
"doctor.gpu.recommended": "Recommended",
"doctor.gpu.warn.amd_legacy": "AMD Vega/Polaris on Windows hits known upstream black-screen/device-loss issues ({ref}); prefer another discrete GPU or switch the VM to VMware SVGA",
"doctor.gpu.warn.amd_rdna2": "This AMD GPU hits known Windows device-loss issues upstream ({ref}); update drivers or switch temporarily to VMware SVGA if it freezes",
"doctor.gpu.warn.shader_int64_fallback": "This GPU uses the active runtime's Vulkan compatibility mode",
"doctor.os": "Operating System",
"doctor.pcores": "P-Cores (Performance)",
"doctor.pcores.detail": "{count, plural, one {# core} other {# cores}}, mask {mask} (CPUs {cpus})",
@@ -806,7 +812,7 @@ var catalog = map[Locale]map[string]string{
"err.fullscreen_vmware_svga": "Press Ctrl+Alt+F in the QEMU window for {name} to toggle full screen",
"err.gpu_device_lost": "Host Vulkan GPU device lost (ERROR_DEVICE_LOST). Update GPU drivers; on affected AMD Vega/Polaris GPUs, switch to another discrete GPU or use VMware SVGA in VM Settings",
"err.gpu_icd_stale": "The selected GPU's Vulkan ICD file no longer exists ({path}). In Settings → Graphics & displays, reselect the GPU or choose Automatic",
"err.gpu_vulkan_floor": "Host GPU does not meet Reims vGPU's Vulkan 1.3 requirements. Update GPU drivers or switch graphics to VMware SVGA (software rendering) in VM Settings",
"err.gpu_vulkan_floor": "Reims vGPU could not find a GPU with the required Vulkan capabilities. Update the GPU driver or switch to VMware SVGA (software rendering) in VM Settings",
"err.guest_tools_disabled": "Guest Tools Transport is turned off on the Plugins page; turn it on to use clipboard, shared folders and keep-awake",
"err.macos.disabled": "macOS VM Support is disabled; enable it on the Plugins page first",
"err.plugin.high_risk_unapproved": "Plugin “{id}” requests high-risk permissions and requires confirmation before enabling",
@@ -869,10 +875,12 @@ var catalog = map[Locale]map[string]string{
"footerRunningVMs": "{n, plural, one {# running} other {# running}}",
"forceStop": "Force shut down",
"gpuErrMissingExt": "Missing required Vulkan extensions ({ext}); update GPU drivers or use VMware SVGA",
"gpuErrMissingShaderInt64": "The active runtime requires shaderInt64, which this GPU driver lacks. Switch runtimes or use VMware SVGA",
"gpuErrVulkanCpu": "Software Vulkan implementation cannot accelerate vGPU; use VMware SVGA",
"gpuErrVulkanTooOld": "Vulkan {ver} is below the required 1.3 floor; update GPU drivers or use VMware SVGA",
"gpuWarnAmdLegacy": "AMD Vega/Polaris on Windows hits known upstream black-screen/device-loss issues ({ref}); prefer another discrete GPU or use VMware SVGA for now",
"gpuWarnAmdRdna2": "This AMD GPU hits known Windows device-loss issues upstream ({ref}); update drivers or use VMware SVGA if it freezes",
"gpuWarnShaderInt64Fallback": "This GPU uses the active runtime's Vulkan compatibility mode",
"guestKbdPinyin": "Pinyin",
"guestKbdUS": "US Keyboard",
"guestKbdUSRecommended": "US Keyboard, recommended",
+5 -1
View File
@@ -187,7 +187,11 @@ func (c *Client) reconcileStaleGPUICD(ctx context.Context, name string, stderr i
if onNote == nil && stderr != nil {
onNote = func(msg string) { fmt.Fprintln(stderr, msg) }
}
newPath, _ := ResolveStaleDriverStoreICD(oldPath, probe())
gpus := probe()
if c.shaderInt64Fallback {
gpus = host.AllowVulkanShaderInt64Fallback(gpus)
}
newPath, _ := ResolveStaleDriverStoreICD(oldPath, gpus)
if newPath == "" {
msg := i18n.M(c.Locale, "err.gpu_icd_stale", i18n.Vars{"path": oldPath})
if onNote != nil {
+22 -15
View File
@@ -86,6 +86,9 @@ func TestStartWithCompatStaleGPUICD(t *testing.T) {
const oldPath = "C:/Windows/System32/DriverStore/FileRepository/iigd_dch.inf_amd64_010a7b33a54cb65d/ICD manifests/igvk64.json"
const customPath = "C:/custom/igvk64.JSON"
intel := host.GPUInfo{Kind: host.GPUIntegrated, VulkanICD: newPath, VulkanVersion: "1.4.0", Compat: host.GPUCompatSupported}
missingInt64 := intel
missingInt64.Compat = host.GPUCompatUnsupported
missingInt64.CompatCode = host.GPUCompatCodeMissingShaderInt64
show := "show\t" + name
start := "start\t" + name
set := "set\t" + name + "\t--gpu\t" + newPath
@@ -98,20 +101,21 @@ func TestStartWithCompatStaleGPUICD(t *testing.T) {
}
for _, tc := range []struct {
name string
gpu string
graphics string
state string
statErr error
gpus []host.GPUInfo
fail string
twice bool
useStderr bool
wantCalls []string
wantStats []string
wantProbe int
wantNote string
wantStale bool
name string
gpu string
graphics string
state string
statErr error
gpus []host.GPUInfo
fail string
shaderInt64Fallback bool
twice bool
useStderr bool
wantCalls []string
wantStats []string
wantProbe int
wantNote string
wantStale bool
}{
{name: "existing file", gpu: oldPath, wantCalls: []string{show, start}, wantStats: []string{oldPath}},
{name: "auto", gpu: "automatic: the only GPU", wantCalls: []string{show, start}},
@@ -122,6 +126,8 @@ func TestStartWithCompatStaleGPUICD(t *testing.T) {
{name: "stat permission denied", gpu: oldPath, statErr: os.ErrPermission, wantCalls: []string{show, start}, wantStats: []string{oldPath}},
{name: "rebind once across two starts", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel}, twice: true, wantCalls: []string{show, set, start, show, start}, wantStats: []string{oldPath, newPath}, wantProbe: 1, wantNote: rebound},
{name: "rebind note falls back to stderr", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel}, useStderr: true, wantCalls: []string{show, set, start}, wantStats: []string{oldPath}, wantProbe: 1, wantNote: rebound},
{name: "old runtime refuses rebind without shaderInt64", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{missingInt64}, wantCalls: []string{show}, wantStats: []string{oldPath}, wantProbe: 1, wantNote: stale, wantStale: true},
{name: "compatible runtime rebinds without shaderInt64", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{missingInt64}, shaderInt64Fallback: true, wantCalls: []string{show, set, start}, wantStats: []string{oldPath}, wantProbe: 1, wantNote: rebound},
{name: "ambiguous", gpu: oldPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel, intel}, wantCalls: []string{show}, wantStats: []string{oldPath}, wantProbe: 1, wantNote: stale, wantStale: true},
{name: "no match", gpu: oldPath, statErr: os.ErrNotExist, wantCalls: []string{show}, wantStats: []string{oldPath}, wantProbe: 1, wantNote: stale, wantStale: true},
{name: "missing custom JSON", gpu: customPath, statErr: os.ErrNotExist, gpus: []host.GPUInfo{intel}, useStderr: true, wantCalls: []string{show}, wantStats: []string{customPath}, wantProbe: 1, wantNote: staleCustom, wantStale: true},
@@ -147,7 +153,8 @@ func TestStartWithCompatStaleGPUICD(t *testing.T) {
"REIMS_TEST_CTL_STATE="+cmp.Or(tc.state, "stopped"),
"REIMS_TEST_CTL_FAIL="+tc.fail,
),
Locale: locale,
Locale: locale,
shaderInt64Fallback: tc.shaderInt64Fallback,
statFile: func(path string) (os.FileInfo, error) {
statPaths = append(statPaths, path)
if path == newPath {
+8 -6
View File
@@ -28,16 +28,18 @@ type Client struct {
Env []string
Locale i18n.Locale
imagesDir string
registryDir string
probeGPUs func() []host.GPUInfo
statFile func(string) (os.FileInfo, error)
imagesDir string
registryDir string
shaderInt64Fallback bool
probeGPUs func() []host.GPUInfo
statFile func(string) (os.FileInfo, error)
}
func NewClient(cfg *config.Config, installed rt.Installed) *Client {
c := &Client{
Binary: installed.ReimsCtlPath(),
Env: rt.BuildChildEnv(cfg, installed),
Binary: installed.ReimsCtlPath(),
Env: rt.BuildChildEnv(cfg, installed),
shaderInt64Fallback: installed.Manifest.HasCapability(rt.CapabilityVulkanShaderInt64Fallback),
}
if cfg != nil {
c.Locale = cfg.Locale
+70
View File
@@ -0,0 +1,70 @@
package runtime
import (
"os"
"path/filepath"
"testing"
"github.com/Nwflower/reims-go/internal/config"
"github.com/Nwflower/reims-go/internal/host"
)
func TestHostGPUCompatibilityFollowsActiveRuntime(t *testing.T) {
cfg := &config.Config{DataRoot: t.TempDir()}
for commit, manifest := range map[string]string{
"2df30ff": `{"commit":"2df30ff","capabilities":["display-fixed-mode"]}`,
"candidate": `{"commit":"candidate","capabilities":["vulkan-shader-int64-fallback"]}`,
} {
dir := filepath.Join(cfg.RuntimesDir(), commit)
if err := os.MkdirAll(dir, 0o755); err != nil {
t.Fatal(err)
}
if err := os.WriteFile(filepath.Join(dir, "manifest.json"), []byte(manifest), 0o644); err != nil {
t.Fatal(err)
}
}
iceLake := host.GPUInfo{
Name: "Intel(R) UHD Graphics",
Kind: host.GPUIntegrated,
VendorID: "8086",
DeviceID: "8a56",
DriverVersion: "31.0.101.2145",
VulkanVersion: "1.3.215",
Compat: host.GPUCompatUnsupported,
CompatCode: host.GPUCompatCodeMissingShaderInt64,
}
blocked := host.GPUInfo{
Name: "Missing Vulkan extensions", Kind: host.GPUDiscrete, VulkanVersion: "1.3.215",
Compat: host.GPUCompatUnsupported, CompatCode: "vulkan_missing_extensions",
}
report := host.Report{GPUs: []host.GPUInfo{iceLake, blocked}}
for _, commit := range []string{"2df30ff", "candidate", "2df30ff"} {
cfg.ActiveRuntime = commit
active, err := ResolveActive(cfg)
if err != nil || active.Commit != commit {
t.Fatalf("resolve %s = %+v, %v", commit, active, err)
}
got := HostReportForRuntime(report, active)
if commit == "candidate" {
if got.RecommendedGPU == nil || got.RecommendedGPU.DeviceID != "8a56" ||
got.RecommendedGPU.Compat != host.GPUCompatWarn || got.RecommendedGPU.CompatCode != host.GPUCompatCodeShaderInt64Fallback {
t.Fatalf("candidate runtime should offer Ice Lake: %+v", got)
}
native := host.GPUInfo{
Name: "Native-shaderInt64 GPU with a driver warning", Kind: host.GPUIntegrated,
VulkanVersion: "1.3.215", Compat: host.GPUCompatWarn, CompatCode: "amd_legacy_win_driver",
}
withNative := host.Report{GPUs: []host.GPUInfo{iceLake, native}}
recommended := HostReportForRuntime(withNative, active).RecommendedGPU
if recommended == nil || recommended.Name != native.Name {
t.Fatalf("native GPU should remain preferred: %+v", recommended)
}
} else if got.RecommendedGPU != nil || got.GPUs[0] != iceLake {
t.Fatalf("old runtime should reject Ice Lake: %+v", got)
}
if got.GPUs[1] != blocked || report.GPUs[0] != iceLake {
t.Fatalf("GPU selection changed the unsupported adapter or cached probes: %+v", got.GPUs)
}
}
}
+11
View File
@@ -85,6 +85,17 @@ type Installed struct {
Spec KindSpec `json:"-"`
}
const CapabilityVulkanShaderInt64Fallback = "vulkan-shader-int64-fallback"
// HostReportForRuntime applies GPU support advertised by the selected runtime.
func HostReportForRuntime(report host.Report, active *Installed) host.Report {
if active != nil && active.Manifest.HasCapability(CapabilityVulkanShaderInt64Fallback) {
report.GPUs = host.AllowVulkanShaderInt64Fallback(report.GPUs)
report.RecommendedGPU = host.PickRecommendedGPU(report.GPUs)
}
return report
}
func specForKind(kind string) KindSpec {
spec, _ := NewKindRegistry().Get(kind)
if spec.Kind == "" {
+2
View File
@@ -151,6 +151,8 @@
"gpuWarnAmdRdna2": "This AMD GPU hits known Windows device-loss issues upstream ({ref}); update drivers or use VMware SVGA if it freezes",
"gpuErrVulkanTooOld": "Vulkan {ver} is below the required 1.3 floor; update GPU drivers or use VMware SVGA",
"gpuErrMissingExt": "Missing required Vulkan extensions ({ext}); update GPU drivers or use VMware SVGA",
"gpuErrMissingShaderInt64": "The active runtime requires shaderInt64, which this GPU driver lacks. Switch runtimes or use VMware SVGA",
"gpuWarnShaderInt64Fallback": "This GPU uses the active runtime's Vulkan compatibility mode",
"gpuErrVulkanCpu": "Software Vulkan implementation cannot accelerate vGPU; use VMware SVGA",
"resolution": "Resolution",
"displays": "Displays",
+3 -1
View File
@@ -163,9 +163,11 @@
"ext"
]
},
"doctor.gpu.err.missing_shader_int64": "The active runtime requires shaderInt64, which this GPU driver lacks. Switch runtimes or use VMware SVGA",
"doctor.gpu.warn.shader_int64_fallback": "This GPU uses the active runtime's Vulkan compatibility mode",
"doctor.gpu.err.vulkan_cpu": "Software Vulkan implementation does not meet the vGPU floor; use VMware SVGA instead",
"err.gpu_device_lost": "Host Vulkan GPU device lost (ERROR_DEVICE_LOST). Update GPU drivers; on affected AMD Vega/Polaris GPUs, switch to another discrete GPU or use VMware SVGA in VM Settings",
"err.gpu_vulkan_floor": "Host GPU does not meet Reims vGPU's Vulkan 1.3 requirements. Update GPU drivers or switch graphics to VMware SVGA (software rendering) in VM Settings",
"err.gpu_vulkan_floor": "Reims vGPU could not find a GPU with the required Vulkan capabilities. Update the GPU driver or switch to VMware SVGA (software rendering) in VM Settings",
"compat.gpu_icd_rebound": {
"message": "Updated the GPU Vulkan ICD path from {old} to {new}",
"$params": [
+2
View File
@@ -151,6 +151,8 @@
"gpuWarnAmdRdna2": "该 AMD 显卡在 Windows 下存在上游已知设备丢失风险({ref});若卡死黑屏请升级驱动或暂用 VMware SVGA",
"gpuErrVulkanTooOld": "Vulkan {ver} 低于 1.3 最低要求,请更新显卡驱动或改用 VMware SVGA",
"gpuErrMissingExt": "缺少必需 Vulkan 扩展({ext}),请更新显卡驱动或改用 VMware SVGA",
"gpuErrMissingShaderInt64": "当前运行时需要显卡驱动支持 shaderInt64。可切换运行时或改用 VMware SVGA",
"gpuWarnShaderInt64Fallback": "此显卡使用当前运行时的 Vulkan 兼容模式",
"gpuErrVulkanCpu": "软件 Vulkan 实现不满足 vGPU 加速要求,请改用 VMware SVGA",
"resolution": "分辨率",
"displays": "显示器数量",
+3 -1
View File
@@ -163,9 +163,11 @@
"ext"
]
},
"doctor.gpu.err.missing_shader_int64": "当前运行时需要显卡驱动支持 shaderInt64。可切换运行时或改用 VMware SVGA",
"doctor.gpu.warn.shader_int64_fallback": "此显卡使用当前运行时的 Vulkan 兼容模式",
"doctor.gpu.err.vulkan_cpu": "软件渲染 Vulkan 实现不满足 vGPU 硬件加速要求,请改用 VMware SVGA",
"err.gpu_device_lost": "宿主显卡 Vulkan 设备丢失(ERROR_DEVICE_LOST)。请更新显卡驱动;若为 AMD Vega/Polaris 等受影响显卡,请改用其他独显或在设置中将虚拟显卡切为 VMware SVGA",
"err.gpu_vulkan_floor": "宿主显卡不满足 Reims vGPU 的 Vulkan 1.3 硬件要求。请更新显卡驱动,或在设置中将虚拟显卡切为 VMware SVGA(软件渲染)",
"err.gpu_vulkan_floor": "Reims vGPU 找不到具备所需 Vulkan 功能的显卡。更新显卡驱动,或在虚拟机设置中切换到 VMware SVGA(软件渲染)",
"compat.gpu_icd_rebound": {
"message": "显卡 Vulkan ICD 路径已从 {old} 更新为 {new}",
"$params": [