This is an archive of the discontinued LLVM Phabricator instance.

[HLSL] CodeGen HLSL Resource annotations
ClosedPublic

Authored by beanz on Jul 18 2022, 8:16 AM.

Details

Summary

HLSL Resource types need special annotations that the backend will use
to build out metadata and resource annotations that are required by
DirectX and Vulkan drivers in order to provide correct data bindings
for shader exeuction.

This patch adds some of the required data for unordered-access-views
(UAV) resource binding into the module flags. This data will evolve
over time to cover all the required use cases, but this should get
things started.

Depends on D130018.

Diff Detail

Event Timeline

beanz created this revision.Jul 18 2022, 8:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 8:16 AM
beanz requested review of this revision.Jul 18 2022, 8:16 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 18 2022, 8:16 AM
beanz updated this revision to Diff 445572.Jul 18 2022, 11:28 AM

Updating based on feedback from @python3kgae provided via chat. Because of the odd nature of DXIL, the DirectX backend needs to filter the module flags, for that reason it is easier to use a named metadata entry which can just be deleted during codegen. This should be fine and have no real impact on other targets.

aaron.ballman added inline comments.Jul 26 2022, 9:50 AM
clang/lib/CodeGen/CGHLSLRuntime.cpp
59
62–66
78

Add an assertion that ResourceMD is always nonnull by this point?

beanz updated this revision to Diff 449014.Aug 1 2022, 7:30 AM

Updates based on PR feedback. Thanks @aaron.ballman!

This revision is now accepted and ready to land.Aug 1 2022, 9:07 AM
This revision was landed with ongoing or failed builds.Aug 1 2022, 9:20 AM
This revision was automatically updated to reflect the committed changes.