Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ line upon naming the release. Refer to previous for appropriate section names.
- `dx::IsDebuggerPresent()` returns true if a debugger is attached.
- SPIR-V: `DebugBreak()` emits `NonSemantic.DebugBreak` extended instruction; `IsDebuggerPresent()` is not supported.

#### Other Changes
#### Bug Fixes

- Fixed non-deterministic DXIL/PDB output when compiling shaders with resource arrays, debug info, and SM 6.6+. [#8171](https://github.com/microsoft/DirectXShaderCompiler/issues/8171)
- Fixed mesh shader semantics that were incorrectly case sensitive.

### Version 1.9.2602
Expand Down
5 changes: 3 additions & 2 deletions lib/HLSL/DxilPromoteResourcePasses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "dxc/HLSL/DxilGenerationPass.h"
#include "dxc/HLSL/HLModule.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/IR/Attributes.h"
#include "llvm/IR/DebugInfo.h"
Expand Down Expand Up @@ -313,7 +314,7 @@ class DxilMutateResourceToHandle : public ModulePass {
hlsl::OP *hlslOP = nullptr;
Function *createHandleForLibOnHandle = nullptr;
DxilTypeSystem *pTypeSys;
DenseSet<Value *> MutateValSet;
SetVector<Value *> MutateValSet;
DenseMap<Type *, Type *> MutateTypeMap;
};

Expand Down Expand Up @@ -613,7 +614,7 @@ void DxilMutateResourceToHandle::collectCandidates(Module &M) {

for (Value *Val : newCandidates) {
// New candidate find.
if (MutateValSet.insert(Val).second) {
if (MutateValSet.insert(Val)) {
WorkList.emplace_back(Val);
}
}
Expand Down
23 changes: 23 additions & 0 deletions tools/clang/test/DXC/deterministic_output_resource_array.hlsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Test that compiling a shader with resource arrays produces deterministic output.
// This is a regression test for https://github.com/microsoft/DirectXShaderCompiler/issues/8171
// where compiling the same shader multiple times with -Zi and SM 6.6+ produced
// non-identical disassembly due to non-deterministic handle name suffixes.

// RUN: %dxc -T cs_6_6 -E CSMain -Zi -Fc %t1 %s
// RUN: %dxc -T cs_6_6 -E CSMain -Zi -Fc %t2 %s
// RUN: diff %t1 %t2

Texture2D<float4> inMaps[16];
RWTexture2D<float4> Output;

[numthreads(1,1,1)]
void CSMain(uint3 threadID : SV_DispatchThreadID)
{
Output[threadID.xy] = inMaps[0][threadID.xy];
Output[threadID.xy] = inMaps[1][threadID.xy];
Output[threadID.xy] = inMaps[2][threadID.xy];
Output[threadID.xy] = inMaps[3][threadID.xy];
Output[threadID.xy] = inMaps[4][threadID.xy];
Output[threadID.xy] = inMaps[5][threadID.xy];
Output[threadID.xy] = inMaps[6][threadID.xy];
}