Skip to content

Commit 1339847

Browse files
committed
fix ubatch, autoselect vulkan dgpu if possible
1 parent c9c050f commit 1339847

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

gpttype_adapter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,6 +1053,7 @@ ModelLoadResult gpttype_load_model(const load_model_inputs inputs, FileFormat in
10531053
#endif
10541054

10551055
llama_ctx_params.n_batch = kcpp_params->n_batch;
1056+
llama_ctx_params.n_ubatch = kcpp_params->n_ubatch;
10561057
llama_ctx_params.n_threads = kcpp_params->n_threads;
10571058
llama_ctx_params.n_threads_batch = kcpp_params->n_threads_batch;
10581059

koboldcpp.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1767,6 +1767,7 @@ def hide_tooltip(event):
17671767
CLDevicesNames = ["","","",""]
17681768
CUDevicesNames = ["","","","",""]
17691769
VKDevicesNames = ["","","",""]
1770+
VKIsDGPU = [0,0,0,0]
17701771
MaxMemory = [0]
17711772

17721773
tabcontent = {}
@@ -2005,11 +2006,18 @@ def auto_gpu_heuristics():
20052006
try: # Get Vulkan names
20062007
output = subprocess.run(['vulkaninfo','--summary'], capture_output=True, text=True, check=True, encoding='utf-8').stdout
20072008
devicelist = [line.split("=")[1].strip() for line in output.splitlines() if "deviceName" in line]
2009+
devicetypes = [line.split("=")[1].strip() for line in output.splitlines() if "deviceType" in line]
20082010
idx = 0
20092011
for dname in devicelist:
20102012
if idx<len(VKDevicesNames):
20112013
VKDevicesNames[idx] = dname
20122014
idx += 1
2015+
if len(devicetypes) == len(devicelist):
2016+
idx = 0
2017+
for dvtype in devicetypes:
2018+
if idx<len(VKIsDGPU):
2019+
VKIsDGPU[idx] = (1 if dvtype=="PHYSICAL_DEVICE_TYPE_DISCRETE_GPU" else 0)
2020+
idx += 1
20132021
except Exception as e:
20142022
pass
20152023

@@ -2029,6 +2037,12 @@ def auto_gpu_heuristics():
20292037
runopts_var.set("Use CuBLAS")
20302038
elif "Use hipBLAS (ROCm)" in runopts:
20312039
runopts_var.set("Use hipBLAS (ROCm)")
2040+
elif exitcounter < 100 and (1 in VKIsDGPU) and runmode_untouched and "Use Vulkan" in runopts:
2041+
for i in range(0,len(VKIsDGPU)):
2042+
if VKIsDGPU[i]==1:
2043+
runopts_var.set("Use Vulkan")
2044+
gpu_choice_var.set(str(i+1))
2045+
break
20322046

20332047
changed_gpu_choice_var()
20342048
return

0 commit comments

Comments
 (0)