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

3519 Коммитов

Автор SHA1 Сообщение Дата
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
Greg Roth 14bc8dab53
Implement Integer Sampling (#4329)
Add support for integer sampling as part of advanced texture ops in
Shader Model 6.7. This includes adding static border colors and allowing
integer resource types to be used by all Sample* operations through
Sema, Dxil generation, and validation when 6.7 is available.

Adds root signature compilation and filecheck testing.
2022-03-15 19:05:00 -07:00
Helena Kotas 46d52c0a38
Remove LLVMHLSL dependency from IPO and ScalarOpts (#4326)
It causes circular target dependency when embedding the DXC into
an internal project and does not seem like it is needed (builds
fine without it).
2022-03-14 18:15:10 -07:00
Natalie Chouinard c29a0c7384
[dxil2spv] Implement simple entry function creation (#4323)
Translate a DXIL entry function to a SPIR-V entry function. This is
currently only supporting the few types and instructions needed to
create the entry function for a simple passthrough pixel shader.
2022-03-14 09:12:21 -04:00
Joshua Batista a67e6e8c46
User/jbatista/pass correct enumkind00 (#4324)
* swapped filter enumkind for comparison_func
2022-03-11 18:00:00 -08:00
Natalie Chouinard aa26bfd052
[dxil2spv] Read file directly into llvm::MemoryBuffer (#4304)
Read DXIL file directly into llvm::MemoryBuffer rather than through an
IDxcBlobEncoding. This also allows support for supplying file by STDIN
(not yet with dedicated CLI).

Also clean up some CMake LLVM dependencies.
2022-03-10 19:53:15 -05:00
Lukas Hermanns 54924ce517
Fix typo: 'vulkan1.3' was linked to SPV_ENV_UNIVERSAL_1_6 (#4243) 2022-03-10 15:09:48 -05:00
Jaebaek Seo 9dc0937519
[spirv] Update SPIRV-Tools and SPIRV-Headers submodules (#4322) 2022-03-10 15:09:17 -05:00
Chris B 77945a157e
Make external sema source handle type completion (#4317)
* Make external sema source handle type completion

Prior to this change the HLSL built in types are inserted into the AST
during initialization as complete types missing their methods. The
method implementations are then inserted during parsing when handling
declarators and parameter declarations of the built in types.

This method of lazy expansion does not work with HLSL templates because
template declarators in dependent contexts are not handled by the
parser, so they bypass the code path that generates method definitions
(see #4315).

This change alters how we lazy initialize types. Instead of
lazy-initializing in parsing, this change lazy initializes when the
type is required to be complete. This is accomplished by creating the
built in type objects as incomplete decls, and adding an override for
`CompleteType` to the `HLSLExternalSource`.

This change simplifies our code because we can use the type's
`IsCompleteDefinition` flag to track types that have been completed
instead of our own bitmask system.

Fixes #4315

* Nest second isCompleteDefinition check

This will trigger in most but not all cases, so I can nest it under the
condition that triggers it to have a potentially different result.
2022-03-07 22:26:19 -06:00
Helena Kotas 160c0336ec
Fix ARM64 exclusion of CodeGenFloatingPointEnvironment test (#4316) 2022-03-07 14:03:47 -08:00
Xiang Li c18791c509
Add warning for 'using' keyword before hlsl2021. (#4312) 2022-03-07 01:10:10 -08:00
Tex Riddell 89f333116e
Fix WARP/Basic Display Adapter detection for more scenarios. (#4309) 2022-03-04 09:10:41 -08:00
Helena Kotas 407f8ebf8d
Disable tests that have issues on ARM64 (#4308)
We need to investigate what is going on.
2022-03-03 17:19:36 -08:00
Chris B fb873d0a14
Clean up debug preprocessor macros (#4305)
* Clean up debug preprocessor macros

This change removes the `DBG` macro value in favor of `NDEBUG`, and
also converts many uses of `_DEBUG` with `NDEBUG`.

_DEBUG is set by MSVC when debug information generation is enabled.
NDEBUG is set by CMake debug configurations and by LLVM on all
configurations when `LLVM_ENABLE_ASSERTIONS` is set.

Aligning with LLVM's NDEBUG usage allows a consistent pattern
throughout the codebase.

* Address PR feedback
2022-03-02 14:55:24 -06:00
Tex Riddell 88b7e079ec
DxilValueCache::MayBranchTo: handle phi from switch properly (#4306)
Without this change, during DxilValueCache::ProcessAndSimplify_PHI,
MayBranchTo will return false for switch. If all but one case or default
block are collapsed into the switch's successor's phi (by simplifycfg), this
causes DxilValueCache to assume the remaining branch is the only predecessor
to the phi. If the corresponding incoming value is constant, DxilValueCache
will assume that's the only possible value, replacing the phi with the
constant.

With the change, MayBranchTo will return false only when a switch with a
constant condition would branch to a different successor.
2022-03-02 09:42:26 -08:00
Xiang Li 2d7215de41
Enable 'using' keyword. (#4302)
Enable 'using' keyword to help move hlsl intrinsic inside hlsl namespace.

This is just reenable existing c++ feature by remove check on HLSL.
2022-02-28 21:59:27 -08:00
Xiang Li 811f8784d8
Replace Type::getVectorNumElements with FixedVectorType::getNumElements. (#4301) 2022-02-28 15:43:39 -08:00
Greg Roth 91d9b64fd2
Fix AtomicsShared64 ExecutionTest (#4303)
The test was assigning a pixel shader that didn't exist due to the
conversion of mistaken code that was harmless in the previous form, but
results in an error message in the new.
2022-02-28 14:55:35 -08:00
Greg Roth ccdc39fee0
ExecutionTest for SampleCmpLevel (#4286)
A mipmapped texture containing the value of LOD at each location in each
level is used to sample at each level using SampleCmpLevel and confirm
that the correct level is used for the comparison.

Additionally, the result of SampleCmpLevelZero is compared to the
SampleCmpLevel equivalent
2022-02-28 13:55:47 -08:00
Greg Roth c44a4a9ff9
ExecutionTest Programmable Sample Offsets (#4285)
A texture containing an encoded value representing the X,Y location is
used to retrieve values at various samples using the 8 methods that
newly allow programmable values. Each result is compared to what is
expected based on the given coords and offsets.
2022-02-25 20:00:49 -08:00