From: "Nicolai Hähnle" <nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Tom St Denis <tom.stdenis-5C7GfCeVMHo@public.gmane.org>,
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH umr 1/4] Fix wave SGPR reading
Date: Mon, 11 Sep 2017 17:17:01 +0200 [thread overview]
Message-ID: <568daa1f-8cae-3c8b-7ea2-d8ffef0573df@gmail.com> (raw)
In-Reply-To: <d0cd7c52-c14d-4d54-81d8-39141ff429b1-5C7GfCeVMHo@public.gmane.org>
On 11.09.2017 15:31, Tom St Denis wrote:
> Hi Nicolai,
>
> I don't get this patch, 'x' starts at 0 and goes to sgpr_size but that
> doesn't include the offset into the SGPR space right?
>
> I mean I get the patch in umr_read_sgprs() but in print_waves() won't
> that mean you're printing out SGPRS[0..size]?
>
> Or are you saying having the base added to the printout is confusing for
> UMD debugging since the shader you're debugging probably doesn't have
> the offsets explicitly stated?
Precisely.
It's not a huge deal, but it's slightly easier to follow along the
register dump and shader disassembly side-by-side when they both use the
same indexing into the register files :)
Cheers,
Nicolai
>
> Cheers,
> Tom
>
> On 09/09/17 06:55 AM, Nicolai Hähnle wrote:
>> From: Nicolai Hähnle <nicolai.haehnle@amd.com>
>>
>> The hardware adds the alloc base already, no need to do it in the tool.
>>
>> Signed-off-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
>> ---
>> src/app/print_waves.c | 8 ++++----
>> src/lib/read_sgpr.c | 5 +++--
>> 2 files changed, 7 insertions(+), 6 deletions(-)
>>
>> diff --git a/src/app/print_waves.c b/src/app/print_waves.c
>> index 1efd8a1..a9aaf39 100644
>> --- a/src/app/print_waves.c
>> +++ b/src/app/print_waves.c
>> @@ -75,22 +75,22 @@ void umr_print_waves(struct umr_asic *asic)
>> "\n",
>> (unsigned)se, (unsigned)sh, (unsigned)cu,
>> (unsigned)ws.hw_id.simd_id, (unsigned)ws.hw_id.wave_id,
>> (unsigned long)ws.wave_status.value, (unsigned long)ws.pc_hi,
>> (unsigned long)ws.pc_lo,
>> (unsigned long)ws.wave_inst_dw0, (unsigned long)ws.wave_inst_dw1,
>> (unsigned long)ws.exec_hi, (unsigned long)ws.exec_lo,
>> (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
>> );
>> if (ws.wave_status.halt)
>> 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)(x),
>> + (unsigned)(x + 3),
>> (unsigned long)sgprs[x],
>> (unsigned long)sgprs[x+1],
>> (unsigned long)sgprs[x+2],
>> (unsigned long)sgprs[x+3]);
>> 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,
>> @@ -156,22 +156,22 @@ void umr_print_waves(struct umr_asic *asic)
>> Hv("GPR_ALLOC", ws.gpr_alloc.value);
>> PP(gpr_alloc, vgpr_base);
>> PP(gpr_alloc, vgpr_size);
>> PP(gpr_alloc, sgpr_base);
>> PP(gpr_alloc, sgpr_size);
>> if (ws.wave_status.halt) {
>> printf("\n\nSGPRS:\n");
>> for (x = 0; x < ((ws.gpr_alloc.sgpr_size
>> + 1) << shift); x += 4)
>> printf("\t[%4u..%4u] = { %08lx,
>> %08lx, %08lx, %08lx }\n",
>> -
>> (unsigned)((ws.gpr_alloc.sgpr_base << shift) + x),
>> -
>> (unsigned)((ws.gpr_alloc.sgpr_base << shift) + x + 3),
>> + (unsigned)(x),
>> + (unsigned)(x + 3),
>> (unsigned long)sgprs[x],
>> (unsigned long)sgprs[x+1],
>> (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++) {
>> diff --git a/src/lib/read_sgpr.c b/src/lib/read_sgpr.c
>> index cceb189..427cfc5 100644
>> --- a/src/lib/read_sgpr.c
>> +++ b/src/lib/read_sgpr.c
>> @@ -56,27 +56,28 @@ int umr_read_sgprs(struct umr_asic *asic, struct
>> umr_wave_status *ws, uint32_t *
>> uint64_t addr, shift;
>> if (asic->family <= FAMILY_CIK)
>> shift = 3; // on SI..CIK allocations were done in 8-dword
>> blocks
>> else
>> shift = 4; // on VI allocations are in 16-dword blocks
>> if (!asic->options.no_kernel) {
>> addr =
>> (1ULL << 60) | // reading SGPRs
>> - ((uint64_t)ws->gpr_alloc.sgpr_base << shift) | //
>> starting address to read from
>> + ((uint64_t)0) | // starting
>> address to read from
>> ((uint64_t)ws->hw_id.se_id << 12) |
>> ((uint64_t)ws->hw_id.sh_id << 20) |
>> ((uint64_t)ws->hw_id.cu_id << 28) |
>> ((uint64_t)ws->hw_id.wave_id << 36) |
>> ((uint64_t)ws->hw_id.simd_id << 44) |
>> (0ULL << 52); // thread_id
>> lseek(asic->fd.gpr, addr, SEEK_SET);
>> return read(asic->fd.gpr, dst, 4 * ((ws->gpr_alloc.sgpr_size
>> + 1) << shift));
>> } else {
>> umr_grbm_select_index(asic, ws->hw_id.se_id,
>> ws->hw_id.sh_id, ws->hw_id.cu_id);
>> - wave_read_regs_via_mmio(asic, ws->hw_id.simd_id,
>> ws->hw_id.wave_id, ws->gpr_alloc.sgpr_base << shift, 0,
>> (ws->gpr_alloc.sgpr_size + 1) << shift, dst);
>> + wave_read_regs_via_mmio(asic, ws->hw_id.simd_id,
>> ws->hw_id.wave_id, 0, 0,
>> + (ws->gpr_alloc.sgpr_size + 1) << shift, dst);
>> umr_grbm_select_index(asic, 0xFFFFFFFF, 0xFFFFFFFF,
>> 0xFFFFFFFF);
>> return 0;
>> }
>> }
>>
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
--
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2017-09-11 15:17 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-09 10:55 [PATCH umr 0/4] gfx9: read VGPRs of halted waves Nicolai Hähnle
[not found] ` <20170909105530.10913-1-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-09 10:55 ` [PATCH umr 1/4] Fix wave SGPR reading Nicolai Hähnle
[not found] ` <20170909105530.10913-2-nhaehnle-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-09-11 13:31 ` Tom St Denis
[not found] ` <d0cd7c52-c14d-4d54-81d8-39141ff429b1-5C7GfCeVMHo@public.gmane.org>
2017-09-11 15:17 ` Nicolai Hähnle [this message]
2017-09-09 10:55 ` [PATCH umr 2/4] Rename lib/read_sgpr.c to lib/read_gpr.c Nicolai Hähnle
2017-09-09 10:55 ` [PATCH umr 3/4] Read VGPRs of halted waves on gfx9 Nicolai Hähnle
2017-09-09 10:55 ` [PATCH umr 4/4] Fix the no-kernel case of wave SGPR reading Nicolai Hähnle
2017-09-09 12:23 ` [PATCH umr 0/4] gfx9: read VGPRs of halted waves Tom St Denis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=568daa1f-8cae-3c8b-7ea2-d8ffef0573df@gmail.com \
--to=nhaehnle-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=tom.stdenis-5C7GfCeVMHo@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox