* Moves the implementation of DxcThreadMalloc to dxcmem.cpp; removes DxcSwapThreadMalloc
* Remove DxcSetThreadMalloc(OrDefault) -- they were always been used for installing the default allocator
* Deletes copy and move ctors and assignment
* stores the allocator in the TLS slot.
* DxcSwapThreadMalloc should be able to install a null allocator
* Marks the DxcThreadMalloc members as hidden (linux only)
/Zi should be used with much care in FileCheck tests, because the contents of the test file gets embedded into the output, so any CHECK: lines will match by default because they will match themselves in the quoted source file.
This change removes /Zi from most tests which should not have it anyways. Several tests had to be updated or deleted because they weren't actually passing. All tests with /Zi remaining are now under the debug subfolder and reference the readme file that explains the gotcha.
Deleted some old code where we manually delete users of resource GV's while stripping debug modules. This is normally unnecessary but harmless, because we are guaranteed to have reduced all resource variables, and any failure to do so would result in a validation failure. However, library shaders can have resource variables. Removing the instructions here would result in incorrect code.
To complement the new [RW]ByteAddressBuffer.Load/Store<T> feature, it's useful to have operator sizeof to compute offsets. This supports both type and expression forms of the operator, as in C++. The size returned is consistent with struct layouts in StructuredBuffer, but not necessarily with that of constant buffers, which use different rules. Using sizeof on resources or aggregates containing resources will result in a compile-time error. It is only supported for "blittable" types.
* Modifies DxilDia's to use factories instead of lambdas for creating symbols
DxilDia used to hold a vector of lambdas -- constructors -- for the symbols
it knew about. When the user requested a symbol, said constructor was to be
invoked, creating a brand new symbol.
C++ lambdas can be hard to debug (i.e., how does one inspect the lambda's
state?), so the library is modified to hold a vector of factories -- i.e.,
objects with fields and a CreateSymbol method.
* fixes typo when creating Typedef symbols
* caches the VarInfo when creating the LocalVariable factories
This change adds support for : register(spaceN), where a space is specified but no register, such that the resource allocator runs on the given space.
For backwards compatibility, -auto-binding-space applies to resources without register bindings but not to those with an explicit register assignment like : register(t0) - those always go in space 0. To support this, I had to add state to represent "unspecified space". In the UnusualAnnotation, it's a Optional<uint32_t>. In the DxilResource, it's UINT_MAX, like we do for unspecified registers.
Adds support for templatized RWRawByteBuffer.Store<T>. To avoid SROA making us lose the original layout of any struct arguments, a new pass runs before SROA and breaks down such cases into per-element stores. So better be careful with the likes of buf.Store(0, (int[65536])0);...
Several tests could not be added to the batch run folder because they had a SkipDxilVersion test. This change allows this test to be performed in a // RUN: line, so that the tests can be moved to the batch folder. It also includes a small refactoring of FileRunCommandPart
This change replaces more malloc/calloc/realloc/free calls to new/delete. This creates several new out of memory exception paths (especially due to changing MallocAllocator) which exposed many memory mismanagement bugs that I found using the OOM test. Hence this grew to be a pretty big change.
Bug fixes and minor changes to ExecutionTest
Fixes 2 test bugs and a few razzle build warnings
Removes HlslTestUtils.h dependency on llvm/Support/Atomic.h
Brings it in sync with the HLK version of the tests
Remove HLK-only GetTestParamUseWARP modification
(finally) updating PIX's shader access tracking code to add the SM6.3 overloads of the various resource-access opcodes.
The new test passes on debug and release.
Moved stuff outside of quick-test, organized some misc tests, occasionally editing them a bit. In a few cases, made the editorial decision that the test was worthless and should just be deleted.
We added an exception when the bitcode reader reports an error, however the code higher up in the call stack isn't fully exception-safe and it turns out that two unique_ptrs over the same MemoryBuffer are alive at the same time, hence the double-delete and, more often than not, crash.
In a few places, we used rvalue references as if they meant read-only references, which is not at all their semantics. This change ensures that we never deal with rvalue references, which in any case have no place in HLSL and only introduce weird edge cases, but only with const and non-const lvalue references.
The actual problem here is that the instrumentation was only adding a CreateHandle call for the entrypoint function, but emitting UAV writes for all functions. This didn't work for HS shaders (that can have two entry points).
Now, a distinct CreateHandle with the same parameters is emitted for each function in the module.
This pass won't be called on libraries (yet), and will probably need updating anyway when it does.
-Qstrip_reflect would reserialize the root signature, leading to
validation failure #2162. Fixed by moving root sig to writer to clear
from module and prevent re-serialization to metadata.
Fixed -Qstrip_debug with -Zi and no output location still embeding
debug module.
Adds crash tests for bugs #2077, and #2061.
Removes crash test for closed bug #1882.
Adds a bunch of tests for "precise" attribute, whose effects I just learned about. Lead to filing bugs #2078, #2079 and #2080 due to divergences in behavior with FXC.
This is a partial solution to preserving snorm and unorm for Buffer and other resource types. In the clang type system, the canonical type of Buffer<snorm float> is a RecordType for the template specialization, which is Buffer<float>, so the information is lost. However, the type of the variable itself has a sugar node of type TemplateSpecializationType which provides the exact type arguments that were provided to the template class to select its specialization. Hence we can retrieve the information if we have access to the VarDecl's type.
This is a partial solution, because the snorm/unorm is still not encoded in the canonical type of the variable, which means that it is still legal to assign resources that differ between their use of the attribute. However, it should unblock the use of the feature with backends that consume this metadata.
In a few places, llvm uses malloc instead of operator new, especially with collections that want to avoid calling constructors. In those cases, the allocation won't go through our custom allocator and will crash rather than throw on out-of-memory conditions. This fixes the biggest offenders.
We declare CHeapPtr<wchar_t> DebugBlobName;, where CHeapPtr uses the CCRTAllocator by default, but initialize it with: Unicode::UTF8BufferToUTF16ComHeap(pDebugName, &DebugBlobName), which uses CComHeapPtr<wchar_t> p;
If we don't hit any exceptions, things are fine because we end up doing: *ppDebugBlobName = DebugBlobName.Detach(); , so the destructor will be a no-op.
- New -Qembed_debug is required to embed PDB in shader container
- -Zi used without -Qembed_debug will not embed debug info anymore,
and will issue a warning from CompileWithDebug().
- When compiling with Compile() and -Zi, -Qembed_debug is assumed
for compatibility reasons (lots of breaks without it)
- In dxc and CompileWithDebug() -Fd implies -Qstrip_debug
- Debug name is based on -Fd, unless path ends with '\', meaning you
want auto-naming and file written under the specified directory
- Debug name always embedded when debug info used, or -Fd used
- -Fd without -Zi just embeds debug name for CompileWithDebug(),
still error with dxc, since it can't write to your file.
- If not embedding debug info, it doesn't get written to the container,
only to be stripped out again.
- Fix padding for alignment in DebugName part.
- Default to DebugNameForBinary instead of DebugNameForSource if no
DebugInfo enabled
- Also fixed missing dependency on table gen options from libclang