Benchmark: Report proper Vega device in json
This commit is contained in:
@@ -401,6 +401,31 @@ def system_info_get(ctx):
|
|||||||
sys.executable = old_executable
|
sys.executable = old_executable
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
def modify_system_info(system_info):
|
||||||
|
compute_units = query_opencl_compute_units()
|
||||||
|
for device in system_info["devices"]:
|
||||||
|
device_type = device["type"]
|
||||||
|
if device_type != "OPENCL":
|
||||||
|
continue
|
||||||
|
index = find_first_device_index(compute_units, device['name'])
|
||||||
|
if index != -1:
|
||||||
|
if device["name"] == "Radeon RX Vega":
|
||||||
|
device["name"] += " " + compute_units[index][1]
|
||||||
|
del compute_units[index]
|
||||||
|
return system_info
|
||||||
|
|
||||||
|
def modify_device_info(device_info):
|
||||||
|
compute_device = bpy.context.scene.compute_device
|
||||||
|
device_type, device_name, compute_units = compute_device.split(":")
|
||||||
|
if device_info["device_type"] == "OPENCL":
|
||||||
|
compute_devices = []
|
||||||
|
for device in device_info["compute_devices"]:
|
||||||
|
if device == "Radeon RX Vega":
|
||||||
|
device += " " + compute_units
|
||||||
|
compute_devices.append(device)
|
||||||
|
device_info["compute_devices"] = compute_devices
|
||||||
|
return device_info
|
||||||
|
|
||||||
def benchmark_thread(ctx):
|
def benchmark_thread(ctx):
|
||||||
global progress_lock, global_result_platform, global_progress_status
|
global progress_lock, global_result_platform, global_progress_status
|
||||||
global global_cancel
|
global global_cancel
|
||||||
@@ -435,8 +460,8 @@ def benchmark_thread(ctx):
|
|||||||
result = convert_result_to_json_dict(ctx, {
|
result = convert_result_to_json_dict(ctx, {
|
||||||
"timestamp": timestamp,
|
"timestamp": timestamp,
|
||||||
"blender_version": system_info.getBlenderVersion(ctx),
|
"blender_version": system_info.getBlenderVersion(ctx),
|
||||||
"system_info": blender_system_info,
|
"system_info": modify_system_info(blender_system_info),
|
||||||
"device_info": blender_device_info,
|
"device_info": modify_device_info(blender_device_info),
|
||||||
"stats": all_stats if all_stats else {}
|
"stats": all_stats if all_stats else {}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -703,7 +728,7 @@ class BENCHMARK_OT_run_base(bpy.types.Operator):
|
|||||||
context.area.tag_redraw()
|
context.area.tag_redraw()
|
||||||
|
|
||||||
compute_device = context.scene.compute_device
|
compute_device = context.scene.compute_device
|
||||||
device_type, device_name = compute_device.split(":")
|
device_type, device_name, compute_units = compute_device.split(":")
|
||||||
|
|
||||||
self.tmpdir = tempfile.TemporaryDirectory(prefix="blender_benchmark_")
|
self.tmpdir = tempfile.TemporaryDirectory(prefix="blender_benchmark_")
|
||||||
|
|
||||||
@@ -872,7 +897,7 @@ def compute_device_list_get(self, context):
|
|||||||
global global_cached_compute_devices
|
global global_cached_compute_devices
|
||||||
if global_cached_compute_devices:
|
if global_cached_compute_devices:
|
||||||
return global_cached_compute_devices
|
return global_cached_compute_devices
|
||||||
compute_devices = [('CPU:', "CPU", "")]
|
compute_devices = [('CPU::', "CPU", "")]
|
||||||
if not global_cached_system_info:
|
if not global_cached_system_info:
|
||||||
ctx = benchmark_context.Context()
|
ctx = benchmark_context.Context()
|
||||||
ctx.blender = blender_executable_get()
|
ctx.blender = blender_executable_get()
|
||||||
@@ -883,14 +908,20 @@ def compute_device_list_get(self, context):
|
|||||||
device_type = device["type"]
|
device_type = device["type"]
|
||||||
if device_type == "CPU":
|
if device_type == "CPU":
|
||||||
continue
|
continue
|
||||||
elif device_type in ("OPENCL", "CUDA"):
|
elif device_type == "OPENCL":
|
||||||
device_name = correct_device_name(device["name"])
|
device_name = correct_device_name(device["name"])
|
||||||
index = find_first_device_index(compute_units, device['name'])
|
index = find_first_device_index(compute_units, device['name'])
|
||||||
|
device_compute_units = ""
|
||||||
if index != -1:
|
if index != -1:
|
||||||
if device["name"] == "Radeon RX Vega":
|
if device["name"] == "Radeon RX Vega":
|
||||||
device_name += " " + compute_units[index][1]
|
device_name += " " + compute_units[index][1]
|
||||||
|
device_compute_units = str(compute_units[index][1])
|
||||||
del compute_units[index]
|
del compute_units[index]
|
||||||
device_id = "{}:{}" . format(device_type, device["name"])
|
device_id = "{}:{}:{}" . format(device_type, device["name"], device_compute_units)
|
||||||
|
compute_devices.append((device_id, device_name, ""))
|
||||||
|
elif device_type == "CUDA":
|
||||||
|
device_name = correct_device_name(device["name"])
|
||||||
|
device_id = "{}:{}:" . format(device_type, device["name"])
|
||||||
compute_devices.append((device_id, device_name, ""))
|
compute_devices.append((device_id, device_name, ""))
|
||||||
global_cached_compute_devices = compute_devices
|
global_cached_compute_devices = compute_devices
|
||||||
return compute_devices
|
return compute_devices
|
||||||
|
Reference in New Issue
Block a user