Skip to contentSkip to conversation

Add program memory dump to wave status.

PATCH In review Tom St Denis 2 participants 2 messages Mar 21, 2017 – Mar 24, 2017 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add program memory dump to wave status.

It will display the leading 4 words up to
the current PC value and then 4 words after.

---
 src/app/print_waves.c | 44 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 33 insertions(+), 11 deletions(-)
src/app/print_waves.c +33 -11
index f0eeeba43a99..e3662983d8d1 100644
@@ -35,7 +35,8 @@
 
 void umr_print_waves(struct umr_asic *asic)
 {
-	uint32_t x, se, sh, cu, simd, wave, sgprs[1024], shift;
+	uint32_t x, se, sh, cu, simd, wave, sgprs[1024], shift, opcodes[8];
+	uint64_t pgm_addr;
 	struct umr_wave_status ws;
 	int first = 1, col = 0;
 
@@ -74,17 +75,24 @@ void umr_print_waves(struct umr_asic *asic)
 (unsigned long)ws.hw_id.value, (unsigned long)ws.gpr_alloc.value, (unsigned long)ws.lds_alloc.value, (unsigned long)ws.trapsts.value, (unsigned long)ws.ib_sts.value,
 (unsigned long)ws.tba_hi, (unsigned long)ws.tba_lo, (unsigned long)ws.tma_hi, (unsigned long)ws.tma_lo, (unsigned long)ws.ib_dbg0, (unsigned long)ws.m0
 );
-					for (x = 0; x < ((ws.gpr_alloc.sgpr_size + 1) << shift); x += 4)
-						printf(">SGPRS[%u..%u] = { %08lx, %08lx, %08lx, %08lx }\n",
-							(unsigned)((ws.gpr_alloc.sgpr_base << shift) + x),
-							(unsigned)((ws.gpr_alloc.sgpr_base << shift) + x + 3),
-							(unsigned long)sgprs[x],
-							(unsigned long)sgprs[x+1],
-							(unsigned long)sgprs[x+2],
-							(unsigned long)sgprs[x+3]);
-					}
+						for (x = 0; x < ((ws.gpr_alloc.sgpr_size + 1) << shift); x += 4)
+							printf(">SGPRS[%u..%u] = { %08lx, %08lx, %08lx, %08lx }\n",
+								(unsigned)((ws.gpr_alloc.sgpr_base << shift) + x),
+								(unsigned)((ws.gpr_alloc.sgpr_base << shift) + x + 3),
+								(unsigned long)sgprs[x],
+								(unsigned long)sgprs[x+1],
+								(unsigned long)sgprs[x+2],
+								(unsigned long)sgprs[x+3]);
 
-					if (options.bitfields) {
+						pgm_addr = (((uint64_t)ws.pc_hi << 32) | ws.pc_lo) - (sizeof(opcodes)/2);
+						umr_read_vram(asic, ws.hw_id.vm_id, pgm_addr, sizeof(opcodes), opcodes);
+						for (x = 0; x < sizeof(opcodes)/4; x++) {
+							printf(">pgm[%lu@%llx] = %08lx\n",
+								(unsigned long)ws.hw_id.vm_id,
+								(unsigned long long)(pgm_addr + 4 * x),
+								(unsigned long)opcodes[x]);
+						}
+					} else {
 						first = 0;
 						printf("\n------------------------------------------------------\nse%u.sh%u.cu%u.simd%u.wave%u\n",
 						(unsigned)se, (unsigned)sh, (unsigned)cu, (unsigned)ws.hw_id.simd_id, (unsigned)ws.hw_id.wave_id);
@@ -156,6 +164,20 @@ void umr_print_waves(struct umr_asic *asic)
 								(unsigned long)sgprs[x+2],
 								(unsigned long)sgprs[x+3]);
 
+						printf("\n\nPGM_MEM:\n");
+						pgm_addr = (((uint64_t)ws.pc_hi << 32) | ws.pc_lo) - (sizeof(opcodes)/2);
+						umr_read_vram(asic, ws.hw_id.vm_id, pgm_addr, sizeof(opcodes), opcodes);
+						for (x = 0; x < sizeof(opcodes)/4; x++) {
+							if (x == (sizeof(opcodes)/8))
+								printf("*\t");
+							else
+								printf("\t");
+							printf("pgm[%lu@%llx] = %08lx\n",
+								(unsigned long)ws.hw_id.vm_id,
+								(unsigned long long)(pgm_addr + 4 * x),
+								(unsigned long)opcodes[x]);
+						}
+
 						Hv("LDS_ALLOC", ws.lds_alloc.value);
 						PP(lds_alloc, lds_base);
 						PP(lds_alloc, lds_size);
Signature · 6 lines
2.12.0

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

A message that is not in the archive (sent off-list or not yet received): [email protected]

Reviewed-by
#2 lore raw
Quoted 69 lines · Tom St Denis

It will display the leading 4 words up to
the current PC value and then 4 words after.

---
 src/app/print_waves.c | 44 +++++++++++++++++++++++++++++++++-----------
 1 file changed, 33 insertions(+), 11 deletions(-)
src/app/print_waves.c +26 -11
index f0eeeba43a99..e3662983d8d1 100644
@@ -35,7 +35,8 @@
 
 void umr_print_waves(struct umr_asic *asic)
 {
-	uint32_t x, se, sh, cu, simd, wave, sgprs[1024], shift;
+	uint32_t x, se, sh, cu, simd, wave, sgprs[1024], shift, opcodes[8];
+	uint64_t pgm_addr;
 	struct umr_wave_status ws;
 	int first = 1, col = 0;
 
@@ -74,17 +75,24 @@ void umr_print_waves(struct umr_asic *asic)
 (unsigned long)ws.hw_id.value, (unsigned long)ws.gpr_alloc.value, (unsigned long)ws.lds_alloc.value, (unsigned long)ws.trapsts.value, (unsigned long)ws.ib_sts.value,
 (unsigned long)ws.tba_hi, (unsigned long)ws.tba_lo, (unsigned long)ws.tma_hi, (unsigned long)ws.tma_lo, (unsigned long)ws.ib_dbg0, (unsigned long)ws.m0
 );
-					for (x = 0; x < ((ws.gpr_alloc.sgpr_size + 1) << shift); x += 4)
-						printf(">SGPRS[%u..%u] = { %08lx, %08lx, %08lx, %08lx }\n",
-							(unsigned)((ws.gpr_alloc.sgpr_base << shift) + x),
-							(unsigned)((ws.gpr_alloc.sgpr_base << shift) + x + 3),
-							(unsigned long)sgprs[x],
-							(unsigned long)sgprs[x+1],
-							(unsigned long)sgprs[x+2],
-							(unsigned long)sgprs[x+3]);
-					}
+						for (x = 0; x < ((ws.gpr_alloc.sgpr_size + 1) << shift); x += 4)
+							printf(">SGPRS[%u..%u] = { %08lx, %08lx, %08lx, %08lx }\n",
+								(unsigned)((ws.gpr_alloc.sgpr_base << shift) + x),
+								(unsigned)((ws.gpr_alloc.sgpr_base << shift) + x + 3),
+								(unsigned long)sgprs[x],
+								(unsigned long)sgprs[x+1],
+								(unsigned long)sgprs[x+2],
+								(unsigned long)sgprs[x+3]);
 
-					if (options.bitfields) {
+						pgm_addr = (((uint64_t)ws.pc_hi << 32) | ws.pc_lo) - (sizeof(opcodes)/2);
+						umr_read_vram(asic, ws.hw_id.vm_id, pgm_addr, sizeof(opcodes), opcodes);
+						for (x = 0; x < sizeof(opcodes)/4; x++) {
+							printf(">pgm[%lu@%llx] = %08lx\n",
+								(unsigned long)ws.hw_id.vm_id,
+								(unsigned long long)(pgm_addr + 4 * x),
+								(unsigned long)opcodes[x]);
+						}
+					} else {
 						first = 0;
 						printf("\n------------------------------------------------------\nse%u.sh%u.cu%u.simd%u.wave%u\n",
 						(unsigned)se, (unsigned)sh, (unsigned)cu, (unsigned)ws.hw_id.simd_id, (unsigned)ws.hw_id.wave_id);
@@ -156,6 +164,20 @@ void umr_print_waves(struct umr_asic *asic)
 								(unsigned long)sgprs[x+2],
 								(unsigned long)sgprs[x+3]);
 
+						printf("\n\nPGM_MEM:\n");
+						pgm_addr = (((uint64_t)ws.pc_hi << 32) | ws.pc_lo) - (sizeof(opcodes)/2);
+						umr_read_vram(asic, ws.hw_id.vm_id, pgm_addr, sizeof(opcodes), opcodes);
+						for (x = 0; x < sizeof(opcodes)/4; x++) {
+							if (x == (sizeof(opcodes)/8))
+								printf("*\t");
+							else

src/app/print_waves.c void umr_print_waves(struct umr_asic *asic) · line 183

Quoted 10 lines
src/app/print_waves.c +7 -0
+								printf("\t");
+							printf("pgm[%lu@%llx] = %08lx\n",
+								(unsigned long)ws.hw_id.vm_id,
+								(unsigned long long)(pgm_addr + 4 * x),
+								(unsigned long)opcodes[x]);
+						}
+
 						Hv("LDS_ALLOC", ws.lds_alloc.value);
 						PP(lds_alloc, lds_base);
 						PP(lds_alloc, lds_size);

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