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

152 Коммитов

Автор SHA1 Сообщение Дата
Xiang Li 8c4f2db67e Add -NoLineDirectives to ignore #line. (#550) 2017-08-11 14:55:45 -07:00
Young Kim eacdff2a5c Support FP16 (#471)
This change is the initial step for supporting fp16.

Support half type with /no-min-precision option. This switch can be moved to other master switch in the future as we refine our spec for half support. 
min16float will be treated as half with warnings.
Fix compiler test to take additional arguments, and fix regression tests.
TODO: we need to make decisions on what triggers low precision instead of min precision. Also need to change signature packing and constant buffers for half.
2017-08-10 10:19:43 -07:00
Xiang Li e5c0e5ffaa Merge DivergenceAnalysis from llvm3.8. (#528) 2017-08-07 12:14:46 -07:00
Xiang Li 3f866d5e70 Use lazy load for linking. (#527) 2017-08-07 12:14:24 -07:00
Marcelo Lopez Ruiz 669635dec7 Fix dense map grow case with exceptions (#529)
This fixes the OOM test that was failing under Release configuration.
2017-08-05 21:47:10 -07:00
Xiang Li 13665a2673 Bug fixes. (#511)
1. Support empty struct as call arg.
2. Define _ATL_DECLSPEC_ALLOCATOR for older atlbase.h
3. Fix typo in SROA_Parameter_HLSL::preprocessArgUsedInCall for use AllocaBuilder when need RetBuilder.
2017-08-02 17:11:44 -07:00
Tex Riddell 705c3348e4 Add operand index enum and set methods to instruction helpers (#430)
* Add operand index enum and set methods to instruction helpers

* hctdb_instrhelp.py: Use namedtuple for llvm_type_map values.
2017-07-31 13:33:51 -07:00
Xiang Li 36ba7ac534 Add HLDeadFunctionEliminationPass. 2017-07-29 10:27:18 -07:00
Xiang Li 46e47f01e5 Refactoring DxilEmitMetadata pass. 2017-07-29 10:27:18 -07:00
Xiang Li a318eb6106 Support return of resource for library.
1. Don't check hasMulticomponentUAVLoads for lib.
2. Skip mem2reg for unpromotable handle alloca for lib.
3. Support find resource attribute from function call.
4. Avoid unpack for dxil types.
5. Add resource attribute for fieldAnnotation.
2017-07-29 10:27:18 -07:00
Tex Riddell c9beb84c51 Fix ViewID state for flow control and consistent ViewID detection (#484)
* Fix ViewID state for flow control and consistent ViewID detection

1. Different ways of determining ViewID usage led to assert or crash.
Use DxilModule flag to guarantee consistency.  But this required
splitting DxilEmitMetadata pass into two passes, one that finalizes
the module and computes flags run before ComputeViewIdState, and one
that simply writes the metadata.

2. storeOutput in flow control with values not dependent on that flow,
such as literals, would not pick up control flow dependence.
Fix by picking up control flow dependence on storeOutput instructions,
not just the value being written.

* Fix control depenence computation

There was a bug in the implementation of the control dependence algorithm.
We were incorrectly iterating over all descendents in the postdom tree where
the algorithm should only iterate over immediate children.
2017-07-28 11:51:15 -07:00
Tex Riddell bcbaa611ed Add new feature info names to disassembler (#476)
- also update ShaderFeatureInfoCount and static_assert that the
count matches in disassembler
2017-07-27 16:49:02 -07:00
Jeff Noyle d3f53b7f3e "Dr PIX": Force early Z (#467)
PIX has the ability to turn on early z and show you the performance difference with and without.
This pass implements the DXIL side of it.
2017-07-27 13:34:54 -07:00
Young Kim 55667043c3 Support denorm option (#446)
This change is to support preserve denorm operations. We do this by creating dxc options and propagate them all the way to dxil metadata so that drivers can see how it should handle floats.
Currently we support three modes: any(default), preserve, and ftz

Denorm option will be of per function flag. We store this information at function annotation metadata. This means that for DXIL 1.2 we have a new structure for function annotation. The change in structure is documented on DXIL.rst
2017-07-27 10:08:14 -07:00
Xiang Li c1973d761c Code Cleanup. (#475)
Add default for switch to avoid warnings.
2017-07-26 21:35:02 -07:00
Xiang Li 96c9c0597c Code cleanup. (#469)
1. Move DxilEmitMetadata out of DxilGenerationPass.cpp
2. Move helper function out of HLModule.
2017-07-26 11:02:20 -07:00
Jeff Noyle 47226d0422 PIX: Pixel count/cost pass (#457)
The pass implements functionality for PIX for the "pixel cost", "depth complexity" and "overdraw" visualizers. You can probably infer what the pass does from the names "overdraw" and "depth complexity": For each pixel rendered it increments a corresponding counter in a UAV of a buffer that is the same size as the render target. The "pixel cost" pass does the same thing, only the increment is a weight value calculated from the total cost of the draw call, as derived from PIX's GPU-side profiling system.
2017-07-25 16:08:31 -07:00
Young Kim 4d325c78b4 Update shader model 6.2 (#435)
1. Update shader model 6.2
2. update DXIL version to 1.2 and its tests
3. Allow noalias and alias_scope metadata per instruction for validator 1.2
2017-07-19 22:00:31 -07:00
Xiang Li c6a4746212 Add rewriter option to keep user define. (#432) 2017-07-17 11:28:23 -07:00
Jeff Noyle 82fcc7ca0f (PIX) Reduce msaa to single-sample (#427)
This pass will be used in PIX for "Dr. PIX experiments", wherein a workload is re-rendered with MSAA turned off in order to get an approximate understanding of the performance impact of MSAA.
2017-07-14 13:40:49 -07:00
Jeff Noyle add0d6ec4c (PIX passes) Take constant color from CB (#426)
* maybe?

* Add a "mode" that inserts CB references too

* Add tests

* Xiang's helper to recreate meta-data

* Create CB properly

* Use actual defined constant

* CR feedback: incorrect "one or the other" assert. Unnecessary sethandle. Not accounting for CB id > 0. Test CB id > 0.
2017-07-13 21:07:03 -07:00
Marcelo Lopez Ruiz 9903286944 Additional fixes for error handling exposed by OOM testing (#425)
In particular, out-of-memory exceptions thrown during string construction in the context of certain move constructors (in this case, and std::pair) would cause the runtime to terminate the process.

The problem is that a noexcept specification was added to some STL move constructors incorrectly, and when the runtime finds such a frame while unwinding, it will invoke std::terminate(). See the comments and static assertions for more details.

Fixes the Realloc implementation in the test memory allocator.
2017-07-13 19:29:15 -07:00
Xiang Li c9e9019780 Write specifiers before anonymous struct. (#423)
* Write specifiers before anonymous struct.
* Add rewrite option to mark all global variable not internal as extern.
2017-07-12 18:20:10 -07:00
Marcelo Lopez Ruiz 0794f13ec7 Fix compile error for 32-bit CRITICAL_SECTION size embedded in mutex (#415) 2017-07-10 23:11:02 -07:00
Xiang Li f0c3cbd454 Resolve name collison for dxil types in BitcodeReader. (#411)
Resolve name collison for dxil types in BitcodeReader.
2017-07-10 16:28:23 -07:00
Marcelo Lopez Ruiz d5bb3089cf Add support for custom allocators (#390)
Supporting a custom allocator for dxcompiler.
Adds recovery for exceptions and out-of-memory handling.
Add custom allocator support to linker.
Fix for release-only test failure.
Removes assertion about presence of command-line option registration
2017-07-06 16:45:48 -07:00
Xiang Li 114fd223d1 Add DxilD3DCompile and DxilD3DCompile2 as example of library use. (#402)
* Add DxilD3DCompile and DxilD3DCompile2 as examle of library use.
It will compile shader into library first, then link to generate the final dxil.
If there's include used, it will compile included file into seperate lib and link all lib together.
2017-07-05 17:37:40 -07:00
Jeff Noyle fa94808e09 Remove all discard instructions (#400)
* Add remove-discards pass

* explicit lfs

* Change pass name, remove copy-pasted member enum, reduced include set

* CR feedback: better way to delete instructions, stale comment, end iterator could go stale, CHECK-NOT is a good idea.
2017-06-30 13:57:12 -07:00
Xiang Li fe1e5ccc61 Add SkipStatic to rewriter. (#394) 2017-06-29 10:43:53 -07:00
Xiang Li 1188a80e63 Remove noise intrinsic. (#392) 2017-06-28 10:35:25 -07:00
Jeff Noyle e0c24c6839 Implementation of "constant color output" pass for PIX (#371) 2017-06-27 10:11:24 -07:00
Tex Riddell 36798cf0bc Fix typo in StoreOutput outputSigId parameter (#385) 2017-06-26 16:39:19 -07:00
Xiang Li be2910df32 Support include for IDxcRewriter (#384)
* Add RewriteNoFunctionBody to IDxcRewriter.

* Support include for rewriter.

* Add rewriter to dndxc.
2017-06-26 11:46:38 -07:00
Tex Riddell 73e3ea3e48 Interpret all elements as arbitrary for ViewID packing validation (#379)
- Differentiate inputs/outputs for return code
- Use original element id for easier debugging of ViewID packing
2017-06-23 15:21:51 -07:00
Xiang Li f408830296 Add linker. 2017-06-19 15:15:44 -07:00
Xiang Li 18c0c08032 1. Remove ResIndex from ResourceLinkInfo.
2. For none library profile, remove unused functions except entry and patchconstant function.
3. Fix issue caused by lost instanceCount for GS function props.
2017-06-19 15:15:44 -07:00
Xiang Li 3f0c4e5d30 Support multiple entries in one library.
1. Save signatures for each entry.
2. Lower signatures and strip parameters for each entry.
3. Don't save function props for patch constant function.
4. Erase value from vectorEltsMap once it is used in SROA_Parameter_HLSL::replaceCastArgument and SROA_Parameter_HLSL::replaceCastParameter.
5. Remove unused member of DxilGenerationPass.
6. Fix typo when clear semantic for cloned return annotation.
2017-06-19 15:15:42 -07:00
Xiang Li 79bb311bd9 Code cleanup.
1. Add Function props for entry.
2. Create DxilEntrySignature to group DxilSignature.
3. Move generation of loadinput/storeoutput into HLSignatureLower.
2017-06-19 15:15:38 -07:00
Xiang Li ebaab67a50 Add DxilFunctionProps to DxilModule. 2017-06-19 15:14:29 -07:00
Xiang Li 0a3981b54b 1. Support flatten function decl.
2. Clone shader entry to be called by other functions.
3. Skip ComputeViewIdState for library profile.
4. Change HLFunctionProps to DxilFunctionProps for DxilModule to use.
5. Don't add .flat to flattened function name.
2017-06-19 15:14:28 -07:00
Xiang Li c1bc9d945a Add resource link info for library profile. 2017-06-19 15:14:28 -07:00
Xiang Li 8e21407ca9 Add library profile. 2017-06-19 15:14:27 -07:00
Xiang Li fba18dd59c Add copy function for DxilSignature and DxilTypeSystem. (#359)
* Add copy function for DxilSignature and DxilTypeSystem.
Also make OP::RefreshCache() public.
2017-06-16 12:27:50 -07:00
Young Kim 2c568d00db Fix Multiple Component UAV Load Flag Check (#356)
This change is to fix the bug on fixing multi component UAV Load Flag Check by iterating over UAV resources in a DxilModule and check if a given resource is 1) either texture or typed buffer and 2) multi component resource. This change also changes shader flag collection stage after all necessary passes are complete from higher level DXIL to DXIL.
2017-06-14 17:23:55 -07:00
Xiang Li e380b8e915 Add dxcutil to share code. (#350) 2017-06-12 18:00:39 -07:00
Tex Riddell f1f8997e68 ViewIDPipelineValidation fixes (#339)
- update DxilPipelineStateValidation with MaxVertexCount
- Add option to ignore indexing constraint in DxilSignatureAllocator
- Fix issues with ViewIDPipelineValidation
- Detect ViewID dependent tessfactors
- Add mode for checking expanded merged input only
- Treat expanded Clip/Cull as Arbitrary
2017-06-08 16:01:44 -07:00
Xiang Li 6c4b87efd9 Create pass for Lower static global into allocas. (#341) 2017-06-07 17:14:43 -07:00
David Peixotto 0ea6620342 Add pass to preserve all outputs (#326)
This commit adds a new pass that will transform all the storeOutput
instructions in the program. For each element in the output
signature we create an alloca to hold writes to the output.
We rewrite each storeOutput to store to the alloca'd location
instead. Then at each function return point we store to
each element in the output signature by reading the latest
value from the alloca'd location.

The above transformation provides the following properties
for outputs after it is run.

    1. Remove all dynamic indexing on output writes
    2. Remove multiple writes to same output location
    3. Ensure all output locations in the signature are written
2017-05-30 09:41:54 -07:00
David Peixotto 2afe446dae Update helpers for working with precise (#333)
This commit updates the `IsPrecise` helper to also check for the fast math
flags on an instruction. Now, the function will return the correct value
for any instruction. Before it only worked for intrinsic calls.

We also added three helpers for working with fast math flags.
We provide getters and setters for precise fast math flags and
a helper to say if fast math flags are preserved through serialization
and deserialization.

Finally, we added a unit test for DxilModule that we can use to ensure
that the `IsPrecise` helper returns the correct value.
2017-05-26 12:08:13 -07:00
David Peixotto 99470ad061 Make precise helper function take const pointer (#329) 2017-05-23 13:09:04 -07:00