This is an archive of the discontinued LLVM Phabricator instance.

AMDGPU/R600: Add implicitarg.ptr intrinsic
ClosedPublic

Authored by jvesely on Jun 22 2016, 1:59 PM.

Details

Summary

Provides pointer to implicit kernel arguments (after explicit arguments).
R600 version of D20297

Diff Detail

Repository
rL LLVM

Event Timeline

jvesely updated this revision to Diff 61606.Jun 22 2016, 1:59 PM
jvesely retitled this revision from to RFC: AMDGPU/R600: Add implicitarg.ptr intrinsic.
jvesely updated this object.
jvesely added a reviewer: tstellarAMD.
jvesely set the repository for this revision to rL LLVM.
jvesely added subscribers: llvm-commits, arsenm.

Hi,

this is still an RFC patch, because although it works (passes global_offset piglit with suitably adapted libclc).
It fails with dynamic offsets:

kernel void local_id(volatile global int *out, int j) {
        __attribute__((address_space(7))) uint * ptr =
                __builtin_r600_implicitarg_ptr();
        out[0] = ptr[j];
}

only works if j == 0 (otherwise returns 0 or garbage). Note that changing the last line to

out[0] = ptr[j+1]

works OK.
The generated assembly looks OK:

	ALU 1, @8, KC0[CB0:0-32], KC1[]
	TEX 0 @6
	ALU 1, @10, KC0[CB0:0-32], KC1[]
	MEM_RAT_CACHELESS STORE_RAW T0.X, T1.X, 1
	CF_END
	PAD
	Fetch clause starting at 6:
	VTX_READ_32 T0.X, T0.X, 44
	ALU clause starting at 8:
	  LSHL * T0.X, KC0[2].Z, literal.x,  
	2(2.802597e-45), 0(0.000000e+00)
	ALU clause starting at 10:
	  LSHR * T1.X, KC0[2].Y, literal.x,  
	2(2.802597e-45), 0(0.000000e+00)

is there any interaction between constant and vertex buffer that needs to be handled? (i didn't find anything in the specs) or errata referring to this situation?

jvesely updated this revision to Diff 61614.Jun 22 2016, 2:52 PM

rebase after r273363 (readd isParamLoad() )

The problems with dynamic indexing is caused by using the same ID for constant buffer (AS:8) and vtx fetches (AS:7). switching vtx fetches to use vtxid 3 fixes the problem

jvesely updated this revision to Diff 62534.Jul 1 2016, 1:56 PM
jvesely retitled this revision from RFC: AMDGPU/R600: Add implicitarg.ptr intrinsic to AMDGPU/R600: Add implicitarg.ptr intrinsic.

needs mesa patch.

tstellarAMD accepted this revision.Jul 8 2016, 5:50 PM
tstellarAMD edited edge metadata.

LGTM.

This revision is now accepted and ready to land.Jul 8 2016, 5:50 PM
This revision was automatically updated to reflect the committed changes.
llvm/trunk/test/CodeGen/AMDGPU/r600.work-item-intrinsics.ll