[llvm] [Transforms][DXIL] Tool to generate resource metadata and annotations (PR #98939)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 15 10:44:29 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 290537238b45106e30bb082b9affde345d8a5482 50ab7111598890ee47fd2fb6c6f54f8ff1711e1f --extensions cpp,h -- llvm/include/llvm/Transforms/Utils/DXILResource.h llvm/lib/Transforms/Utils/DXILResource.cpp llvm/unittests/Transforms/Utils/DXILResourceTest.cpp llvm/include/llvm/Support/DXILABI.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/Transforms/Utils/DXILResource.h b/llvm/include/llvm/Transforms/Utils/DXILResource.h
index e6e6e2d1c3..df01fb4579 100644
--- a/llvm/include/llvm/Transforms/Utils/DXILResource.h
+++ b/llvm/include/llvm/Transforms/Utils/DXILResource.h
@@ -185,8 +185,6 @@ public:
std::pair<uint32_t, uint32_t> getAnnotateProps() const;
};
-
-
} // namespace dxil
} // namespace llvm
diff --git a/llvm/lib/Transforms/Utils/DXILResource.cpp b/llvm/lib/Transforms/Utils/DXILResource.cpp
index 46e6599627..7281c7ad04 100644
--- a/llvm/lib/Transforms/Utils/DXILResource.cpp
+++ b/llvm/lib/Transforms/Utils/DXILResource.cpp
@@ -15,13 +15,9 @@ using namespace dxil;
bool ResourceInfo::isUAV() const { return RC == ResourceClass::UAV; }
-bool ResourceInfo::isCBuffer() const {
- return RC == ResourceClass::CBuffer;
-}
+bool ResourceInfo::isCBuffer() const { return RC == ResourceClass::CBuffer; }
-bool ResourceInfo::isSampler() const {
- return RC == ResourceClass::Sampler;
-}
+bool ResourceInfo::isSampler() const { return RC == ResourceClass::Sampler; }
bool ResourceInfo::isStruct() const {
return Kind == ResourceKind::StructuredBuffer;
@@ -209,9 +205,10 @@ ResourceInfo ResourceInfo::FeedbackTexture2D(Value *Symbol, StringRef Name,
return RI;
}
-ResourceInfo ResourceInfo::FeedbackTexture2DArray(
- Value *Symbol, StringRef Name, ResourceBinding Binding, uint32_t UniqueID,
- SamplerFeedbackType FeedbackTy) {
+ResourceInfo
+ResourceInfo::FeedbackTexture2DArray(Value *Symbol, StringRef Name,
+ ResourceBinding Binding, uint32_t UniqueID,
+ SamplerFeedbackType FeedbackTy) {
ResourceInfo RI(ResourceClass::UAV, ResourceKind::FeedbackTexture2DArray,
Symbol, Name, Binding, UniqueID);
RI.UAVFlags.GloballyCoherent = false;
diff --git a/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp b/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
index ff8bdb2703..d9303ffe68 100644
--- a/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
+++ b/llvm/unittests/Transforms/Utils/DXILResourceTest.cpp
@@ -70,8 +70,7 @@ struct MDBuilder {
// Base case, nothing to do.
}
- template <typename... Ts>
- MDTuple *get(Ts... Data) {
+ template <typename... Ts> MDTuple *get(Ts... Data) {
SmallVector<Metadata *> MDs;
appendMDs(MDs, Data...);
return MDNode::get(Context, MDs);
@@ -96,7 +95,7 @@ testing::AssertionResult MDTupleEq(const char *LHSExpr, const char *RHSExpr,
<< " " << RHSS.str();
}
#define EXPECT_MDEQ(X, Y) EXPECT_PRED_FORMAT2(MDTupleEq, X, Y)
-}
+} // namespace
TEST(DXILResource, AnnotationsAndMetadata) {
LLVMContext Context;
@@ -235,7 +234,6 @@ TEST(DXILResource, AnnotationsAndMetadata) {
EXPECT_MDEQ(MD, TestMD.get(0, Symbol, "ROB", 0, 0, 1, 10, false, false, true,
TestMD.get(0, 9)));
-
// RWStructuredBuffer<ParticleMotion> g_OutputBuffer : register(u2);
StructType *BufType1 = StructType::create(
Context, {Floatx3Ty, FloatTy, Int32Ty}, "ParticleMotion");
@@ -263,8 +261,8 @@ TEST(DXILResource, AnnotationsAndMetadata) {
EXPECT_EQ(Props.first, 0x00001008U);
EXPECT_EQ(Props.second, 0x00080105U);
MD = Resource.getAsMetadata(Context);
- EXPECT_MDEQ(MD, TestMD.get(0, Symbol, "g_rw_t2dmsa", 0, 0, 1, 8, false,
- false, false, TestMD.get(0, 5)));
+ EXPECT_MDEQ(MD, TestMD.get(0, Symbol, "g_rw_t2dmsa", 0, 0, 1, 8, false, false,
+ false, TestMD.get(0, 5)));
// cbuffer cb0 { float4 g_X; float4 g_Y; }
Symbol = UndefValue::get(
@@ -298,6 +296,5 @@ TEST(DXILResource, AnnotationsAndMetadata) {
EXPECT_EQ(Props.first, 0x0000800eU);
EXPECT_EQ(Props.second, 0U);
MD = Resource.getAsMetadata(Context);
- EXPECT_MDEQ(MD,
- TestMD.get(0, Symbol, "CmpSampler", 0, 0, 1, 1, nullptr));
+ EXPECT_MDEQ(MD, TestMD.get(0, Symbol, "CmpSampler", 0, 0, 1, 1, nullptr));
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/98939
More information about the llvm-commits
mailing list