On Wed, 24 Jan 2018, Tom de Vries wrote:
> Hi,
>
> atm the test-case contained in this patch hangs.
>
> For the test-case we generate:
> ...
> @ %r79 bra $L18;
> {
> call _gfortran_abort;
> trap;
> exit;
> }
> $L18:
> ...
>
> which results in SASS code (at GOMP_NVPTX_JIT=-O4):
> ...
> /*05d8*/ @P0 BRA `(.L_18);
> /*05e8*/ JCAL `(_gfortran_abort);
> /*05f0*/ BPT.TRAP 0x1;
> /*05f8*/ EXIT;
> .L_18:
> ...
> There's no convergence point generated for the diverging branch, so we may end
> up executing random code after .L18 (a problem I long suspected could happen,
> but never observed until now).
>
> The patch adds an exit on the other path, making sure that all threads in the
> warp reach exit, and indeed fixing the hang:
> ...
> @ %r79 bra $L18;
> {
> call _gfortran_abort;
> trap;
> exit;
> }
> $L18:
> exit;
> ...
>
> Build and reg-tested on x86_64 with nvptx accelerator.
>
> I'll commit this shortly for stage4. Strictly speaking, this is not an 8
> regression, but a wrong code bug. But I think that the code generation error
> seems fundamental enough, and the fix simple and localized enough, that it's
> stage4 permissible.
wrong-code bugs qualify for stage4 if a fix isn't too invasive. Target
maintainers have an extra say to override stage4 rules anyway and for
non-primary/secondary targets nobody cares anyway.
Richard.
> Thanks,
> - Tom
>
--
Richard Biener <[email protected]>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB
21284 (AG Nuernberg)