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

2185 Коммитов

Автор SHA1 Сообщение Дата
JasperNV cc64a35288 hctgettaef: Update for Python 3 (#2195)
Python 2 was dropped from the project, but this utility still required it.
2019-05-21 11:01:45 -07:00
John Porto c9b9676c5d
User/joporto/dxcmem refactor (#2196)
* 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)
2019-05-20 20:52:10 -07:00
Tristan Labelle c9aa79b127
Fix tests which /Zi makes trivially succeed (#2171)
/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.
2019-05-20 10:55:49 -07:00
Adam Yang f240070cf1
Fixed issues that change codegen when there's debug info. (#2190) 2019-05-17 13:35:08 -07:00
Tristan Labelle d7f794c3c5
Fix a crash and bad codegen with operators on vectors (#2192) 2019-05-17 12:08:17 -07:00
Helena Kotas fdd4e3b0e6
Update version to 2019.05.00 (#2194) 2019-05-16 11:39:39 -07:00
alelenv b830b09bc5 [spirv] Add support for [[vk::shader_record_nv]] (#2179)
* Add support for [[vk::shader_record_nv]]

* Fixes after first review of ehsannas.
2019-05-16 00:36:28 -04:00
Tristan Labelle 347c04d51c
Split DxilGenerationPass.cpp into several files for its several passes (#2180) 2019-05-15 08:59:16 -07:00
Jaebaek Seo dd183fec9f
Force cmake to use python3 (#2187)
Force cmake to use python3
2019-05-15 09:56:11 -04:00
Adam Yang 716a113650
Fixed a bug where necessary code gets deleted with library shaders. (#2185)
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.
2019-05-14 11:10:46 -07:00
Adam Yang 24e71b12e5
Fixed a validation failure with stripping reflect with library shaders. (#2182) 2019-05-14 08:00:08 -07:00
Tristan Labelle a6776de932
Support operator sizeof (#2178)
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.
2019-05-10 13:50:37 -07:00
John Porto 0e704e1ea2
DxilDia uses factories (not lambdas) for symbol creation (#2177)
* 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
2019-05-10 11:00:24 -07:00
Tristan Labelle 17624a864b
Support space-only resource register annotations (#2163)
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.
2019-05-09 12:15:05 -07:00
Tristan Labelle f89e3b7150
Add support for RWRawByteBuffer.Store<T> (#2176)
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);...
2019-05-09 11:51:38 -07:00
Tristan Labelle 7dace2aa44
Support %dxilver in filerun commands for CodeGenHLSL tests. (#2174)
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
2019-05-09 11:49:51 -07:00
Helena Kotas ed44f7ff70
Add TablegenHLSLOptions dependency to dxcompiler (#2175)
Fixes build break in parallel builds
2019-05-08 13:41:58 -07:00
Tristan Labelle 3a7e6d38de
Add support for generalized templated byte address buffer loads (#2159)
Implements [RW]ByteAddressBuffer.Load<T> for all numerical or aggregate of numerical Ts, leveraging the same code from StructuredBuffer<T>.Load.
2019-05-08 11:39:25 -07:00
Tristan Labelle 7342a3b9be
Added missing semicolon in struct layout output (#2173) 2019-05-07 15:34:52 -07:00
Tristan Labelle e4ceb30434
Convert more mallocs/frees to news/deletes (#2157)
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.
2019-05-07 07:46:09 -07:00
Helena Kotas 893d340c4f
Bug fixes and minor changes to ExecutionTest (#2161)
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
2019-05-06 16:30:22 -07:00
Helena Kotas 5135c1e217 Add TablegenHLSLOptions dependency to dxclib (#2170)
Fixes build break on parallel builds
2019-05-06 16:20:02 -07:00
Jeff Noyle 6679de6506
PIX shader access tracking: SM6.3 resource access overloads (#2172)
(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.
2019-05-06 15:03:05 -07:00
Tristan Labelle 2e6a343e64
Another pass at organizing tests (#2168)
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.
2019-05-06 09:33:16 -07:00
Tristan Labelle 7d1a397e4f
Fix double-delete when failing to load llvm bitcode (#2169)
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.
2019-05-06 08:29:43 -07:00
Jeff Noyle 650044a17b
PIX passes: Add RawBufferStore opcode for shader-access-tracking (#2166) 2019-05-03 14:45:49 -07:00
Helena Kotas df954a7d48
Add parallel build option to hctbuild.cmd (#2167) 2019-05-03 13:16:04 -07:00
Tristan Labelle 93634879d7
Error instead of crash on unsupported intrinsic. (#2165) 2019-05-03 11:03:03 -07:00
Tristan Labelle f7ffe92528
RValue references no more! (#2160)
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.
2019-05-03 09:12:29 -07:00
Jeff Noyle 40497d7bb8
PIX shader access tracking pass: instrument all functions in module (#2148)
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.
2019-05-03 08:22:32 -07:00
Tex Riddell 638d988e8f
Fix issues with -Qstrip_reflect and -Qstrip_debug (#2164)
-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.
2019-05-03 08:06:31 -07:00
Ehsan 5648e43f18
[spirv] Command line option for providing $Globals binding. (#2156) 2019-05-01 18:28:14 -04:00
Ehsan 6e8df18886
[spirv] Use extension for fp16 in GLSL extended instruction set. (#2151) 2019-05-01 12:33:22 -04:00
Adam Yang 9a0f7160e5
Fixed a host of issues with Eval intrinsics (#2144) 2019-05-01 01:59:16 -07:00
Helena Kotas 4ee998c89f
Add option to hctbuild.cmd to disable audible announcements (#2155) 2019-04-30 21:47:54 -07:00
Tristan Labelle 8368d0c952
Fix a crash converting between numerical and non-numerical types. (#2120) 2019-04-30 10:56:38 -07:00
Tristan Labelle 28f0fe4701
Crashes and precise test updates (#2081)
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.
2019-04-30 10:50:43 -07:00
Tristan Labelle 6264641b94
Preserve snorm/unorm on resource template args (#2107)
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.
2019-04-30 10:49:49 -07:00
Tristan Labelle 725189cf17
Remove malloc usages in favor of operator new (#2150)
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.
2019-04-30 10:26:36 -07:00
Ehsan 8270b9f795
[spirv] Emit Float16 capability if float16 type is used. (#2147) 2019-04-30 10:35:49 -04:00
Tex Riddell e97d1b1c77
Merge pull request #2143 from tex3d/dxc-opts3
Add -Qembed_debug, don't embed debug info by default
2019-04-24 21:20:36 -07:00
Tex Riddell 753d02595c Merge remote-tracking branch 'ms/master' into dxc-opts3
# Conflicts:
#	lib/DxilContainer/DxilContainerAssembler.cpp
2019-04-24 20:20:36 -07:00
Tex Riddell 47d2600312 Emit warning for auto-embed behavior and update tests 2019-04-24 17:45:58 -07:00
Tristan Labelle b5f9280fa2
Remove shell api dependency. (#2141)
StringCompareOrdinal lives in kernel32.dll, better than previous implementations which pulled functions from user32.dll or shlwapi.dll.
2019-04-24 14:22:36 -07:00
Xiang Li 58b3d23cfc
Support Qstrip_reflect. (#2139)
* Support Qstrip_reflect.
2019-04-24 12:58:25 -07:00
Adam Yang cfb330ef56
Fixed bug where allocas get inserted at the wrong place. (#2140) 2019-04-23 11:32:54 -07:00
Tristan Labelle 93035fd2a5
Fix allocator mismatch with CompileWithDebug output string (#2137)
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.
2019-04-23 08:07:49 -07:00
Adam Yang 91f37618db
Turn stores to initializer for static variable where possible. (#2122) 2019-04-22 08:59:06 -07:00
Tex Riddell 69882a0394 Add -Qembed_debug, don't embed debug info by default
- 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
2019-04-19 19:57:25 -07:00
Helena Kotas 850c8d3676
Fix empty struct check (#2134)
Fixes llvm assert and debug-only test failure (CodeGenHLSL\batch\misc\emptyStruct.hlsl).
2019-04-19 14:38:10 -07:00