Skip to content

Conversation

@bogner
Copy link
Contributor

@bogner bogner commented Nov 10, 2025

In #163587 we attempted to generate a dxc-compatible DataLayout when emitting DXIL, but somehow got it wrong. Update using the DataLayout that dxc emits verbatim.

Fixes #163882

In llvm#163587 we attempted to generate a dxc-compatible DataLayout when emitting
DXIL, but somehow got it wrong. Update using the DataLayout that dxc emits
verbatim.

Fixes llvm#163882
@llvmbot
Copy link
Member

llvmbot commented Nov 10, 2025

@llvm/pr-subscribers-backend-directx

Author: Justin Bogner (bogner)

Changes

In #163587 we attempted to generate a dxc-compatible DataLayout when emitting DXIL, but somehow got it wrong. Update using the DataLayout that dxc emits verbatim.

Fixes #163882


Full diff: https://github.com/llvm/llvm-project/pull/167410.diff

1 Files Affected:

  • (modified) llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp (+2-2)
diff --git a/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp b/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
index 26a8728e1f37c..48a9085820471 100644
--- a/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
+++ b/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp
@@ -1169,8 +1169,8 @@ void DXILBitcodeWriter::writeModuleInfo() {
   // We need to hardcode a triple and datalayout that's compatible with the
   // historical DXIL triple and datalayout from DXC.
   StringRef Triple = "dxil-ms-dx";
-  StringRef DL = "e-m:e-p:32:32-i1:8-i8:8-i16:32-i32:32-i64:64-"
-                 "f16:32-f32:32-f64:64-n8:16:32:64";
+  StringRef DL = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-"
+                 "f16:16-f32:32-f64:64-n8:16:32:64";
   writeStringRecord(Stream, bitc::MODULE_CODE_TRIPLE, Triple, 0 /*TODO*/);
   writeStringRecord(Stream, bitc::MODULE_CODE_DATALAYOUT, DL, 0 /*TODO*/);
 

@bogner bogner enabled auto-merge (squash) November 10, 2025 23:12
@bogner bogner disabled auto-merge November 10, 2025 23:57
@bogner
Copy link
Contributor Author

bogner commented Nov 10, 2025

The bot failures are unrelated to this change.

@bogner bogner merged commit a78f587 into llvm:main Nov 10, 2025
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DirectX] Mismatched data layout causing validation errors about exceeding TGSM storage

4 participants