This is an archive of the discontinued LLVM Phabricator instance.

[HLSL] clang codeGen for HLSLNumThreadsAttr
ClosedPublic

Authored by python3kgae on Aug 12 2022, 11:51 AM.

Details

Summary

Translate HLSLNumThreadsAttr into function attribute with name "dx.numthreads" and value format as "x,y,z".

Diff Detail

Event Timeline

python3kgae created this revision.Aug 12 2022, 11:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2022, 11:51 AM
Herald added a subscriber: Anastasia. · View Herald Transcript
python3kgae requested review of this revision.Aug 12 2022, 11:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 12 2022, 11:51 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
beanz added inline comments.Aug 12 2022, 2:21 PM
clang/lib/CodeGen/CGHLSLRuntime.cpp
216

This isn't DirectX-specific, so we should name it hlsl.

Change attribute name to hlsl.numthreads

beanz added inline comments.Aug 19 2022, 8:56 AM
clang/lib/CodeGen/CGHLSLRuntime.cpp
221

You can replace this whole chunk of code with:

std::string NumThreadsStr = llvm::formatv("{0},{1},{2}", NumThreadsAttr->getX(), NumThreadsAttr->getY(), NumThreadsAttr->getZ()).str();
python3kgae marked 2 inline comments as done.

Use llvm::formatv.

Fix build error and merge conflict.

beanz accepted this revision.Sep 22 2022, 2:37 PM

LGTM

This revision is now accepted and ready to land.Sep 22 2022, 2:37 PM
This revision was automatically updated to reflect the committed changes.