[llvm] 78a73dd - [DirectX backend] PartSize not include PartHeader

Xiang Li via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 9 16:19:30 PST 2023


Author: Xiang Li
Date: 2023-01-09T19:10:21-05:00
New Revision: 78a73dda601279b33691e6fb67047155c2390af6

URL: https://github.com/llvm/llvm-project/commit/78a73dda601279b33691e6fb67047155c2390af6
DIFF: https://github.com/llvm/llvm-project/commit/78a73dda601279b33691e6fb67047155c2390af6.diff

LOG: [DirectX backend] PartSize not include PartHeader

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

Differential Revision: https://reviews.llvm.org/D141207

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCDXContainerWriter.cpp b/llvm/lib/MC/MCDXContainerWriter.cpp
index ddccc100967d4..028bfe6e79a12 100644
--- a/llvm/lib/MC/MCDXContainerWriter.cpp
+++ b/llvm/lib/MC/MCDXContainerWriter.cpp
@@ -104,7 +104,7 @@ uint64_t DXContainerObjectWriter::writeObject(MCAssembler &Asm,
     // 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);

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll b/llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
index 8e69242be771c..26788260475ee 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/DebugShaderHash.ll
@@ -19,7 +19,7 @@ define i32 @add(i32 %a, i32 %b) {
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 
 ; DXC: - Name:            HASH
-; DXC:   Size:            28
+; DXC:   Size:            20
 ; DXC:   Hash:
 ; DXC:     IncludesSource:  true
 ; DXC:     Digest:          [ 

diff  --git a/llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll b/llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
index 327d3557dede5..02008722b8a53 100644
--- a/llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
+++ b/llvm/test/CodeGen/DirectX/ContainerData/ShaderHash.ll
@@ -10,7 +10,7 @@ define i32 @add(i32 %a, i32 %b) {
 }
 
 ; DXC: - Name:            HASH
-; DXC:   Size:            28
+; DXC:   Size:            20
 ; DXC:   Hash:
 ; DXC:     IncludesSource:  false
 ; DXC:     Digest:          [ 

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
index 26487ca2a7115..865fefeac335d 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/double-extensions.ll
@@ -15,7 +15,7 @@ define double @div(double %a, double %b) {
 
 
 ; DXC: - Name:            SFI0
-; DXC-NEXT:     Size:            16
+; DXC-NEXT:     Size:            8
 ; DXC-NEXT:     Flags:
 ; DXC-NEXT:       Doubles:         true
 ; DXC-NOT:   {{[A-Za-z]+: +true}}

diff  --git a/llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll b/llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll
index 95320dd495d49..f90db61661f09 100644
--- a/llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll
+++ b/llvm/test/CodeGen/DirectX/ShaderFlags/doubles.ll
@@ -13,7 +13,7 @@ define double @add(double %a, double %b) {
 }
 
 ; DXC: - Name:            SFI0
-; DXC-NEXT:     Size:            16
+; DXC-NEXT:     Size:            8
 ; DXC-NEXT:     Flags:
 ; DXC-NEXT:       Doubles:         true
 ; DXC-NOT:   {{[A-Za-z]+: +true}}

diff  --git a/llvm/test/CodeGen/DirectX/embed-dxil.ll b/llvm/test/CodeGen/DirectX/embed-dxil.ll
index bea6f60f78562..b9a3e8ccd0719 100644
--- a/llvm/test/CodeGen/DirectX/embed-dxil.ll
+++ b/llvm/test/CodeGen/DirectX/embed-dxil.ll
@@ -42,11 +42,11 @@ define i32 @add(i32 %a, i32 %b) {
 ; 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:


        


More information about the llvm-commits mailing list