fix ubatch, autoselect vulkan dgpu if possible

This commit is contained in:
Concedo 2024-06-22 00:23:46 +08:00
parent c9c050f323
commit 13398477a1
2 changed files with 15 additions and 0 deletions

View file

@ -1767,6 +1767,7 @@ def show_new_gui():
CLDevicesNames = ["","","",""]
CUDevicesNames = ["","","","",""]
VKDevicesNames = ["","","",""]
VKIsDGPU = [0,0,0,0]
MaxMemory = [0]
tabcontent = {}
@ -2005,11 +2006,18 @@ def show_new_gui():
try: # Get Vulkan names
output = subprocess.run(['vulkaninfo','--summary'], capture_output=True, text=True, check=True, encoding='utf-8').stdout
devicelist = [line.split("=")[1].strip() for line in output.splitlines() if "deviceName" in line]
devicetypes = [line.split("=")[1].strip() for line in output.splitlines() if "deviceType" in line]
idx = 0
for dname in devicelist:
if idx<len(VKDevicesNames):
VKDevicesNames[idx] = dname
idx += 1
if len(devicetypes) == len(devicelist):
idx = 0
for dvtype in devicetypes:
if idx<len(VKIsDGPU):
VKIsDGPU[idx] = (1 if dvtype=="PHYSICAL_DEVICE_TYPE_DISCRETE_GPU" else 0)
idx += 1
except Exception as e:
pass
@ -2029,6 +2037,12 @@ def show_new_gui():
runopts_var.set("Use CuBLAS")
elif "Use hipBLAS (ROCm)" in runopts:
runopts_var.set("Use hipBLAS (ROCm)")
elif exitcounter < 100 and (1 in VKIsDGPU) and runmode_untouched and "Use Vulkan" in runopts:
for i in range(0,len(VKIsDGPU)):
if VKIsDGPU[i]==1:
runopts_var.set("Use Vulkan")
gpu_choice_var.set(str(i+1))
break
changed_gpu_choice_var()
return