llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[AMDGPU][GFX11] exp should have at least one target

Open dpreobra opened this issue 4 years ago • 5 comments

In contrast with GFX10, GFX11 does not allow en=0, i.e. the following code is not legal:

exp mrt0, off, off, off, off

I prepared an MC patch to check this limitation, but then noticed that codegen has GFX11 tests with en=0, for example, see llvm.amdgcn.exp.ll:

; GCN-LABEL: {{^}}test_export_zeroes_f32:
; GCN: exp mrt0 off, off, off, off{{$}}
; GCN: exp mrt0 off, off, off, off done{{$}}
define amdgpu_kernel void @test_export_zeroes_f32() #0 {

  call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 false, i1 false)
  call void @llvm.amdgcn.exp.f32(i32 0, i32 0, float 0.0, float 0.0, float 0.0, float 0.0, i1 true, i1 false)
  ret void
}

@Sisyph, is this a legal GFX11 code?

dpreobra avatar Jul 14 '22 16:07 dpreobra

@llvm/issue-subscribers-backend-amdgpu

llvmbot avatar Jul 14 '22 16:07 llvmbot

exp mrt0, off, off, off, off

Do you really think this should be rejected by the assembler? What does SP3 do?

jayfoad avatar Jul 15 '22 09:07 jayfoad

I think en=0 is valid for some scenarios (16-bit components?). We also use it en=0 for null exports/early termination from pixel shaders.

perlfu avatar Jul 15 '22 09:07 perlfu

I think en=0 is valid for some scenarios (16-bit components?).

In GFX11 the hardware has stopped even pretending to care whether you are exporting 16- or 32-bit data. All it cares about is how many vgprs-worth of data you are exporting.

jayfoad avatar Jul 15 '22 09:07 jayfoad

Thanks for clarification. I remember that SPG explicitly disabled en=0 at some point. Probably it was a documentation bug. SP3 seems to accept en=0.

dpreobra avatar Jul 15 '22 09:07 dpreobra