[llvm] [DirectX][ObjectYAML] Fix SRCI round-trip tests that use zlib compression (PR #202479)
Vladislav Dzhidzhoev via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 9 04:17:22 PDT 2026
https://github.com/dzhidzhoev updated https://github.com/llvm/llvm-project/pull/202479
>From bcd542232ac8546046078a95bd8c7edcba3a2b30 Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
Date: Tue, 9 Jun 2026 03:21:37 +0200
Subject: [PATCH 1/2] [DirectX][ObjectYAML] Fix SRCI round-trip tests that use
zlib compression
Size of zlib-compressed SRCI part content may vary depending on Zlib
version. Therefore, round-trip obj2yaml/yaml2obj tests for SRCI part of
DXContainer should not rely on Contents section size.
Since part size field is not optional, SRCI part sizes in tests were slightly
increased to adopt to possible Contents section size change. "size field in SRCI header
does not match SRCI part size" check is removed from
"DXContainer::parseSourceInfo()" to allow parsing such DXContainers
(where actual SRCI part size is smaller than allocated part size).
---
llvm/lib/Object/DXContainer.cpp | 5 -----
.../SRCIPart-multi-source-zlib-compute.yaml | 14 ++++++--------
.../SRCIPart-multi-source-zlib.yaml | 18 ++++++------------
.../DXContainer/SRCIPart-zlib-compute.yaml | 14 ++++++--------
.../obj2yaml/DXContainer/SRCIPart-zlib.yaml | 18 ++++++------------
5 files changed, 24 insertions(+), 45 deletions(-)
diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp
index d37eb4833113d..3d5c3c477e892 100644
--- a/llvm/lib/Object/DXContainer.cpp
+++ b/llvm/lib/Object/DXContainer.cpp
@@ -450,11 +450,6 @@ Error DXContainer::parseSourceInfo(StringRef Part) {
return Err;
Current += sizeof(SourceInfo->Parameters);
- if (SourceInfo->Parameters.AlignedSizeInBytes != Part.size())
- return parseFailed(formatv("size field in SRCI header ({0} bytes) does not "
- "match SRCI part size ({1} bytes)",
- SourceInfo->Parameters.AlignedSizeInBytes,
- Part.size()));
if (SourceInfo->Parameters.Flags)
return parseFailed("SRCI header flags must be zero");
if (SourceInfo->Parameters.SectionCount != 3)
diff --git a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib-compute.yaml b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib-compute.yaml
index 5f3f0268b1310..4b695b817045d 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib-compute.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib-compute.yaml
@@ -8,12 +8,10 @@ Header:
Version:
Major: 1
Minor: 0
- FileSize: 292
PartCount: 1
- PartOffsets: [ 36 ]
Parts:
- Name: SRCI
- Size: 244
+ Size: 248
SourceInfo:
Header:
Names:
@@ -40,10 +38,10 @@ Parts:
...
# CHECK: - Name: SRCI
-# CHECK-NEXT: Size: 244
+# CHECK-NEXT: Size: 248
# CHECK-NEXT: SourceInfo:
# CHECK-NEXT: Header:
-# CHECK-NEXT: AlignedSizeInBytes: 244
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: SectionCount: 3
# CHECK-NEXT: Names:
@@ -68,14 +66,14 @@ Parts:
# CHECK-NEXT: FileName: util.hlsl
# CHECK-NEXT: Contents:
# CHECK-NEXT: SectionHeader:
-# CHECK-NEXT: AlignedSizeInBytes: 120
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: Type: SourceContents
# CHECK-NEXT: Header:
-# CHECK-NEXT: AlignedSizeInBytes: 112
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: Type: Zlib
-# CHECK-NEXT: EntriesSizeInBytes: 90
+# CHECK-NEXT: EntriesSizeInBytes:
# CHECK-NEXT: UncompressedEntriesSizeInBytes: 116
# CHECK-NEXT: Count: 2
# CHECK-NEXT: Entries:
diff --git a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml
index 5275689b29938..96b76caa560b8 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml
@@ -8,15 +8,12 @@ Header:
Version:
Major: 1
Minor: 0
- FileSize: 292
PartCount: 1
- PartOffsets: [ 36 ]
Parts:
- Name: SRCI
- Size: 248
+ Size: 252
SourceInfo:
Header:
- AlignedSizeInBytes: 248
Flags: 0
SectionCount: 3
Names:
@@ -41,14 +38,11 @@ Parts:
FileName: util.hlsl
Contents:
SectionHeader:
- AlignedSizeInBytes: 120
Flags: 0
Type: SourceContents
Header:
- AlignedSizeInBytes: 112
Flags: 0
Type: Zlib
- EntriesSizeInBytes: 90
UncompressedEntriesSizeInBytes: 116
Count: 2
Entries:
@@ -77,10 +71,10 @@ Parts:
...
# CHECK: - Name: SRCI
-# CHECK-NEXT: Size: 248
+# CHECK-NEXT: Size: 252
# CHECK-NEXT: SourceInfo:
# CHECK-NEXT: Header:
-# CHECK-NEXT: AlignedSizeInBytes: 248
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: SectionCount: 3
# CHECK-NEXT: Names:
@@ -105,14 +99,14 @@ Parts:
# CHECK-NEXT: FileName: util.hlsl
# CHECK-NEXT: Contents:
# CHECK-NEXT: SectionHeader:
-# CHECK-NEXT: AlignedSizeInBytes: 120
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: Type: SourceContents
# CHECK-NEXT: Header:
-# CHECK-NEXT: AlignedSizeInBytes: 112
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: Type: Zlib
-# CHECK-NEXT: EntriesSizeInBytes: 90
+# CHECK-NEXT: EntriesSizeInBytes:
# CHECK-NEXT: UncompressedEntriesSizeInBytes: 116
# CHECK-NEXT: Count: 2
# CHECK-NEXT: Entries:
diff --git a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml
index 6352db6e96d74..676b80d1eb3cf 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml
@@ -8,12 +8,10 @@ Header:
Version:
Major: 1
Minor: 0
- FileSize: 224
PartCount: 1
- PartOffsets: [ 36 ]
Parts:
- Name: SRCI
- Size: 180
+ Size: 184
SourceInfo:
Header:
Names:
@@ -38,10 +36,10 @@ Parts:
...
# CHECK: - Name: SRCI
-# CHECK-NEXT: Size: 180
+# CHECK-NEXT: Size: 184
# CHECK-NEXT: SourceInfo:
# CHECK-NEXT: Header:
-# CHECK-NEXT: AlignedSizeInBytes: 180
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: SectionCount: 3
# CHECK-NEXT: Names:
@@ -61,14 +59,14 @@ Parts:
# CHECK-NEXT: FileName: fd_zs.hlsl
# CHECK-NEXT: Contents:
# CHECK-NEXT: SectionHeader:
-# CHECK-NEXT: AlignedSizeInBytes: 84
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: Type: SourceContents
# CHECK-NEXT: Header:
-# CHECK-NEXT: AlignedSizeInBytes: 76
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: Type: Zlib
-# CHECK-NEXT: EntriesSizeInBytes: 54
+# CHECK-NEXT: EntriesSizeInBytes:
# CHECK-NEXT: UncompressedEntriesSizeInBytes: 52
# CHECK-NEXT: Count: 1
# CHECK-NEXT: Entries:
diff --git a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml
index dcb18e5b42cad..1345604c713d0 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml
@@ -8,15 +8,12 @@ Header:
Version:
Major: 1
Minor: 0
- FileSize: 224
PartCount: 1
- PartOffsets: [ 36 ]
Parts:
- Name: SRCI
- Size: 180
+ Size: 184
SourceInfo:
Header:
- AlignedSizeInBytes: 180
Flags: 0
SectionCount: 3
Names:
@@ -36,14 +33,11 @@ Parts:
FileName: fd_zs.hlsl
Contents:
SectionHeader:
- AlignedSizeInBytes: 84
Flags: 0
Type: SourceContents
Header:
- AlignedSizeInBytes: 76
Flags: 0
Type: Zlib
- EntriesSizeInBytes: 54
UncompressedEntriesSizeInBytes: 52
Count: 1
Entries:
@@ -68,10 +62,10 @@ Parts:
...
# CHECK: - Name: SRCI
-# CHECK-NEXT: Size: 180
+# CHECK-NEXT: Size: 184
# CHECK-NEXT: SourceInfo:
# CHECK-NEXT: Header:
-# CHECK-NEXT: AlignedSizeInBytes: 180
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: SectionCount: 3
# CHECK-NEXT: Names:
@@ -91,14 +85,14 @@ Parts:
# CHECK-NEXT: FileName: fd_zs.hlsl
# CHECK-NEXT: Contents:
# CHECK-NEXT: SectionHeader:
-# CHECK-NEXT: AlignedSizeInBytes: 84
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: Type: SourceContents
# CHECK-NEXT: Header:
-# CHECK-NEXT: AlignedSizeInBytes: 76
+# CHECK-NEXT: AlignedSizeInBytes:
# CHECK-NEXT: Flags: 0
# CHECK-NEXT: Type: Zlib
-# CHECK-NEXT: EntriesSizeInBytes: 54
+# CHECK-NEXT: EntriesSizeInBytes:
# CHECK-NEXT: UncompressedEntriesSizeInBytes: 52
# CHECK-NEXT: Count: 1
# CHECK-NEXT: Entries:
>From 3783d6b0f74cbc61d0255bbc825134b46a62498c Mon Sep 17 00:00:00 2001
From: Vladislav Dzhidzhoev <vdzhidzhoev at accesssoftek.com>
Date: Tue, 9 Jun 2026 13:16:38 +0200
Subject: [PATCH 2/2] Removed SRCI size checks
---
.../DXContainer/SRCIPart-multi-source-zlib-compute.yaml | 2 +-
.../tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml | 2 +-
llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml | 2 +-
llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib-compute.yaml b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib-compute.yaml
index 4b695b817045d..fcc3ad561ee6a 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib-compute.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib-compute.yaml
@@ -38,7 +38,7 @@ Parts:
...
# CHECK: - Name: SRCI
-# CHECK-NEXT: Size: 248
+# CHECK-NEXT: Size:
# CHECK-NEXT: SourceInfo:
# CHECK-NEXT: Header:
# CHECK-NEXT: AlignedSizeInBytes:
diff --git a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml
index 96b76caa560b8..36a6dc3eb6d52 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-multi-source-zlib.yaml
@@ -71,7 +71,7 @@ Parts:
...
# CHECK: - Name: SRCI
-# CHECK-NEXT: Size: 252
+# CHECK-NEXT: Size:
# CHECK-NEXT: SourceInfo:
# CHECK-NEXT: Header:
# CHECK-NEXT: AlignedSizeInBytes:
diff --git a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml
index 676b80d1eb3cf..3a995fbb2ef46 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib-compute.yaml
@@ -36,7 +36,7 @@ Parts:
...
# CHECK: - Name: SRCI
-# CHECK-NEXT: Size: 184
+# CHECK-NEXT: Size:
# CHECK-NEXT: SourceInfo:
# CHECK-NEXT: Header:
# CHECK-NEXT: AlignedSizeInBytes:
diff --git a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml
index 1345604c713d0..ffde4a304f085 100644
--- a/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml
+++ b/llvm/test/tools/obj2yaml/DXContainer/SRCIPart-zlib.yaml
@@ -62,7 +62,7 @@ Parts:
...
# CHECK: - Name: SRCI
-# CHECK-NEXT: Size: 184
+# CHECK-NEXT: Size:
# CHECK-NEXT: SourceInfo:
# CHECK-NEXT: Header:
# CHECK-NEXT: AlignedSizeInBytes:
More information about the llvm-commits
mailing list