-
Notifications
You must be signed in to change notification settings - Fork 10.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for PSV EntryFunctionName #84409
Add support for PSV EntryFunctionName #84409
Conversation
@llvm/pr-subscribers-backend-directx @llvm/pr-subscribers-llvm-binary-utilities Author: Cooper Partin (coopp) ChangesThis change introduces a version 3 of the PSV data that includes support for the name of the entry function as an offset into StringTable data to a null-terminated utf-8 string. Additional tests were added to ensure that the new value was properly serialized/deserialized from object data. Fixes #80175 Patch is 34.94 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/84409.diff 17 Files Affected:
diff --git a/llvm/include/llvm/BinaryFormat/DXContainer.h b/llvm/include/llvm/BinaryFormat/DXContainer.h
index c3dcd568216b71..9da262a8084add 100644
--- a/llvm/include/llvm/BinaryFormat/DXContainer.h
+++ b/llvm/include/llvm/BinaryFormat/DXContainer.h
@@ -424,6 +424,19 @@ struct ResourceBindInfo : public v0::ResourceBindInfo {
};
} // namespace v2
+
+namespace v3 {
+struct RuntimeInfo : public v2::RuntimeInfo {
+ uint32_t EntryFunctionName;
+
+ void swapBytes() { sys::swapByteOrder(EntryFunctionName); }
+
+ void swapBytes(Triple::EnvironmentType Stage) {
+ v2::RuntimeInfo::swapBytes(Stage);
+ }
+};
+
+} // namespace v3
} // namespace PSV
#define COMPONENT_PRECISION(Val, Enum) Enum = Val,
diff --git a/llvm/include/llvm/MC/DXContainerPSVInfo.h b/llvm/include/llvm/MC/DXContainerPSVInfo.h
index 7d21c18d252f1c..5cd0c5262b552e 100644
--- a/llvm/include/llvm/MC/DXContainerPSVInfo.h
+++ b/llvm/include/llvm/MC/DXContainerPSVInfo.h
@@ -46,7 +46,7 @@ struct PSVSignatureElement {
// RuntimeInfo.
struct PSVRuntimeInfo {
bool IsFinalized = false;
- dxbc::PSV::v2::RuntimeInfo BaseData;
+ dxbc::PSV::v3::RuntimeInfo BaseData;
SmallVector<dxbc::PSV::v2::ResourceBindInfo> Resources;
SmallVector<PSVSignatureElement> InputElements;
SmallVector<PSVSignatureElement> OutputElements;
diff --git a/llvm/include/llvm/Object/DXContainer.h b/llvm/include/llvm/Object/DXContainer.h
index a7f18c79969803..cdf709fd848128 100644
--- a/llvm/include/llvm/Object/DXContainer.h
+++ b/llvm/include/llvm/Object/DXContainer.h
@@ -125,7 +125,8 @@ class PSVRuntimeInfo {
uint32_t Size;
using InfoStruct =
std::variant<std::monostate, dxbc::PSV::v0::RuntimeInfo,
- dxbc::PSV::v1::RuntimeInfo, dxbc::PSV::v2::RuntimeInfo>;
+ dxbc::PSV::v1::RuntimeInfo, dxbc::PSV::v2::RuntimeInfo,
+ dxbc::PSV::v3::RuntimeInfo>;
InfoStruct BasicInfo;
ResourceArray Resources;
StringRef StringTable;
@@ -151,9 +152,11 @@ class PSVRuntimeInfo {
ResourceArray getResources() const { return Resources; }
uint32_t getVersion() const {
- return Size >= sizeof(dxbc::PSV::v2::RuntimeInfo)
- ? 2
- : (Size >= sizeof(dxbc::PSV::v1::RuntimeInfo) ? 1 : 0);
+ return Size >= sizeof(dxbc::PSV::v3::RuntimeInfo)
+ ? 3
+ : (Size >= sizeof(dxbc::PSV::v2::RuntimeInfo) ? 2
+ : (Size >= sizeof(dxbc::PSV::v1::RuntimeInfo)) ? 1
+ : 0);
}
uint32_t getResourceStride() const { return Resources.Stride; }
@@ -161,6 +164,11 @@ class PSVRuntimeInfo {
const InfoStruct &getInfo() const { return BasicInfo; }
template <typename T> const T *getInfoAs() const {
+ if (const auto *P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
+ return static_cast<const T *>(P);
+ if (std::is_same<T, dxbc::PSV::v3::RuntimeInfo>::value)
+ return nullptr;
+
if (const auto *P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
return static_cast<const T *>(P);
if (std::is_same<T, dxbc::PSV::v2::RuntimeInfo>::value)
diff --git a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
index 66a6ac70bbea10..cad2e606d7db45 100644
--- a/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
+++ b/llvm/include/llvm/ObjectYAML/DXContainerYAML.h
@@ -107,7 +107,7 @@ struct PSVInfo {
// the format.
uint32_t Version;
- dxbc::PSV::v2::RuntimeInfo Info;
+ dxbc::PSV::v3::RuntimeInfo Info;
uint32_t ResourceStride;
SmallVector<ResourceBindInfo> Resources;
SmallVector<SignatureElement> SigInputElements;
@@ -127,6 +127,7 @@ struct PSVInfo {
PSVInfo(const dxbc::PSV::v0::RuntimeInfo *P, uint16_t Stage);
PSVInfo(const dxbc::PSV::v1::RuntimeInfo *P);
PSVInfo(const dxbc::PSV::v2::RuntimeInfo *P);
+ PSVInfo(const dxbc::PSV::v3::RuntimeInfo *P);
};
struct SignatureParameter {
diff --git a/llvm/lib/MC/DXContainerPSVInfo.cpp b/llvm/lib/MC/DXContainerPSVInfo.cpp
index 48182fcd31df06..82edf9f4bd6fb9 100644
--- a/llvm/lib/MC/DXContainerPSVInfo.cpp
+++ b/llvm/lib/MC/DXContainerPSVInfo.cpp
@@ -81,9 +81,13 @@ void PSVRuntimeInfo::write(raw_ostream &OS, uint32_t Version) const {
BindingSize = sizeof(dxbc::PSV::v0::ResourceBindInfo);
break;
case 2:
- default:
InfoSize = sizeof(dxbc::PSV::v2::RuntimeInfo);
BindingSize = sizeof(dxbc::PSV::v2::ResourceBindInfo);
+ break;
+ case 3:
+ default:
+ InfoSize = sizeof(dxbc::PSV::v3::RuntimeInfo);
+ BindingSize = sizeof(dxbc::PSV::v2::ResourceBindInfo);
}
// Write the size of the info.
diff --git a/llvm/lib/Object/DXContainer.cpp b/llvm/lib/Object/DXContainer.cpp
index 0401c20b98ec8e..7c6daba163f61e 100644
--- a/llvm/lib/Object/DXContainer.cpp
+++ b/llvm/lib/Object/DXContainer.cpp
@@ -247,7 +247,14 @@ Error DirectX::PSVRuntimeInfo::parse(uint16_t ShaderKind) {
const uint32_t PSVVersion = getVersion();
// Detect the PSVVersion by looking at the size field.
- if (PSVVersion == 2) {
+ if (PSVVersion == 3) {
+ v3::RuntimeInfo Info;
+ if (Error Err = readStruct(PSVInfoData, Current, Info))
+ return Err;
+ if (sys::IsBigEndianHost)
+ Info.swapBytes(ShaderStage);
+ BasicInfo = Info;
+ } else if (PSVVersion == 2) {
v2::RuntimeInfo Info;
if (Error Err = readStruct(PSVInfoData, Current, Info))
return Err;
@@ -425,6 +432,8 @@ Error DirectX::PSVRuntimeInfo::parse(uint16_t ShaderKind) {
}
uint8_t DirectX::PSVRuntimeInfo::getSigInputCount() const {
+ if (const auto *P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
+ return P->SigInputElements;
if (const auto *P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
return P->SigInputElements;
if (const auto *P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
@@ -433,6 +442,8 @@ uint8_t DirectX::PSVRuntimeInfo::getSigInputCount() const {
}
uint8_t DirectX::PSVRuntimeInfo::getSigOutputCount() const {
+ if (const auto *P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
+ return P->SigOutputElements;
if (const auto *P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
return P->SigOutputElements;
if (const auto *P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
@@ -441,6 +452,8 @@ uint8_t DirectX::PSVRuntimeInfo::getSigOutputCount() const {
}
uint8_t DirectX::PSVRuntimeInfo::getSigPatchOrPrimCount() const {
+ if (const auto *P = std::get_if<dxbc::PSV::v3::RuntimeInfo>(&BasicInfo))
+ return P->SigPatchOrPrimElements;
if (const auto *P = std::get_if<dxbc::PSV::v2::RuntimeInfo>(&BasicInfo))
return P->SigPatchOrPrimElements;
if (const auto *P = std::get_if<dxbc::PSV::v1::RuntimeInfo>(&BasicInfo))
diff --git a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
index 09a5e41c71234f..da2cdd7cac8800 100644
--- a/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerEmitter.cpp
@@ -198,7 +198,7 @@ void DXContainerWriter::writeParts(raw_ostream &OS) {
if (!P.Info.has_value())
continue;
mcdxbc::PSVRuntimeInfo PSV;
- memcpy(&PSV.BaseData, &P.Info->Info, sizeof(dxbc::PSV::v2::RuntimeInfo));
+ memcpy(&PSV.BaseData, &P.Info->Info, sizeof(dxbc::PSV::v3::RuntimeInfo));
PSV.Resources = P.Info->Resources;
for (auto El : P.Info->SigInputElements)
diff --git a/llvm/lib/ObjectYAML/DXContainerYAML.cpp b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
index 1f03f2c7d39966..9b623c00af2668 100644
--- a/llvm/lib/ObjectYAML/DXContainerYAML.cpp
+++ b/llvm/lib/ObjectYAML/DXContainerYAML.cpp
@@ -74,6 +74,12 @@ DXContainerYAML::PSVInfo::PSVInfo(const dxbc::PSV::v2::RuntimeInfo *P)
memcpy(&Info, P, sizeof(dxbc::PSV::v2::RuntimeInfo));
}
+DXContainerYAML::PSVInfo::PSVInfo(const dxbc::PSV::v3::RuntimeInfo *P)
+ : Version(3) {
+ memset(&Info, 0, sizeof(Info));
+ memcpy(&Info, P, sizeof(dxbc::PSV::v3::RuntimeInfo));
+}
+
namespace yaml {
void MappingTraits<DXContainerYAML::VersionTuple>::mapping(
@@ -347,6 +353,11 @@ void DXContainerYAML::PSVInfo::mapInfoForVersion(yaml::IO &IO) {
IO.mapRequired("NumThreadsX", Info.NumThreadsX);
IO.mapRequired("NumThreadsY", Info.NumThreadsY);
IO.mapRequired("NumThreadsZ", Info.NumThreadsZ);
+
+ if (Version == 2)
+ return;
+
+ IO.mapRequired("EntryFunctionName", Info.EntryFunctionName);
}
} // namespace llvm
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-amplification.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-amplification.yaml
new file mode 100644
index 00000000000000..92ceac5b52ffae
--- /dev/null
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-amplification.yaml
@@ -0,0 +1,97 @@
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+
+--- !dxcontainer
+Header:
+ Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
+ Version:
+ Major: 1
+ Minor: 0
+ PartCount: 2
+Parts:
+ - Name: PSV0
+ Size: 144
+ PSVInfo:
+ Version: 3
+ ShaderStage: 14
+ PayloadSizeInBytes: 4092
+ MinimumWaveLaneCount: 0
+ MaximumWaveLaneCount: 4294967295
+ UsesViewID: 0
+ SigInputVectors: 0
+ SigOutputVectors: [ 8, 16, 32, 64 ]
+ NumThreadsX: 512
+ NumThreadsY: 1024
+ NumThreadsZ: 2048
+ EntryFunctionName: 1
+ ResourceStride: 24
+ Resources:
+ - Type: 1
+ Space: 2
+ LowerBound: 3
+ UpperBound: 4
+ Kind: 5
+ Flags: 6
+ - Type: 128
+ Space: 32768
+ LowerBound: 8388608
+ UpperBound: 2147483648
+ Kind: 65535
+ Flags: 16776960
+ SigInputElements: []
+ SigOutputElements: []
+ SigPatchOrPrimElements: []
+ InputOutputMap:
+ - [ ]
+ - [ ]
+ - [ ]
+ - [ ]
+ - Name: DXIL
+ Size: 24
+ Program:
+ MajorVersion: 6
+ MinorVersion: 0
+ ShaderKind: 14
+ Size: 6
+ DXILMajorVersion: 0
+ DXILMinorVersion: 1
+ DXILSize: 0
+...
+
+# CHECK: Name: PSV0
+# CHECK: PSVInfo:
+# CHECK-NEXT: Version: 3
+# CHECK-NEXT: ShaderStage: 14
+# CHECK-NEXT: PayloadSizeInBytes: 4092
+# CHECK-NEXT: MinimumWaveLaneCount: 0
+# CHECK-NEXT: MaximumWaveLaneCount: 4294967295
+# CHECK-NEXT: UsesViewID: 0
+# CHECK-NEXT: SigInputVectors: 0
+# CHECK-NEXT: SigOutputVectors: [ 8, 16, 32, 64 ]
+# CHECK-NEXT: NumThreadsX: 512
+# CHECK-NEXT: NumThreadsY: 1024
+# CHECK-NEXT: NumThreadsZ: 2048
+# CHECK-NEXT: EntryFunctionName: 1
+# CHECK-NEXT: ResourceStride: 24
+# CHECK-NEXT: Resources:
+# CHECK-NEXT: - Type: 1
+# CHECK-NEXT: Space: 2
+# CHECK-NEXT: LowerBound: 3
+# CHECK-NEXT: UpperBound: 4
+# CHECK-NEXT: Kind: 5
+# CHECK-NEXT: Flags: 6
+# CHECK-NEXT: - Type: 128
+# CHECK-NEXT: Space: 32768
+# CHECK-NEXT: LowerBound: 8388608
+# CHECK-NEXT: UpperBound: 2147483648
+# CHECK-NEXT: Kind: 65535
+# CHECK-NEXT: Flags: 16776960
+# CHECK-NEXT: SigInputElements: []
+# CHECK-NEXT: SigOutputElements: []
+# CHECK-NEXT: SigPatchOrPrimElements: []
+# CHECK-NEXT: InputOutputMap:
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: Name
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-compute.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-compute.yaml
new file mode 100644
index 00000000000000..c9c6cf85879449
--- /dev/null
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-compute.yaml
@@ -0,0 +1,95 @@
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+
+--- !dxcontainer
+Header:
+ Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
+ Version:
+ Major: 1
+ Minor: 0
+ PartCount: 2
+Parts:
+ - Name: PSV0
+ Size: 144
+ PSVInfo:
+ Version: 3
+ ShaderStage: 5
+ MinimumWaveLaneCount: 0
+ MaximumWaveLaneCount: 4294967295
+ UsesViewID: 0
+ SigInputVectors: 0
+ SigOutputVectors: [ 8, 16, 32, 64 ]
+ NumThreadsX: 512
+ NumThreadsY: 1024
+ NumThreadsZ: 2048
+ EntryFunctionName: 1
+ ResourceStride: 24
+ Resources:
+ - Type: 1
+ Space: 2
+ LowerBound: 3
+ UpperBound: 4
+ Kind: 5
+ Flags: 6
+ - Type: 128
+ Space: 32768
+ LowerBound: 8388608
+ UpperBound: 2147483648
+ Kind: 65535
+ Flags: 16776960
+ SigInputElements: []
+ SigOutputElements: []
+ SigPatchOrPrimElements: []
+ InputOutputMap:
+ - [ ]
+ - [ ]
+ - [ ]
+ - [ ]
+ - Name: DXIL
+ Size: 24
+ Program:
+ MajorVersion: 6
+ MinorVersion: 0
+ ShaderKind: 5
+ Size: 6
+ DXILMajorVersion: 0
+ DXILMinorVersion: 1
+ DXILSize: 0
+...
+
+# CHECK: Name: PSV0
+# CHECK: PSVInfo:
+# CHECK-NEXT: Version: 3
+# CHECK-NEXT: ShaderStage: 5
+# CHECK-NEXT: MinimumWaveLaneCount: 0
+# CHECK-NEXT: MaximumWaveLaneCount: 4294967295
+# CHECK-NEXT: UsesViewID: 0
+# CHECK-NEXT: SigInputVectors: 0
+# CHECK-NEXT: SigOutputVectors: [ 8, 16, 32, 64 ]
+# CHECK-NEXT: NumThreadsX: 512
+# CHECK-NEXT: NumThreadsY: 1024
+# CHECK-NEXT: NumThreadsZ: 2048
+# CHECK-NEXT: EntryFunctionName: 1
+# CHECK-NEXT: ResourceStride: 24
+# CHECK-NEXT: Resources:
+# CHECK-NEXT: - Type: 1
+# CHECK-NEXT: Space: 2
+# CHECK-NEXT: LowerBound: 3
+# CHECK-NEXT: UpperBound: 4
+# CHECK-NEXT: Kind: 5
+# CHECK-NEXT: Flags: 6
+# CHECK-NEXT: - Type: 128
+# CHECK-NEXT: Space: 32768
+# CHECK-NEXT: LowerBound: 8388608
+# CHECK-NEXT: UpperBound: 2147483648
+# CHECK-NEXT: Kind: 65535
+# CHECK-NEXT: Flags: 16776960
+# CHECK-NEXT: SigInputElements: []
+# CHECK-NEXT: SigOutputElements: []
+# CHECK-NEXT: SigPatchOrPrimElements: []
+# CHECK-NEXT: InputOutputMap:
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: Name
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-domain.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-domain.yaml
new file mode 100644
index 00000000000000..6584e90f82210b
--- /dev/null
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-domain.yaml
@@ -0,0 +1,105 @@
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+
+--- !dxcontainer
+Header:
+ Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
+ Version:
+ Major: 1
+ Minor: 0
+ PartCount: 2
+Parts:
+ - Name: PSV0
+ Size: 144
+ PSVInfo:
+ Version: 3
+ ShaderStage: 4
+ InputControlPointCount: 1024
+ OutputPositionPresent: 1
+ TessellatorDomain: 2056
+ MinimumWaveLaneCount: 0
+ MaximumWaveLaneCount: 4294967295
+ UsesViewID: 0
+ SigPatchConstOrPrimVectors: 0
+ SigInputVectors: 0
+ SigOutputVectors: [ 0, 16, 32, 64 ]
+ NumThreadsX: 512
+ NumThreadsY: 1024
+ NumThreadsZ: 2048
+ EntryFunctionName: 1
+ ResourceStride: 24
+ Resources:
+ - Type: 1
+ Space: 2
+ LowerBound: 3
+ UpperBound: 4
+ Kind: 5
+ Flags: 6
+ - Type: 128
+ Space: 32768
+ LowerBound: 8388608
+ UpperBound: 2147483648
+ Kind: 65535
+ Flags: 16776960
+ SigInputElements: []
+ SigOutputElements: []
+ SigPatchOrPrimElements: []
+ InputOutputMap:
+ - [ ]
+ - [ ]
+ - [ ]
+ - [ ]
+ PatchOutputMap: []
+ - Name: DXIL
+ Size: 24
+ Program:
+ MajorVersion: 6
+ MinorVersion: 0
+ ShaderKind: 4
+ Size: 6
+ DXILMajorVersion: 0
+ DXILMinorVersion: 1
+ DXILSize: 0
+...
+
+# CHECK: Name: PSV0
+# CHECK: PSVInfo:
+# CHECK-NEXT: Version: 3
+# CHECK-NEXT: ShaderStage: 4
+# CHECK-NEXT: InputControlPointCount: 1024
+# CHECK-NEXT: OutputPositionPresent: 1
+# CHECK-NEXT: TessellatorDomain: 2056
+# CHECK-NEXT: MinimumWaveLaneCount: 0
+# CHECK-NEXT: MaximumWaveLaneCount: 4294967295
+# CHECK-NEXT: UsesViewID: 0
+# CHECK-NEXT: SigPatchConstOrPrimVectors: 0
+# CHECK-NEXT: SigInputVectors: 0
+# CHECK-NEXT: SigOutputVectors: [ 0, 16, 32, 64 ]
+# CHECK-NEXT: NumThreadsX: 512
+# CHECK-NEXT: NumThreadsY: 1024
+# CHECK-NEXT: NumThreadsZ: 2048
+# CHECK-NEXT: EntryFunctionName: 1
+# CHECK-NEXT: ResourceStride: 24
+# CHECK-NEXT: Resources:
+# CHECK-NEXT: - Type: 1
+# CHECK-NEXT: Space: 2
+# CHECK-NEXT: LowerBound: 3
+# CHECK-NEXT: UpperBound: 4
+# CHECK-NEXT: Kind: 5
+# CHECK-NEXT: Flags: 6
+# CHECK-NEXT: - Type: 128
+# CHECK-NEXT: Space: 32768
+# CHECK-NEXT: LowerBound: 8388608
+# CHECK-NEXT: UpperBound: 2147483648
+# CHECK-NEXT: Kind: 65535
+# CHECK-NEXT: Flags: 16776960
+# CHECK-NEXT: SigInputElements: []
+# CHECK-NEXT: SigOutputElements: []
+# CHECK-NEXT: SigPatchOrPrimElements: []
+# CHECK-NEXT: InputOutputMap:
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: - [ ]
+# CHECK-NEXT: PatchOutputMap: [ ]
+# CHECK-NEXT: Name
diff --git a/llvm/test/ObjectYAML/DXContainer/PSVv3-geometry.yaml b/llvm/test/ObjectYAML/DXContainer/PSVv3-geometry.yaml
new file mode 100644
index 00000000000000..43d9f70dba5eec
--- /dev/null
+++ b/llvm/test/ObjectYAML/DXContainer/PSVv3-geometry.yaml
@@ -0,0 +1,105 @@
+# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+
+--- !dxcontainer
+Header:
+ Hash: [ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
+ 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ]
+ Version:
+ Major: 1
+ Minor: 0
+ PartCount: 2
+Parts:
+ - Name: PSV0
+ Size: 144
+ PSVInfo:
+ Version: 3
+ ShaderStage: 2
+ InputPrimitive: 1024
+ OutputTopology: 4096
+ OutputStreamMask: 2056
+ OutputPositionPresent: 1
+ MinimumWaveLaneCount: 0
+ MaximumWaveLaneCount: 4294967295
+ UsesViewID: 0
+ MaxVertexCount: 4096
+ SigInputVectors: 0
+ SigOutputVectors: [ 8, 16, 32, 64 ]
+ NumThreadsX: 512
+ NumThreadsY: 1024
+ NumThreadsZ: 2048
+ EntryFunctionName: 1
+ ResourceStride: 24
+ Resources:
+ - Type: 1
+ Space: 2
+ LowerBound: 3
+ UpperBound: 4
+ Kind: 5
+ Flags: 6
+ - Type: 128
+ Space: 32768
+ LowerBound: 8388608
+ UpperBound: 2147483648
+ Kind: 65535
+ Flags: 16776960
+ SigInputElements: []
+ SigOutputElements: []
+ SigPatchOrPrimElements: []
+ InputOutputMap:
+ - [ ]
+ - [ ]
+ - [ ]
+ - [ ]
+ - Name: DXIL
+ Size: 24
+ Program:
+ MajorVersion: 6
+ MinorVersion: 0
+ ShaderKind: 2
+ Size: 6
+ DXILMajorVersion: 0
+ DXILMinorVersion: 1
+ DXILSize: 0
+...
+
+# CHECK: Name: PSV0
+# CHECK: PSVInfo:
+# CHECK-NEXT: Version: 3
+# CHECK-NEXT: ShaderStage: 2
+# CHECK-NEXT: InputPrimitive: 1024
+# CHECK-NEXT: OutputTopology: 4096
+# CHECK-NEXT: OutputStreamMask: 2056
+# CHECK-NEXT: OutputPositionPresent: 1
+# CHECK-NEXT: MinimumWaveLaneCount: 0
+# CHECK-NEXT: MaximumWaveLaneCount: 4294967295
+# CHECK...
[truncated]
|
…ded writing of the entry point into a proper string table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. Mostly looking good.
This change makes the variable be more descriptive to what it is actually representing.
struct RuntimeInfo : public v2::RuntimeInfo { | ||
uint32_t EntryNameOffset; | ||
|
||
void swapBytes() { sys::swapByteOrder(EntryNameOffset); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this need to call v2::RuntimeInfo::swapBytes
?
This reverts commit cde54df.
This change introduces a version 3 of the PSV data that includes support for the name of the entry function as an offset into StringTable data to a null-terminated utf-8 string. Additional tests were added to ensure that the new value was properly serialized/deserialized from object data. Fixes llvm#80175 --------- Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
This reverts commit cde54df. Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
This change introduces a version 3 of the PSV data that includes support for the name of the entry function as an offset into StringTable data to a null-terminated utf-8 string.
Additional tests were added to ensure that the new value was properly serialized/deserialized from object data.
Fixes #80175