[PATCH] D141207: [DirectX backend] PartSize not include PartHeader

Xiang Li via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jan 7 15:32:50 PST 2023


python3kgae created this revision.
python3kgae added reviewers: beanz, pow2clk, bogner, bob80905.
Herald added a subscriber: hiraditya.
Herald added a project: All.
python3kgae requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

PartSize for a part in dx container is only the size of the content of the part, not include size of the PartHeader.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D141207

Files:
  llvm/lib/MC/MCDXContainerWriter.cpp
  llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
  llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
  llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
  llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll
  llvm/test/CodeGen/DirectX/embed-dxil.ll


Index: llvm/test/CodeGen/DirectX/embed-dxil.ll
===================================================================
--- llvm/test/CodeGen/DirectX/embed-dxil.ll
+++ llvm/test/CodeGen/DirectX/embed-dxil.ll
@@ -42,11 +42,11 @@
 ; DXC-NEXT:       MajorVersion:    6
 ; DXC-NEXT:       MinorVersion:    5
 ; DXC-NEXT:       ShaderKind:      6
-; DXC-NEXT:       Size:            [[#div(SIZE,4) - 2]]
+; DXC-NEXT:       Size:            [[#div(SIZE,4)]]
 ; DXC-NEXT:       DXILMajorVersion: [[#]]
 ; DXC-NEXT:       DXILMinorVersion: [[#]]
-; DXC-NEXT:       DXILSize:        [[#SIZE - 32]]
+; DXC-NEXT:       DXILSize:        [[#SIZE - 24]]
 ; DXC-NEXT:       DXIL:            [ 0x42, 0x43, 0xC0, 0xDE,
 ; DXC:      - Name:            SFI0
-; DXC-NEXT:   Size:            16
+; DXC-NEXT:   Size:            8
 ; DXC-NOT:    Flags:
Index: llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll
===================================================================
--- llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll
+++ llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll
@@ -13,7 +13,7 @@
 }
 
 ; DXC: - Name:            SFI0
-; DXC-NEXT:     Size:            16
+; DXC-NEXT:     Size:            8
 ; DXC-NEXT:     Flags:
 ; DXC-NEXT:       Doubles:         true
 ; DXC-NOT:   {{[A-Za-z]+: +true}}
Index: llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
===================================================================
--- llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
+++ llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
@@ -15,7 +15,7 @@
 
 
 ; DXC: - Name:            SFI0
-; DXC-NEXT:     Size:            16
+; DXC-NEXT:     Size:            8
 ; DXC-NEXT:     Flags:
 ; DXC-NEXT:       Doubles:         true
 ; DXC-NOT:   {{[A-Za-z]+: +true}}
Index: llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
===================================================================
--- llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
+++ llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
@@ -10,7 +10,7 @@
 }
 
 ; DXC: - Name:            HASH
-; DXC:   Size:            28
+; DXC:   Size:            20
 ; DXC:   Hash:
 ; DXC:     IncludesSource:  false
 ; DXC:     Digest:          [ 
Index: llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
===================================================================
--- llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
+++ llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
@@ -19,7 +19,7 @@
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 
 ; DXC: - Name:            HASH
-; DXC:   Size:            28
+; DXC:   Size:            20
 ; DXC:   Hash:
 ; DXC:     IncludesSource:  true
 ; DXC:     Digest:          [ 
Index: llvm/lib/MC/MCDXContainerWriter.cpp
===================================================================
--- llvm/lib/MC/MCDXContainerWriter.cpp
+++ llvm/lib/MC/MCDXContainerWriter.cpp
@@ -104,7 +104,7 @@
     // Write section header.
     W.write<char>(ArrayRef<char>(Sec.getName().data(), 4));
 
-    uint64_t PartSize = SectionSize + sizeof(dxbc::PartHeader);
+    uint64_t PartSize = SectionSize;
 
     if (Sec.getName() == "DXIL")
       PartSize += sizeof(dxbc::ProgramHeader);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141207.487126.patch
Type: text/x-patch
Size: 3203 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230107/386948b3/attachment.bin>


More information about the llvm-commits mailing list