Граф коммитов

2185 Коммитов

Автор SHA1 Сообщение Дата
Jaebaek Seo f0b9cf3a4b
[spirv] Support struct -> struct FlatConversion. 2019-03-20 11:24:33 -04:00
Adam Yang e97fbdb85f
/Fd now sets the shader debug name to the name specified. (#2023) 2019-03-19 17:16:11 -07:00
John Porto d432a02f77
Implements DIA Interfaces for HLSL variable-value mapping. (#2050) 2019-03-19 11:46:10 -07:00
John Porto 68204b3bfe
Fix the pix-alloca-reg-write metadata. (#2048)
The bug was caused by adding an LocalAsMetadata to an MDNode, which
is not allowed. This would happen whenever a shader would have
indirect access.
2019-03-18 18:21:07 -07:00
Tristan Labelle 3527762fd0
Allow optimizations to eliminate phis on undef resources before considering them errors
Some large shaders exhibit a behavior where phi nodes are created for resources, in which one of the possible incoming values is undef. This gets cleaned up later such that there are no undef resources left. However the fail-undef-resources pass has already failed compilation by that point. The fix is to change that pass to invalidate-undef-resources and replace the undefs with a special invalid value, such that we can produce an error later if still necessary, when optimization passes have been run such that temporary undef resources have been eliminated.
2019-03-18 14:27:31 -07:00
Tristan Labelle 52ef3facb9
Fix debug info for the return value of resource vector loads. (#2042)
* Fix debug info for the return value of resource vector loads.

* Moved debug values to the ResRet struct.
2019-03-18 14:22:23 -07:00
Tristan Labelle e487566946
Make debug info of HLSL vectors more user friendly (#2018)
The clang type we generate for HLSL vectors contains a single field h of type DependentSizedExtVectorType, which shows up as an int[4] in DWARF. This change specifically emits debug info for x, y, z and w fields instead.

With this change, we also stop emitting a vector member for operator[], whose implementation was marked "external" so I don't think it'll have any impact.
2019-03-18 14:12:49 -07:00
Ehsan 8275b8103c
[spirv] Support HLSL 'precise' keyword (#2024)
* [spirv] Support 'precise' keyword.
* [spirv] Support 'precise' on struct members.
2019-03-18 14:09:39 -07:00
Tex Riddell ab3858eb0c
Fix floating point state save/restore and expand testing. (#2037) 2019-03-18 12:43:16 -07:00
Tristan Labelle 9559442f3f Renamed from "poison" to "invalidate" 2019-03-18 12:41:07 -07:00
Tristan Labelle cc00f6e183
Fix vec1/mat1x1 to aggregate type splats and a crash (#1979)
FXC treats scalars, vector1s and matrix1x1s the same, at least as far as conversions go. We allowed splats from scalars to aggregates, but not from vector1s or matrix1x1s.

Also fixes a bug where we would crash on conversions to aggregates where the result was ignored, because clang wouldn't allocate an AggValueSlot and we didn't handle the destination pointer being nullptr.
2019-03-18 12:31:10 -07:00
Tristan Labelle ae838c0ca0
Fix two issues with DXR -remove-unused-globals (#1939)
1. Constant buffer globals could get removed, causing the layout of the implicit constant buffer to change.
2. For cases like static struct { int x; } s; (which happen in some commercial shaders), we would be left with struct { int x; }; at the global scope, which is illegal. This change cleans up anonymous records if we remove their last declared variable.
2019-03-18 12:29:24 -07:00
Tristan Labelle 0a801dae8e Moved debug values to the ResRet struct. 2019-03-18 11:00:37 -07:00
Helena Kotas da8802273b
Fix bugs discovered by temporarily enabling debug iterators (#2040)
Disable CompileWhenNoMemThenOOM when debug iterators are enabled

Note that debug iterators are still disabled in the build by default.
We will do internal runs with debug iterators on to catch these bugs
sooner, but we do not want to enable them by default because it blocks
the OOF memory handling tests CompileWhenNoMemThenOOM.
2019-03-18 10:29:50 -07:00
Ehsan b2b9185ca5
[spirv] Handle type mismatch for out/inout fn params. (#2004) 2019-03-15 23:40:45 -04:00
Tristan Labelle 088c3cf27b Fix debug info for the return value of resource vector loads. 2019-03-15 16:44:30 -07:00
Ehsan Nasiri 8cdb542225 [spirv] Support struct -> struct FlatConversion. 2019-03-15 18:52:13 -04:00
Adam Yang 231ed0c130
Fixed a problem of reading out of bound while removing loops (#2039) 2019-03-15 15:49:29 -07:00
Tristan Labelle 4431087506
Fix input vectors not having debug info (#2038)
We were systematically losing input vector debug info because of HLSignatureLower, which would replace them by per-element loadInput calls and then re-creating the vector through an insertelement chain. The llvm.dbg.value intrinsic was preserved for the recomposed vector, but this is not the authoritative source of data anymore - its elements are. Further optimizations would read past the insertelements and eventually we'd drop the vector and its debug info. To fix this, I'm now migrating the debug info to the individual vector elements as loaded from loadInput.

Also standardized on bitpieceexpression arguments being in bits everywhere, because it was becoming too confusing. The header for createBitPieceExpression had OffsetInBits while the source file had OffsetInBytes and various places converted counter-intuitively between the two.
2019-03-15 14:29:02 -07:00
Helena Kotas 9d367d8649
[Pkges] Add extension point to status email (#2033) 2019-03-15 11:41:17 -07:00
Tristan Labelle 52c6c0f668
Fix bogus DIFile debug metadata (#2030)
When compiling with debug info and passing in a full path, we ended up with a bogus !DIFile metadata entry where the path had the drive and directory components twice before the filename. Other code would compute the correct path and create a second !DIFile metadata entry.

Apparently we're misusing CodeGenOptions::MainFileName, because it should not contain a full path but, due to other code of ours, it seems like a riskier change to fix that because we depend on it in CodeGeneratorImpl::HandleTranslationUnit.
2019-03-14 14:23:56 -07:00
Tex Riddell 8501710c9f
Fix EmitStore assert due to NRVO with bool vectors (#2029) 2019-03-13 13:56:21 -07:00
Tex Riddell b718ff535d
Fix crash lowering GlobalVariable when scope is DINamespace (#2027)
- Change algorithm to no longer assume that getScope() returns either
  DICompileUnit or DISubprogram, searching for the global var in each
  compile unit until found instead.
2019-03-13 12:40:26 -07:00
Tex Riddell 00089a69b4
Fill in usage flags for constant buffers for library reflection. (#2028)
TODO: drill into ConstantBuffer<> type to make cbuffer reflection useful here.  The change would be something like this: CShaderReflectionConstantBuffer::Initialize:
   if (!annotation)
     return;

+  if (ST->getNumElements() == 1 &&
+      isa<StructType>(Ty->getContainedType(0)) &&
+      annotation->GetFieldAnnotation(0).GetFieldName() == CB.GetGlobalName()) {
+    // Assume we need to drill one level deeper into struct.
+    // This is the case when you use ConstantBuffer<MyStruct> ...
+    // It could also misfire in a narrow case where you use:
+    // struct MyStruct { ... }; cbuffer MyCBuffer { MyStruct MyCBuffer; }
+    // But the effect would be to drill one level into MyCBuffer for cbuffer VarDesc,
+    // which wouldn't be bad.
+    ST = cast<StructType>(Ty->getContainedType(0));
+    annotation =
+      typeSys.GetStructAnnotation(cast<StructType>(ST));
+  }
+
   m_Desc.Variables = ST->getNumContainedTypes();
   unsigned lastIndex = ST->getNumContainedTypes() - 1;
2019-03-13 12:36:55 -07:00
Helena Kotas 368c411ff4
Do not access iterator that may be empty (#2026) 2019-03-12 17:36:48 -07:00
Helena Kotas 139b292fa0
[Pkges] Remove unnecessary directory (#2025) 2019-03-12 16:59:39 -07:00
Tristan Labelle 430102b952
Isolate test file dependencies for dxilcontainer, linker and cmd tests. (#2014)
Those tests reach into HLSL, CodeGenHLSL, Samples and even quick-test directories to find the files they need. With this change, I move or copy files around to make sure that these test files are attributable to their consumer. I copied rather than moved files only in the case where a test in code explicitly reached into quick-test or Samples, because that essentially means that the file serves two different tests since they are also run as batch.
2019-03-12 13:40:33 -07:00
Ehsan d9d2f211dd
[spirv] Use llvm::ilist to store instructions in BB. (#2011) 2019-03-12 11:51:05 -04:00
Tex Riddell 4e9a01f631
Add -HV 2016 when compiling through D3DCompiler bridge (#2013) 2019-03-11 13:20:09 -07:00
Tex Riddell 5d0511a4a6
Handle incoming values not in VarMap (constants) in DxilLoopUnroll (#2012) 2019-03-11 13:19:15 -07:00
Jaebaek Seo 3327067a30 [spirv] Set assignment for second param of modf() (#1998)
The second parameter of modf() intrinsic is an output. This CL
assumes modf() has assignment expression for the second parameter.

Fixes #1741
2019-03-08 09:43:53 -05:00
Ehsan af46b67b6c
[spirv] Propagate RelaxedPrecision decoration. (#1915)
* [spirv] Propagate RelaxedPrecision decoration.

* Address issues brought up in issue #1736
2019-03-07 16:12:22 -05:00
Ehsan 04cdca328c
[spirv] (Spec)ConstantComposite are handled by SpirvConstant classes. (#2005) 2019-03-07 11:53:09 -05:00
Tristan Labelle 7c1f9f01e9 The fix. 2019-03-06 15:49:34 -08:00
Adam Yang 4cb5e567aa
Removing child loops of successfully unrolled loops from queue (#2008) 2019-03-06 15:44:34 -08:00
Ehsan f9fc460a54
[spirv] Fix handling of literals for constants. (#2000)
* [spirv] Fix handling of literals for constants.

Deducing literal types works by traversing the SPIR-V module in the
reverse order. We were only performing the reverse oreder within
functions, but we should have also reversed the order for SPIR-V
instructions that lay outside of functions. For example: constants,
constant composites, etc.

Before this fix, constants were visited before functions, and therefore
if they had a literal type, it wouldn't be deduced properly.

* Address comments.

There is no reason to keep a SetVector for SpirvFunction pointers. It
does not stop duplicate functions being used (the caller may have called
`new SpirvFunction` twice for the same function). There are already
mechanisms in place in SpirvEmitter class that prevent the same
function from being visited more than once.

Now that we have switched from SetVector to std::vector, it is better to
also do the reverse traversal of functions from the end to the
beginning.
2019-03-06 16:48:48 -05:00
Helena Kotas d713201162
Update drop path variable and formatting (#2007) 2019-03-06 13:36:58 -08:00
Ehsan 149fc70096
[spirv] Remove unused type result-IDs from SpirvFunction. (#2003) 2019-03-06 12:15:11 -05:00
Tristan Labelle 41a1ab10fc
Fix nondeterminism in HLSL Parameter SROA (#2002) 2019-03-06 08:09:03 -08:00
Tristan Labelle f8c02c243d
Migrate CodeGenTest-based tests to quick-test (#1975) 2019-03-05 16:37:38 -08:00
Helena Kotas 5c2ce68a06
[PkgEs] Email formatting script (#2001) 2019-03-05 16:03:31 -08:00
Ehsan 0b6973cc4d
[spirv] Add MatrixStride for SB<floatMxN> cases. (#1997) 2019-03-05 16:20:21 -05:00
Ehsan d16812ed3f
[spirv] Clean up extension & capability management. (#1994) 2019-03-05 16:19:47 -05:00
Ehsan 02d5c92400
[spirv] Cleanup old included headers. (#1945) 2019-03-05 11:56:28 -05:00
Ehsan e29556df26
[spirv] Refactor and add more unit tests (#1944)
* [spirv] Add unit tests for SpirvConstant.

* [spirv] Add unit tests for SpirvType classes.
2019-03-05 11:55:58 -05:00
Tristan Labelle 301e386f38
Fix crashes on Append/ConsumeStructuredBuffer of bools (#1985)
Our codegen for Append/Consume is unfortunate because it happens after initial codegen and we don't have access to lots of what would have made this easy. I've had to duplicate the register to memory conversion logic.
2019-03-05 07:59:09 -08:00
Ehsan f8eefcd63a
[spirv] Handle failures properly so error messages bubble up. (#1940) 2019-03-04 16:51:29 -05:00
Tex Riddell f60c283e2c
Map CompType::Kind::I1 to DxilProgramSigCompType::UIn32 (#1992)
Fix bool mapping to unknown component type in shader signature that can cause PSO signature validation error.

Fixes #1993.
2019-03-03 13:08:56 -08:00
Tristan Labelle c6cd8c8b55
Fix matrix pre/post increment/decrement (#1987) 2019-03-01 13:22:44 -08:00
Tristan Labelle ebe3536a2a
Add a test for recursion in structure members failing validation (#1983)
We normally check for recursion from the entry point in hlsl::DiagnoseTranslationUnit, at the end of AST parsing, but we can't do that when we compile for library targets because we have no entry point. This adds a test that we still fail validation.
2019-03-01 13:16:23 -08:00