This is an archive of the discontinued LLVM Phabricator instance.

[AMDGPU] Add __builtin_amdgcn_grid_size
ClosedPublic

Authored by JonChesterfield on Oct 27 2020, 10:25 AM.

Details

Summary

[AMDGPU] Add __builtin_amdgcn_grid_size

Similar to D76772, loads the data from the dispatch pointer. Marked invariant.

Patch also updates the openmp devicertl to use this builtin.

Diff Detail

Event Timeline

Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 27 2020, 10:25 AM
JonChesterfield requested review of this revision.Oct 27 2020, 10:25 AM

What's the point of this? The reason for the other case was because there was no other way to attach the range metadata. The invariant load here is redundant since with AMDGPU AA the load from constant will be treated as invariant anyway

JonChesterfield added a comment.EditedOct 27 2020, 10:42 AM

Consistency really. It seemed strange to have a builtin for reading the workgroup size and not one for the grid size.

There's probably a range limit that can be set on this one too, I'm just not sure what it is. Happy to leave the invariant annotation for a pass to insert if preferred.

I think there is value in this change. It may help simplify device library and hide some compiler details.

yaxunl accepted this revision.Oct 28 2020, 6:52 PM

LGTM. Thanks.

This revision is now accepted and ready to land.Oct 28 2020, 6:52 PM
This revision was landed with ongoing or failed builds.Oct 29 2020, 9:25 AM
This revision was automatically updated to reflect the committed changes.