python3kgae updated this revision to Diff 455954. python3kgae added a comment.
Fix build error and merge conflict. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D131799/new/ https://reviews.llvm.org/D131799 Files: clang/lib/CodeGen/CGHLSLRuntime.cpp clang/test/CodeGenHLSL/entry.hlsl Index: clang/test/CodeGenHLSL/entry.hlsl =================================================================== --- clang/test/CodeGenHLSL/entry.hlsl +++ clang/test/CodeGenHLSL/entry.hlsl @@ -2,9 +2,10 @@ // Make sure not mangle entry. // CHECK:define void @foo() -// Make sure add function attribute. +// Make sure add function attribute and numthreads attribute. +// CHECK:"hlsl.numthreads"="16,8,1" // CHECK:"hlsl.shader"="compute" -[numthreads(1,1,1)] +[numthreads(16,8,1)] void foo() { } Index: clang/lib/CodeGen/CGHLSLRuntime.cpp =================================================================== --- clang/lib/CodeGen/CGHLSLRuntime.cpp +++ clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -19,6 +19,7 @@ #include "llvm/IR/IntrinsicsDirectX.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" +#include "llvm/Support/FormatVariadic.h" using namespace clang; using namespace CodeGen; @@ -98,6 +99,13 @@ const StringRef ShaderAttrKindStr = "hlsl.shader"; Fn->addFnAttr(ShaderAttrKindStr, ShaderAttr->ConvertShaderTypeToStr(ShaderAttr->getType())); + if (HLSLNumThreadsAttr *NumThreadsAttr = FD->getAttr<HLSLNumThreadsAttr>()) { + const StringRef NumThreadsKindStr = "hlsl.numthreads"; + std::string NumThreadsStr = + formatv("{0},{1},{2}", NumThreadsAttr->getX(), NumThreadsAttr->getY(), + NumThreadsAttr->getZ()); + Fn->addFnAttr(NumThreadsKindStr, NumThreadsStr); + } } llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B,
Index: clang/test/CodeGenHLSL/entry.hlsl =================================================================== --- clang/test/CodeGenHLSL/entry.hlsl +++ clang/test/CodeGenHLSL/entry.hlsl @@ -2,9 +2,10 @@ // Make sure not mangle entry. // CHECK:define void @foo() -// Make sure add function attribute. +// Make sure add function attribute and numthreads attribute. +// CHECK:"hlsl.numthreads"="16,8,1" // CHECK:"hlsl.shader"="compute" -[numthreads(1,1,1)] +[numthreads(16,8,1)] void foo() { } Index: clang/lib/CodeGen/CGHLSLRuntime.cpp =================================================================== --- clang/lib/CodeGen/CGHLSLRuntime.cpp +++ clang/lib/CodeGen/CGHLSLRuntime.cpp @@ -19,6 +19,7 @@ #include "llvm/IR/IntrinsicsDirectX.h" #include "llvm/IR/Metadata.h" #include "llvm/IR/Module.h" +#include "llvm/Support/FormatVariadic.h" using namespace clang; using namespace CodeGen; @@ -98,6 +99,13 @@ const StringRef ShaderAttrKindStr = "hlsl.shader"; Fn->addFnAttr(ShaderAttrKindStr, ShaderAttr->ConvertShaderTypeToStr(ShaderAttr->getType())); + if (HLSLNumThreadsAttr *NumThreadsAttr = FD->getAttr<HLSLNumThreadsAttr>()) { + const StringRef NumThreadsKindStr = "hlsl.numthreads"; + std::string NumThreadsStr = + formatv("{0},{1},{2}", NumThreadsAttr->getX(), NumThreadsAttr->getY(), + NumThreadsAttr->getZ()); + Fn->addFnAttr(NumThreadsKindStr, NumThreadsStr); + } } llvm::Value *CGHLSLRuntime::emitInputSemantic(IRBuilder<> &B,
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits