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

3496 Коммитов

Автор SHA1 Сообщение Дата
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
Helena Kotas 0a07209e4c
Minor hcttest.cmd fix - add quotes in if condition in case HLSL_TAEF_DIR is empty (#4300) 2022-02-25 17:09:58 -08:00
Chris B 4e3755aa7b
Extending QuadAnyAll test for MS and AS (#4287) 2022-02-25 14:11:43 -06:00
Tex Riddell 6f766ed828
New HLSL_AGILITYSDK_DIR and HLSLHost dependency copying help. (#4297)
Use environment variable HLSL_AGILITYSDK_DIR which you can point to
extracted contents of an AgilitySDK.
Automatically copy binaries to appropriate location when set.

Look for MinTe binary set from TAEF.  If found, set a local TAEF binary
location.
If this is set when running execution tests, copy MinTe there, and if the
HLSL_AGILITYSDK_DIR was set, also copy agility SDK binaries under the
.\D3D12\ subdir there, so the test can automatically pick it up.

Add hctbins.cmd to copy extra bins necessary for running things out of
the ...\bin or ...\test directories such as HLSLHost.exe.  This includes
AgilitySDK bins if set.

Update FindTAEF.cmake to set binary dir based on HLSL_TAEF_DIR

Since we don't actually support a single project building to multiple
architectures, we look for te.exe in x86 OR x64 subdir.
Whichever one is set in hctstart.cmd should be the one that will be used.
2022-02-24 14:04:52 -08:00
Tex Riddell 9668399976
ExecutionTest: Autofill Path/Version for AgilitySDK (#4277)
Default D3D12SDKPath to ".\D3D12"
Autodetect version when not specified or "/p:D3DSDKVersion=1"

If D3DSDKVersion specified, fail if it can't use Agility SDK.
2022-02-23 13:41:21 -08:00
Tex Riddell b66846d073
Exec tests: change string entry setting pattern (#4296)
Because the LPCSTR set to shader stages in ShaderOp are used as a key,
the string pointer has to match an entry.  Normally this works because
all strings are added to a string map and the pointer from this is used
for all LPCSTR pointers.

ExecutionTest groups were trying to override the entries by searching each
entry point for the desired name, then setting the stage to the string
pointer of that entry, so the pointer would match.
Another way is to just use insert() on the string map, which is what all
the other code uses (during loading from XML, for instance).

This change adds ShaderOp::GetString() to make it convenient to get the
appropriate string pointer for whatever string you have, so you may simply
set this pointer to the shader stage, without iterating through all shaders,
looking for the matching name.

This adds a check to detect when an entry name is set for a stage, but that
entry name doesn't match any shader in the ShaderOp.

It also updates the code in ExecutionTest to use this pattern instead, so
future tests won't copy the old pattern.

One additional advantage to this pattern is error detection: if you used
the old pattern, you could end up not finding the entry, setting nullptr to
the stage, then what you run might be a different stage than you thought,
without any error or indication otherwise.  Many tests expect the same
results written from different stages, so if the wrong stage produced the
results, the test would not detect this.  Now you will get a failure during
execution in this case.
2022-02-23 11:49:52 -08:00
Tex Riddell 4329ce93df
DxExp: Fix raytracing tier (#4267)
* Define tier 1.1 locally for builds against older SDK
* Disable warning about use of value cast to enum in case.
This is necessary because different SDK headers include or exclude this tier, and we want to match the value either way.
2022-02-22 23:35:44 -08:00
Tex Riddell ec33cbf722
Missing break in CreateHandleFromHeap case caused unwanted shader flags (#4292)
hasWriteableMSAATextures and hasAdvancedTextureOps were being set if you
used CreateHandleFromHeap because of a missing break.
2022-02-22 23:34:19 -08:00
Greg Roth 31ece23b14
Enable Container Builder on *nix (#4244)
This never got enabled in dxcapi.cpp in spite of all the code to support
it being in place. This enables the creation of the interface and
enables the tests that were disabled for want of it.

As an incidental, correctly defines the REGDB_E_CLASSNOTREG which made
the lack of this interface on Linux hard to diagnose.
2022-02-22 11:00:55 -08:00
Tex Riddell 152a76216c
ShaderOpTest: Fixes for sampler, HLSLHost, and texture init (#4282)
- Skip Sampler for gpuHandle
- Key m_DescriptorData map off descriptor name instead of resource name (potential many-to-one for descriptor to resource).
- Fix uninitialized structs used in SetupRenderTarget
- Fix explicit Viewport detection to use > 0 (since uninit might end up with some large negative number, preventing all PS invocations in a way that wouldn't trigger any debug layer spew - hard to track down).  This check had caused a long-standing regression in HLSLHost.
- Fix Sampler enum naming convention to be consistent with other string names for XML.
- Fix issue preventing UINT32 values from being parsed from XML (making it more difficult to fill in texture data, like 8-bit unorm formats).
2022-02-22 10:27:07 -08:00
Tex Riddell bd14c14a50
Fix extra case in root signature parsing (#4280)
KW(CBV_SRV_UAV_HEAP_DIRECTLY_INDEXED) was included when parsing keywords
starting with 'S' as well as 'C'.  It should not have been included under
'S'.  This change is minor cleanup, since it would never match that string
in this location.  So this makes no behavioral change.
2022-02-22 10:05:26 -08:00
Tex Riddell 3889cc3fdf
[linux] Fix incorrect REGDB_E_CLASSNOTREG value (#4241)
REGDB_E_CLASSNOTREG was defined to 1, which is a success code for HRESULT.
This value is returned when trying to create an unsupported object with DxcCreateInstance.
Since create appears to have succeeded, it would lead to a deref of a null pointer - segfault.
2022-02-22 09:33:51 -08:00
Tex Riddell 162de5b019
Uniquely detect low 16-bit usage properly for tbuffer (#4250)
Uniquely detect low 16-bit usage properly for tbuffer, while detecting the case where full 32-bits are used that map to two 16-bit fields, requiring both fields to be marked.
2022-02-22 09:33:24 -08:00
Tex Riddell 868f339d88
Return empty string from CGDebugInfo::getCurrentDirname() (#4265)
Include handler is only meant to handle file requests. However, if DebugCompilationDir is not set, CGDebugInfo::getCurrentDirname() will try to get the current working directory, and on (*nix) it will expand $PWD, then perform status() on that. With a virtualized file system backed only by an include handler, you can't get thet status of files or directories, so failing the directory detection, it will attempt to open the file, which results in a call to get the file contents of the current working directory from the include handler.

The approach here is just to return DebugCompilationDir on HLSL, even if empty.

This prevents it from trying to fill it in automatically, cutting
off the path normally causing this problem.
2022-02-22 09:27:55 -08:00
Natalie Chouinard 3fcd83e43b
[spirv] Relax SV_Position type requirements (#4275)
A valid vertex shader output variable with SV_Position semantics may be
constructed from any HLSL BuiltinType that translates to a 32-bit
floating point type in the SPIR-V backend, so relax the requirements to
allow the use of additonal types (such as half4) when
-enable-16bit-types is false.

Fixes #4262
2022-02-22 11:58:44 -05:00
Tex Riddell 3f8e22cec1
Only set ResMayNotAlias flag when on DXIL 1.7 (#4276)
Avoid failure in existing driver on unrecognized raw flags.
2022-02-19 01:23:29 -08:00
Tex Riddell 768255cad2
ShaderOpTest: Add sampler parsing and desc support (#4281) 2022-02-18 23:00:11 -08:00
Tex Riddell 71b195856a
ShaderOpTest: Optionally create root signature from shader instead of XML (#4278)
This change allows you to supply a root signature with a shader using the [RootSignature("...")] attribute, and will use that if no root signature was defined in the XML.
It will use the root signature from the first shader it encounters that has one.
2022-02-18 18:12:41 -08:00
Tex Riddell 9900c4d051
ShaderOpTest: Use DXC to compile root signature instead of FXC (#4279) 2022-02-18 17:59:50 -08:00
Adam Yang 2ec23bcaea
Delete dbg.declare in scopes where the alloca is unused (#4272) 2022-02-17 16:59:44 -08:00
Natalie Chouinard 8a2c92b5a9
[spirv] Replace some uses of std::string (#4274)
Replace uses of std::string with llvm::StringRef in SpirvBuilder.
2022-02-17 13:24:35 -05:00
Natalie Chouinard 2d5f1863a6
[dxil2spv] Add stage IO variables (#4271) 2022-02-17 10:10:00 -05:00
Chris B a4b864751c
[SM6.7] QuadAny/All execution test (1/2) (#4264)
* [SM6.7] QuadAny/All execution test (1/2)

This adds a first set of execution tests for QuadAny and QuadAll to test
compute, mesh, and amplification shaders. A separate execution test will
be coming for pixel shaders.

* Fixing QuadAny/All fallback expansion

The initial implementation missed one of the required bitwise
operations.

* Updating test case to reduce scope to compute only

This gets the test passing for SM 6.0 using the fallback implementation.

* Fixing mangled extra code
2022-02-16 22:25:44 -06:00
Xiang Li e98f8cbc8b
Support resource array in UpdateStructTypeForLegacyLayout on lib profile. (#4266) 2022-02-16 10:33:47 -08:00