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

3688 Коммитов

Автор SHA1 Сообщение Дата
Tex Riddell ae9bf56515
Fix TransitionTo for UAVs in various tests (#4420)
Resource used as UAV must have TransitionTo="UNORDERED_ACCESS" for correct
runtime state.

These tests (by name in ShaderOpArith.xml) were missing this:
  - Derivatives
  - QuadRead
  - ComputeSample
  - ProgOffset
  - SampleCmpLevel
  - Saturate
  - AtomicsRoot
  - AtomicsHeap
  - FloatAtomics
2022-04-27 11:46:52 -07:00
Justin Holewinski 751eab03f2
[SM6.7][WritableMSAA] Front-end and test fixes (#4416)
* [SM6.7][WritableMSAA] Front-end and test fixes

This change fixes DXC to properly pass the SampleCount attribute to DXIL
metadata. A few test issues are also fixed, namely:

- Do not create upload resource for MSAA textures, since this will cause
  a sample count mismatch in the runtime and we do not need the upload
  resource anyway.
- Fix inverted logic to detect support for ATO and WritableMSAA.
- Pass D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET resource flag when
  creating MSAA resource, which is required by the runtime.

* Actually return after skipping ATOWriteMSAATest

* Fix props_ms.hlsl test case encode sample count

Co-authored-by: Tex Riddell <texr@microsoft.com>
2022-04-27 05:04:56 -07:00
Justin Holewinski e3a853a657
[ATORawGather] Remove unreferenced local variable (#4418)
This is causing VS2022 builds to fail with warnings-as-errors enabled.
2022-04-26 17:55:41 -07:00
Jeff Sooknarine ff7580a1fa
Fix Writable MSAA ExecutionTest device checks (#4412)
Writable MSAA ExecutionTest was setting TestResults::Skipped for devices
that have the necessary support and continuing to run the test.

Follow the style of the RawGather ExecutionTest.
2022-04-26 10:28:56 -07:00
Joshua Batista 72d679ae86
User/jbatista/drui hlk test02 (#4413)
* Made nologo option hidden

* working tests for compute and ps/vs shaders

* working tests for compute and ps/vs shaders

* Fix test and add fallback mode for SM 6.0 to verify test logic

* Correct StructuredBuffer descriptors

* add separate result buffers for each shader, other changes from Tex

* fallback works, add transition to field to uav's

fallback works, add transition to field to uav's. 6_6 still returns all 0's, and there's a message about highest debug layer model supported being 6_5

* fallback works, and on non-fallback, CS works.

* change hardcoded to true rval

* swap root signature and set descriptor heaps so that heaps comes before root

* Remove unnecessary comments, fix indexing to be completely dynamic

* remove extraneous resources in root sig, and use Test_F macro in execution test

Co-authored-by: Tex Riddell <texr@microsoft.com>
2022-04-25 20:32:12 -07:00
Helena Kotas f1f5bf0ed3
Fix x86 build break (#4414) 2022-04-25 13:46:22 -07:00
Helena Kotas ffc69e9cec
Dxexp: Update highest recognized shader model to 6.8 (#4409) 2022-04-22 19:24:29 -04:00
Greg Roth 766db8eeaf
RawGather ExecutionTest (#4399)
Creates a texture interface that represents an anonymous texture to be
populated with valid values then raw gathered from a shader and copied
to a UAV whose contents are compared with the original to verify correct
behavior. Derived textures use templating to share code that varies
depending on the type, type size, format characteristics (norm, signed,
etc), and number of channels.

This includes a fallback mechanism that uses a standard gather or loads
to retrieve the expected results from the aliased texture.

Some incidental refinements and corrections to the resource and view
creation functions
2022-04-22 11:21:08 -07:00
Natalie Chouinard 1d2a68fb3e
[dxil2spv] Translate extractValue and bufferStore (#4404)
Add support for translation of LLVM extractValue operations and DXIL
bufferStore operations to SPIR-V instructions.

The bufferStore implementation is limited to what is required to
support a simple passthrough compute shader. For the yet unsupported
cases, an error is emitted.
2022-04-22 09:58:50 -04:00
Tex Riddell e138888302
Dedup semantic names in IO signature parts for valver 1.7 (#4406)
Create new NameOffsetMap that uses StringRef to prevent identical strings from being duplicated. Old behavior is maintained when earlier validator version set by using a *_nodedup map that continues to use a pointer to allow duplicates as previous validators did.
2022-04-21 15:02:36 -07:00
Adam Yang 88d88ae365
Taught DxilValueCache to handle complex switch statements. (#4403)
- Taught DxilValueCache to handle switch statements where each case has more than just a single block.
- Fixed `DxilValueCache::ResetUnknowns` just setting value association to nullptr, which was entirely incorrect. Now it correctly deletes the value association that have been marked as unknown.
- Deleted the idea of 'AlwaysReachable' from DxilValueCache, which is unused, ill-defined, and potentially dangerous.
- Improved the dump function for 'DxilValueCache' for better debugging.
2022-04-21 11:53:45 -07:00
Natalie Chouinard 316b849cfa
[dxil2spv] Translate createHandle and bufferLoad (#4389)
Add support for translating createHandle and bufferLoad DXIL operations
to SPIR-V instructions. The most significant limitation of this current
implementation is the naive translation of descriptor set and binding
numbers, but it is sufficient for simple passthrough shaders.
2022-04-21 09:38:03 -04:00
Tex Riddell d3a3683d8c
Handle UDT ptr collisions in FixOverloadNames (#4405)
FixOverloadNames renames intrinsics to match renamed overload types,
which happen as a result of loading modules with conflicting types into
the same llvm context.  A conflicting type would be one that has the same
name but is a different type.

UDT (User Defined Type) arguments are always pointer types, so when the
intrinsic overload is based on a UDT argument, the type retrieved by
GetOverloadType will be a pointer.  The code did not handle this case,
skipping the overload name fix.

This change adds the check for pointer type so UDT overloads will be fixed.

The test links two libraries with a conflicting UDT by the same name, used
in a TraceRay call.  This previously crashed during bitcode writing because
of invalid IR.
2022-04-20 18:19:33 -07:00
Adam Yang 263419ed0b
Removed all instruction made dead by their users being simplified in DxilRemoveDeadBlocks (#4401) 2022-04-20 17:02:43 -07:00
Natalie Chouinard 787245f28f
[SPIR-V] Add option to rename SPIR-V entry point (#4390)
Allow renaming the SPIR-V entry point name from the default HLSL entry
point name with `-fspv-entrypoint-name`.

Fixes #2972
Fixes #4356
2022-04-20 16:04:56 -04:00
Adam Yang 51e69b822d
Moved DxilEraseDeadRegions to after DxilRemoveDeadBlocks (#4397) 2022-04-19 15:09:28 -07:00
Tex Riddell 0c64351247
Fix leak of DxilContainerWriter in DxbcConverter (#4400) 2022-04-19 14:22:14 -07:00
Greg Roth 9e56b51775
ExecutionTest for Writable MSAA (#4387)
Writes sample values to a RWTexture2DMS that are the sample index plus 1
in the shader. It copies that data to an output UAV in a separate shader
then reads it back and verifies that it matches.

Incidentally cleans up some of the DX12 utility functions and comments
2022-04-14 05:27:09 -07:00
Chris B a7fa058dd3
Rework name lookup (#4332)
* Rework name lookup

This is a big change... A lot of the change here is actually reverting
back to clang 3.7 code. Specifically around template name resoltuion.

The root cause of issue #4263 is that in DXC (before this change) HLSL
routes all name lookup through template name resolution. This results
in annotating some things as templates that shouldn't be. Specifically
in the test case in #4263, the second `Load` gets annotated as a
template-id tracking to the first `Load` when it should be just a
method specialization.

This fix is a bit involved.

I revert a bunch of the template handling code back to clang-3.7. This
causes two problems:

(1) HLSL allows omiting empty template argument lists for default
template cases (i.e. `matrix` is valid in HLSL, but in C++ it would
need to be `matrix<>`). This patch should fully resolve that case.
(2) Since DXC routes all names through template lookup, some
diagnostics were only emitted in template name lookup. This patch fixes
_some_ of those cases, but there are test failures that I'll resolve in
a subsequent commit on this PR.

I'm posting this change before it is fully ready to go because it is
large and may take some time to review.

* Issue precision warnings during decl diagnosis

* Adding template test cases

This adds two new test cases. One that verifies that template default
arguments are correctly instantiated when the empty template parameter
list is omitted, and a second that verifies that template function
overloads parse correctly.

* Auto update verifier tests

This is an automated update of the verifier tests. I've manually
reviewed it and it looks correct to me but there's a lot of change here.

Expected differences are:
(1) Some of the old warnings were just wrong...
(2) We only emit promotion warnings on declarations, this removes them
from cases like `std::is_same` uses
(3) Template typenames are unsugared, so `Texture2D` becomes
`Texture2D<vector<float, 4> >`
(4) Warnings are not emitted after fatal errors in the same context (so
we lose a few warnings)
(5) Typenames are quoted
(6) QualType names are printed instaed of custom strings, this results
in some errors that would have said `float16_t` to say `half`, and
errors that ignored `unsigned` qualifiers to bake it in
(7) The order of warning emission changed because we emit in a
different place :(

* One more test case fix for quoted typenames

* Fixing the test case for 4263

* Fixing diagnostic for missing template arguments

* Updating SPIR-V testcase for template changes

* Updating PrettyPrinter with rule for rewriter

This patch adds an option to omit HLSL default template arguments when
pretty printing types inside the rewriter. This minimizes the impact of
the template lookup changes on the rewriter cases.

* Correct missing diagnostics for constant buffers

* Restoring warning to verifier test.

* Updating a testcase I added upstream
2022-04-12 22:09:30 -05:00
Xiang Li 6834925179
Update test for helperlane wave on VS. (#4367)
* Update test for helperlane wave on VS.
2022-04-12 18:36:38 -04:00
Adam Yang 3aaf42a042
Added a pass to use GVN to remove redundant branches without doing code motion. (#4383) 2022-04-12 13:34:27 -07:00
Natalie Chouinard 1039a872b7
[dxil2spv] Support shl instruction (#4388)
Add support for translating the first simple binary operator
instruction, shift left, from DXIL to SPIR-V.
2022-04-12 12:57:22 -04:00
Jaebaek Seo 3cb5d80bb8
[spirv] support 'T vk::RawBufferLoad<T = uint>(uint64_t address [, uint alignment = 4] )' (#4226)
VK_KHR_buffer_device_address extension support a Vulkan feature to load data
from an arbitrary raw buffer address. We added
'uint vk::RawBufferLoad(uint64_t address)' before, but it is limited to loading data
with the unsigned integer type.

This commit adds
'T vk::RawBufferLoad<T = uint>(uint64_t address [, uint alignment = 4] )' that
allows us to load data with an arbitrary type.
2022-04-11 16:44:13 -04:00
Jeff Noyle a47dc0e657
PIX: Incorrect index for CreateHandleFromBinding (#4382)
This mistake was upsetting a certain driver. The UAV being declared is always u0 in space -2. Also changed the name of one struct type to make it more obvious what PIX had added.

authored-by: Jeff Noyle <jeffno@ntdev.microsoft.com>
2022-04-11 12:55:30 -07:00
Xiang Li aa0880c37e
Reenable NRVO when no precise and global coherent. (#4381)
Enable NRVO when no precise and global coherent to avoid extra memcpy created in clang codeGen.
Also propagate precise from the function to named return value.
2022-04-11 15:40:05 -04:00
Chris B dbd8db0e84
Complete builtin types when used as array params (#4379)
* Complete builtin types when used as array params

This is an odd edge case.

C doesn't require array element types to be complete because they decay
to pointers. In HLSL we don't decay to pointers, so we need them to be
complete, otherwise things trip up.

* Fixing code comment

One of these days I'll learn how to write what I mean...
2022-04-08 16:55:06 -05:00
Natalie Chouinard 20fefeb1d0
Update SPIRV-Tools submodule (#4380) 2022-04-07 13:44:20 -04:00
Adam Yang c0676c7ca1
Handling dbg.value pointer case in O1. (#4375) 2022-04-05 12:07:07 -07:00
Natalie Chouinard b1c75bee8a
Update SPIRV-Tools submodule to canary release (#4376) 2022-04-05 12:33:32 -04:00
Natalie Chouinard 7ecebb30ef
[dxil2spv] Fix build warning (#4371)
Address the "Policy CMP0023 is not set: Plain and keyword target_link_libraries signatures cannot be mixed." warning.
2022-04-04 14:03:12 -04:00
Marijn Suijten a447452747
[SPIR-V] Omit BufferBlock on SPIR-V 1.4 (~ Vulkan 1.1) instead of Vulkan 1.2 (#4370)
According to the SPIR-V validator this annotation was last usable on
SPIR-V 1.3:

    fatal error: generated SPIR-V is invalid: 2nd operand of Decorate: operand BufferBlock(3) requires SPIR-V version 1.3 or earlier
        OpDecorate %type_ByteAddressBuffer BufferBlock

    note: please file a bug report on https://github.com/Microsoft/DirectXShaderCompiler/issues with source code if possible

The visitor was originally built to remove/omit it on Vulkan 1.2 and
higher only, but since supporting Vulkan 1.1 with SPIR-V 1.4 (in #4364)
- which conveniently sits inbetween SPIR-V 1.3 and Vulkan 1.2 - the
check must be made more stict and apply from SPIR-V 1.4 universal
onwards.
2022-04-01 14:07:09 -04:00
Natalie Chouinard 68dd2877d7
[SPIR-V] Allow Vulkan 1.1 with SPIR-V 1.4 as a target environment (#4364)
Since we check for the "SPIR-V 1.4 (under Vulkan 1.1 semantics)"
minimum target environment for ray tracing extension use, this change
allows it to be now configured as a target-env via command line options.
Some out of date documentation target environments is also updated,
and improvements are made to version checking to use enums rather
than string comparisons.

Fixes #4313
2022-03-31 16:11:00 -04:00
Jaebaek Seo ad4ebb7d51
[spirv] support signature packing (#4361)
Currently, DXC assigns new locations for each stage variable. When there
are lots of stage variables, the number of locations we use can exceed the
maximum location limit. This commit uses `Component` decoration to pack
signature and reduce the number of locations DXC uses.
2022-03-31 15:38:33 -04:00
Grace Jennings 5b4955e04f
Updating the .NET version from 4.5(deprecated) to 4.8 to build on Windows11 with VS2022 (#4366) 2022-03-31 09:06:00 -07:00
Jaebaek Seo 1ebefa67ef
[spirv] fix source info bug for in-memory source code (#4362)
SPIR-V backend finds the source code by reading the source file,
which does not work when we pass the source code via memory
buffer. This commit adds a fallback for the case.

Fixes #4218
2022-03-30 16:17:42 -04:00
Natalie Chouinard c248a1ee89
[dxil2spv] Add support for dx.op.threadId (#4354)
Translate the dx.op.threadId instruction to a load of a single element
of the SPIR-V BuiltIn GlobalInvocationID.
2022-03-28 16:23:03 -04:00
Xiang Li 2c1b6ec659
remove unused member for db_dxil_inst. (#4355) 2022-03-28 09:06:12 -07:00
Jaebaek Seo 2dc067b561
[spirv] Update SPIRV-Tools and SPIRV-Headers (#4352) 2022-03-25 17:41:26 -04:00
Natalie Chouinard c701ece61c
[dxil2spv] Add initial compute shader support (#4345)
Implement first part of support for a passthrough compute shader.
This iteration translates the HLSL resources used in a simple
passthrough compute shader (ByteAddressBuffer and RWByteAddressBuffer)
to the appropriate SPIR-V module variables. Errors are emitted for
unhandled instructions.
2022-03-24 13:18:12 -04:00
Natalie Chouinard 9f70135012
[dxil2spv] Add error checking to file tests (#4344)
Compare the expected and generated error output for whole file check
tests. For existing tests, these should be empty, but upcoming tests
will check expected errors as we iterate towards passthrough compute
shader support.
2022-03-24 10:01:03 -04:00
Grace Jennings b420332e68
Added a DXC_OUT_REMARKS output kind for display include process (#4336)
* Added a DXC_OUT_REMARKS kind that prints to stdout in dxc.
Moving -Vi and -H displayed include process from warnings to DXC_OUT_REMARKS.

* Adding a Compiler Test to check DXC_OUT_REMARKS output text
2022-03-23 13:28:16 -07:00
Jeff Noyle 90152bd9a7
Pix hull shader debug (#4342)
A couple of minor changes to support PIX shader debugging for hull shaders generated by the 11on12 mapping layer for DXBC originals.

Co-authored-by: Jeff Noyle <jeffno@ntdev.microsoft.com>
2022-03-23 08:51:48 -07:00
Helena Kotas b01569998a
Exclude one more test that is failing on ARM64 (#4343) 2022-03-21 21:42:47 -04:00
Natalie Chouinard 18f88c5382
[spirv] Improve ray tracing capability error (#4335)
When the specific target environment required is exactly
SPV_ENV_VULKAN_1_1_SPIRV_1_4, then make the error message explicitly
note that it is met by Vulkan 1.1 with Spirv 1.4 (rather than simply
requiring Vulkan 1.2).

Fixes #4313
2022-03-21 10:54:59 -04:00
Natalie Chouinard c99f5a540e
[dxil2spv] Add passthrough vertex shader and test (#4337) 2022-03-21 10:47:47 -04:00
Helena Kotas 75fd63f0fb
Add -arm64 argument to hcttest; exclude tests with issues on ARM64 & WARP (#4320)
* Add -arm64 to hcttest; exclude one more test with issues on ARM64 & WARP

* DXC arm64 fixes - testing before pushing to GitHub

* Exclude DenormTertiaryFloatOpTest

* ARM64EC fixes, no parallel for ARM64

* Disable crashing test; exclude only denorm preserve tests with issues
2022-03-18 01:13:02 -04:00
Helena Kotas e38970626d
Remove test output files; update .gitignore (#4333)
- added *.dxo.converted to the list of extensions ignored by git
- renamed 3 test outputs from .fxc to .dxbc (which will make them to be ignored by git)
2022-03-17 13:55:33 -07:00
Natalie Chouinard 495871898e
[dxil2spv] SPIR-V validation and related fixes (#4328)
Add SPIR-V validation after the module is generated, and apply some
fixes required for validation to succeed with a passthrough pixel
shader:
- Add execution mode
- Decorate with SPIR-V Locations
- Refactor some LowerTypeVisitor logic to a util function that is shared with
  dxil2spv
- Remove extra pointerness on stage IO vars now that it is handled by
  the above pass
2022-03-17 15:49:52 -04:00
Tex Riddell 7ffbddada2
Remove HLSL modifiers from basic type cases in ParseCastExpression (#4325)
{s|u}norm and {row|column}_major modifiers shouldn't have been added to
the block of basic types for parsing init-style cast expressions.  When
hitting one of these cases, ParseCXXSimpleTypeSpecifier hits unreachable:
  default:
    llvm_unreachable("Not a simple-type-specifier token!");

Valid uses of these modifiers are parsed elsewhere.  If we hit these
keywords here, they are not a valid expression, so goto tok_default_case
instead, which will produce normal errors instead of the internal error.

While we're at it, update VerifierHelper.py to fix issues, and update tests
to run clean with VerifierHelper.py all *.
2022-03-16 17:17:56 -04:00
Tex Riddell e51701e707
DxilConv: Pad copied IO signature parts (#4330)
DXBC containers from some sources may have signature parts with unaligned sizes, such as from 9on12.

This change pads these signature parts when this is the case to avoid any
problems down the line.
2022-03-16 01:03:16 -04:00