Skip to contentSkip to conversation

refactor out wave scanning to new function umr_scan_wave_data()

PATCH New Tom St Denis 1 participant 1 message Apr 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 refactor out wave scanning to new function umr_scan_wave_data()

---
 doc/sphinx/source/libwave_status.rst |  28 +++
 src/app/print_waves.c                | 379 +++++++++++++++++------------------
 src/lib/CMakeLists.txt               |   1 +
 src/lib/scan_waves.c                 |  97 +++++++++
 src/umr.h                            |   9 +
 5 files changed, 314 insertions(+), 200 deletions(-)
 create mode 100644 src/lib/scan_waves.c
doc/sphinx/source/libwave_status.rst +28 -0
index 0f58a3c91855..2e16a4ac0cb6 100644
@@ -43,6 +43,34 @@ can be read with the following function:
 This will populate many of the fields of the structure 'umr_wave_status'.  An
 example of reading them can be found in src/app/print_waves.c.
 
+---------------------
+Scanning Halted Waves
+---------------------
+
+If the waves have been halted (say with the function umr_sq_cmd_halt_waves()) then
+a list of halted valid waves can be made with the following function:
+
+
+::
+
+	struct umr_wave_data *umr_scan_wave_data(struct umr_asic *asic)
+
+This will return NULL on error (or no halted waves) or a pointer
+to the following structure:
+
+::
+
+	struct umr_wave_data {
+		uint32_t vgprs[64 * 256], sgprs[1024];
+		int se, sh, cu, simd, wave, have_vgprs;
+		struct umr_wave_status ws;
+		struct umr_wave_thread *threads;
+		struct umr_wave_data *next;
+	};
+
+The list of waves are stored as a linked list terminated by the
+last node having 'next' point to NULL.
+
 ------------
 Reading GPRs
 ------------
src/app/print_waves.c +179 -200

429 lines not on this page · raw message

src/lib/CMakeLists.txt +1 -0
index c028c550fa3e..8d5427d63aae 100644
@@ -21,6 +21,7 @@ add_library(umrcore STATIC
   read_vram.c
   ring_decode.c
   scan_config.c
+  scan_waves.c
   sq_cmd_halt_waves.c
   transfer_soc15.c
   wave_status.c
src/lib/scan_waves.c new file +97 -0

97 lines not on this page · raw message

src/umr.h +9 -0
index 7154db7bb2c3..e99ee965527e 100644
@@ -362,6 +362,14 @@ struct umr_wave_status {
 	} trapsts;
 };
 
+struct umr_wave_data {
+	uint32_t vgprs[64 * 256], sgprs[1024];
+	int se, sh, cu, simd, wave, have_vgprs;
+	struct umr_wave_status ws;
+	struct umr_wave_thread *threads;
+	struct umr_wave_data *next;
+};
+
 struct umr_shaders_pgm {
 	// VMID and length in bytes
 	uint32_t
@@ -561,6 +569,7 @@ int umr_update(struct umr_asic *asic, char *script);
 
 /* lib helpers */
 int umr_get_wave_status(struct umr_asic *asic, unsigned se, unsigned sh, unsigned cu, unsigned simd, unsigned wave, struct umr_wave_status *ws);
+struct umr_wave_data *umr_scan_wave_data(struct umr_asic *asic);
 int umr_get_wave_sq_info(struct umr_asic *asic, unsigned se, unsigned sh, unsigned cu, struct umr_wave_status *ws);
 int umr_read_sgprs(struct umr_asic *asic, struct umr_wave_status *ws, uint32_t *dst);
 int umr_read_vgprs(struct umr_asic *asic, struct umr_wave_status *ws, uint32_t thread, uint32_t *dst);
Signature · 6 lines
2.14.3

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx