This is an archive of the discontinued LLVM Phabricator instance.

[DirectX] add thread/group id DXIL operations.
ClosedPublic

Authored by python3kgae on Jun 16 2022, 10:52 AM.

Details

Summary

Add DXIL operation for thread/group id operations.

ID Name Description
93 ThreadId reads the thread ID
94 GroupId reads the group ID (SV_GroupID)
95 ThreadIdInGroup reads the thread ID within the group (SV_GroupThreadID)
96 FlattenedThreadIdInGroup provides a flattened index for a given thread within a given group (SV_GroupIndex)

Also add llvm intrinsic which map to these intrinsics to DXIL operation.

Diff Detail

Event Timeline

python3kgae created this revision.Jun 16 2022, 10:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2022, 10:52 AM
python3kgae requested review of this revision.Jun 16 2022, 10:52 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 16 2022, 10:52 AM
beanz added inline comments.Jun 16 2022, 10:58 AM
llvm/include/llvm/IR/IntrinsicsDXIL.td
15 ↗(On Diff #437605)

nit: by convention in LLVM intrinsics are generally lower-case _ separated words.

Change intrinsic start with lower case.

python3kgae marked an inline comment as done.Jun 16 2022, 11:12 AM
python3kgae added inline comments.
llvm/include/llvm/IR/IntrinsicsDXIL.td
15 ↗(On Diff #437605)

Fixed.

beanz added inline comments.Jun 16 2022, 11:21 AM
llvm/include/llvm/IR/IntrinsicsDXIL.td
15 ↗(On Diff #437605)

_ separated, not camel case. group_id rather than groupId would be the convention.

python3kgae marked an inline comment as done.

Use _ for the whole name.

python3kgae marked an inline comment as done.Jun 16 2022, 11:53 AM
python3kgae added inline comments.
llvm/include/llvm/IR/IntrinsicsDXIL.td
15 ↗(On Diff #437605)

Fixed.

python3kgae marked an inline comment as done.

Fix test.

nikic resigned from this revision.Jun 17 2022, 6:12 AM

Two small nits. Otherwise, looks good.

llvm/include/llvm/IR/IntrinsicsDXIL.td
1 ↗(On Diff #437671)

We should name this file IntrinsicsDirectX.td not DXIL since it will be all the target intrinsics, and the header should be updated accordingly.

9 ↗(On Diff #437671)

This should be DirectX-specific not R600 :)

Rename IntrinsicsDXIL to IntrinsicsDirectX.

python3kgae marked 2 inline comments as done.Jun 30 2022, 6:43 AM
beanz added a comment.Jul 1 2022, 7:37 AM

I'm pretty sure you need to include IntrinsicsDirectX.h in Function.cpp for this to compile, otherwise this patch looks good to me.

beanz accepted this revision.Jul 1 2022, 7:37 AM
This revision is now accepted and ready to land.Jul 1 2022, 7:37 AM

include IntrinsicsDirectX.h in Function.cpp

I don't know the format, so I just make some random style related comments.

llvm/test/CodeGen/DirectX/comput_ids.ll
9

Ensure @ and ( are present.

13

add a space after :

This revision was landed with ongoing or failed builds.Jul 1 2022, 10:56 AM
This revision was automatically updated to reflect the committed changes.
python3kgae marked 2 inline comments as done.Jul 7 2022, 2:07 PM