[PATCH umr 12/17] server/waves: always report threads (exec)

Nicolai Hähnle nicolai.haehnle at amd.com
Tue Jun 6 09:17:20 UTC 2023


exec is read like the wave status and should be equally reliable or unreliable

Signed-off-by: Nicolai Hähnle <nicolai.haehnle at amd.com>
---
 src/app/gui/commands.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/src/app/gui/commands.c b/src/app/gui/commands.c
index b7b28a7..1e5e854 100644
--- a/src/app/gui/commands.c
+++ b/src/app/gui/commands.c
@@ -1618,20 +1618,28 @@ static void wave_to_json(struct umr_asic *asic, int is_halted, int include_shade
 			json_object_set_number(json_object(hw_id), "pipe_id", wd->ws.hw_id2.pipe_id);
 			json_object_set_number(json_object(hw_id), "me_id", wd->ws.hw_id2.me_id);
 			json_object_set_number(json_object(hw_id), "state_id", wd->ws.hw_id2.state_id);
 			json_object_set_number(json_object(hw_id), "wg_id", wd->ws.hw_id2.wg_id);
 			json_object_set_number(json_object(hw_id), "compat_level", wd->ws.hw_id2.compat_level);
 			json_object_set_number(json_object(hw_id), "vm_id", wd->ws.hw_id2.vm_id);
 			vmid = wd->ws.hw_id2.vm_id;
 		}
 		json_object_set_value(json_object(wave), "hw_id", hw_id);
 
+		JSON_Value *threads = json_value_init_array();
+		int num_threads = wd->num_threads;
+		for (int thread = 0; thread < num_threads; thread++) {
+			unsigned live = thread < 32 ? (wd->ws.exec_lo & (1u << thread))	: (wd->ws.exec_hi & (1u << (thread - 32)));
+			json_array_append_boolean(json_array(threads), live ? 1 : 0);
+		}
+		json_object_set_value(json_object(wave), "threads", threads);
+
 		JSON_Value *gpr_alloc = json_value_init_object();
 		json_object_set_number(json_object(gpr_alloc), "vgpr_base", wd->ws.gpr_alloc.vgpr_base);
 		json_object_set_number(json_object(gpr_alloc), "vgpr_size", wd->ws.gpr_alloc.vgpr_size);
 		json_object_set_number(json_object(gpr_alloc), "sgpr_base", wd->ws.gpr_alloc.sgpr_base);
 		json_object_set_number(json_object(gpr_alloc), "sgpr_size", wd->ws.gpr_alloc.sgpr_size);
 		json_object_set_value(json_object(wave), "gpr_alloc", gpr_alloc);
 
 		if (is_halted && wd->ws.gpr_alloc.value != 0xbebebeef) {
 			int sgpr_count;
 			if (asic->family <= FAMILY_AI) {
@@ -1639,29 +1647,20 @@ static void wave_to_json(struct umr_asic *asic, int is_halted, int include_shade
 				sgpr_count = (wd->ws.gpr_alloc.sgpr_size + 1) << shift;
 			} else {
 				sgpr_count = 108; // regular SGPRs and VCC
 			}
 			JSON_Value *sgpr = json_value_init_array();
 			for (int x = 0; x < sgpr_count; x++) {
 				json_array_append_number(json_array(sgpr), wd->sgprs[x]);
 			}
 			json_object_set_value(json_object(wave), "sgpr", sgpr);
 
-			JSON_Value *threads = json_value_init_array();
-			int num_threads = wd->num_threads;
-			for (int thread = 0; thread < num_threads; thread++) {
-				unsigned live = thread < 32 ? (wd->ws.exec_lo & (1u << thread))	: (wd->ws.exec_hi & (1u << (thread - 32)));
-				json_array_append_boolean(json_array(threads), live ? 1 : 0);
-			}
-			json_object_set_value(json_object(wave), "threads", threads);
-
-
 			if (wd->have_vgprs) {
 				unsigned granularity = asic->parameters.vgpr_granularity;
 				unsigned vpgr_count = (wd->ws.gpr_alloc.vgpr_size + 1) << granularity;
 				JSON_Value *vgpr = json_value_init_array();
 				for (int x = 0; x < (int) vpgr_count; x++) {
 					JSON_Value *v = json_value_init_array();
 					for (int thread = 0; thread < num_threads; thread++) {
 						json_array_append_number(json_array(v), wd->vgprs[thread * 256 + x]);
 					}
 					json_array_append_value(json_array(vgpr), v);
-- 
2.40.0



More information about the amd-gfx mailing list