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

3647 Коммитов

Автор SHA1 Сообщение Дата
Xiang Li e98f8cbc8b
Support resource array in UpdateStructTypeForLegacyLayout on lib profile. (#4266) 2022-02-16 10:33:47 -08:00
Tex Riddell 851d1fbed6
Enable Agility SDK from execution test arguments. (#4269)
Don't free D3D12 module just after setting modes that will be lost if unloaded.
2022-02-16 09:40:21 -08:00
Tex Riddell 037b47ca4a
Highest SM need not be gated by SDk headers. (#4268)
SM check will fail for too-high SM that a test requires if the device doesn't support it.  No need ot gate the highest recognized SM based on the SDK header version.
2022-02-16 09:39:00 -08:00
Jaebaek Seo 2322f53773
[spirv] change __spirv definition to __spirv__ (#4270)
We implicitly defined `__spirv` when SPIR-V code gen is enabled and
`-spirv` command line option is given. This commit changes it to
__spirv__.
2022-02-16 12:29:38 -05:00
Helena Kotas 9f60094d90
User Windows SDK version from VSDevCmd for all platforms (#4259) 2022-02-15 14:07:46 -08:00
Xiang Li d9a790e252
WriteSemanticDefines before clang codeGen to update codeGen option (#4261)
* WriteSemanticDefines before clang codeGen to update codeGen option based on HLSLOptimizationToggles.
2022-02-15 13:29:13 -08:00
Tex Riddell b338314f6e
Implement Shader Model 6.7 (#4260)
Shader Model 6.7 is still a work in progress.
Thanks to multiple contributors at Microsoft for this work.

Added support for additional advanced texture operations, including:
Raw Gather, Programmable Offsets, SampleCmpLevel, and RWTexture2DMSAA.

Added new QuadAny/QuadAll intrinsics to help with writing quad-uniform control flow.

Added [WaveOpsIncludeHelperLanes] pixel shader entry attribute, changing the
behavior of wave ops to treat helper lanes as active lanes.
2022-02-15 11:38:42 -08:00
Greg Fischer 74a1543493
[spirv] Generate correct Shader.DebugInfo for runtime arrays. (#4258)
This is a common construct for bindless shaders.
2022-02-15 11:14:18 -05:00
Greg Roth 75224d820f
Rename UTF16 to Wide (#4242)
In many cases, systems where wchar was represented as 32-bits were being
referred to by types and variables affixed with "utf16" or similar. To
avoid confusion, this renames all such places to "wide".

In a few cases, the conversion were explicitly 16-bit, which wasn't the
intent.
2022-02-14 15:24:40 -05:00
Natalie Chouinard 20ccd72e80
[spirv] Append template params to UserTypeGOOGLE (#4248) 2022-02-14 15:00:01 -05:00
Natalie Chouinard 6633191b0b
[spirv] Update SPIRV-Tools and SPIRV-Headers submodules (#4253) 2022-02-14 09:58:43 -05:00
Jeff Noyle 7f7278b4e2
PIX: avoid crash on enumerated types without int base type (#4254)
HLSL 2017's enum and enum class compile to a type without an integer base.
So in this case we'll call it an unknown type for the purposes of PIX debug instrumentation.
Further work will be required to return the enumerants to PIX and to record an actual value during shader debug instrumentation.
2022-02-13 19:24:23 -08:00
Jeff Noyle d66bdf94c2
PIX: Shader debugging instrumentation for HS+DS (#4251)
* CP

* PIX: Debug instrumentation for HS/DS

* Tests

Co-authored-by: Jeff Noyle <jeffno@ntdev.microsoft.com>
2022-02-11 17:00:21 -08:00
Chris B cb5bb213d8
Refactor HLSLVersion to enum (#4238)
* Refactor HLSLVersion to enum

This change converts HLSLVersion to an enum type `hlsl::LangStd`. Most
of the change is a mechanical appending `hlsl::LangStd::v` to the
integers we previously compared for version checks.

Additionally this change does the following:
* Adds a parseHLSLVersion function to unify parsing code
* Parsing code is converted to an llvm::StringSwitch over the possible
values instead of converting to integer
* Added enum value for `vLatest` so that changing the latest version is
done in one place
* Added enum value for `v202x` which parses from 202x to allow new
language features a place to land

* Updates based on PR feedback
2022-02-10 20:41:55 -06:00
Xiang Li 4452103355
Change getPassName return type to StringRef. (#4247) 2022-02-10 14:14:43 -08:00
Adam Yang 8348ff8d9e
Taught DxilEraseDeadRegion to handle more general loops. (#4246) 2022-02-09 18:13:27 -08:00
Tex Riddell 56e05cd55e
Fix bug with HLSL case-insensitive attribute parsing (#4014)
During parsing, some properties about attributes are determined by
matching the identifier used in the source with the attribute spelling
in Attr.td. The assumption here was that attributes are all
case-sensitive.  But HLSL attributes are not case-sensitive, and even
though code that matches these attributes to kind and determines
whether the attribute is valid has been adjusted to handle
case-insensitivity, the code that looks up properties had not.

One impact was that identifier arguments were not being recognized and
stored in the attributes properly (attributeHasIdentifierArg).

This change makes normalizeAttrName use lower() to force lowercase for
the incoming attribute name before it gets used in the StringSwitch.
normalizeAttrName now must return std::string instead of StringRef
since it's potentially changing the string, not just slicing it.

It would seem better to use the AttributeList::Kind in a switch instead
of matching the string used, but that would be a much more significant
change.

Note: for attributes to work now, all spellings for valid attributes
must be lower case in Attr.td (fortunately they currently are).
2022-02-09 17:19:36 -08:00
Tex Riddell 87945629df
Fix ReplaceMemcpy IR corruption on constant user replacement. (#4245)
When replacing constant users, those users could be in functions other than the one being worked on.
The code would happily replace uses of the constant with instructions that weren't in the same function.
This would lead to bizarre consequences due to corrupt IR down the line.
This change prevents that from happenning.
2022-02-09 12:01:13 -08:00
Grace Jennings 979cc4a276
Support -setprivate, -setrootsignature, and -Qstrip_priv to compile API (#4230)
* Adding /setprivate, /setrootsignature, and /Qstrip_priv to compile API calls

* Adding setprivate to initial container serialization, change warning to error

* Removed unused variable

* Adding private data blob last, because no gaurantee of aligned size

* Add error messages for conflicting private options
2022-02-08 13:36:55 -08:00
Tex Riddell 0c49f28ebd
Allow unaligned private data size, by keeping it at end of container. (#4239)
Since all other blob parts are expected to be aligned, make sure we always add private data at the end of the container.
Update DxcContainerBuilder to keep private data at the end as well.
2022-02-08 12:14:41 -08:00
Tex Riddell 9d03a00fd7
Fix DxilProgramSignature size alignment. (#4237)
- Maintain compatibility for validator version < 1.7.
- DxilContainerWriter_impl verifies size alignment for all parts, unless created with bUnaligned=true, used for backward compatibility.
- DxilValidation uses NewProgramSignatureWriter(), so bUnaligned is based on validator version in module.
2022-02-07 15:41:54 -08:00
Chris B c95c076f52
Pass compiler options to preprocessor (#4234)
* Pass compiler options to preprocessor

If we don't pass the compiler options to the preprocessor the
preprocessor doesn't get initialized correctly.

Without this change the preprocessor step identifies the shader model
version as 0.0, pipeline stage as invalid, and language version as the
default.

* Remove arugment duplication
2022-02-07 16:08:01 -06:00
David Peixotto 5dc2ef659e
Fix non-deterministic output when overriding semantic defines (#4235) 2022-02-05 20:17:43 -08:00
Tex Riddell 48ab04dba3
Globally disable NRVO for HLSL; Merge resprops for resource return (#4232)
NRVO can drop type attributes not captured into QualType, like glc. HLSL does not need NRVO, and it only poses problems in various areas, so this change turns it off globally for HLSL.

The test required an additional fix to resource return resprops merging, provided by Xiang.

Co-authored-by: Xiang Li <xiagli@microsoft.com>
2022-02-04 15:41:47 -08:00
Xiang Li 662a62a8de
Change type of Sentinel to PHINode since it will be PHINode. (#4228) 2022-02-03 13:35:18 -08:00
Natalie Chouinard e4cf4867f7
[dxil2spv] Add CompilerInstance object (#4229)
Use CompilerInstance for managing diagnostics.
2022-02-03 15:59:10 -05:00
Jeff Noyle 86fc60a7fb
PIX: return more info from shader-access-tracking (#4224)
These changes add a couple of new fields to the shader-access-tracking pass. The new fields are the shader kind and the instruction ordinal (from the dxil-annotate-with-virtual-regs pass). This will allow PIX to report richer feedback to the user about out-of-bounds access.
This revision adds out-of-bounds checking for SM6.6-style dynamic resources and samplers, a feature heretofore missing in PIX.
Fortunately, there was a bit spare (InstructionOrdinalndicator) that allows PIX to detect the new fields and thereby continue to operate with older versions of dxcompiler, a frequent customer scenario.
2022-02-02 13:22:05 -08:00
Jaebaek Seo 13a9c7de74
[spirv] add predefined macro '__spirv' (#4225) 2022-02-02 10:47:48 -05:00
Xiang Li 2d23076f26
Allow HLSLOptimizationToggles to control lifetime marker. (#4220)
* Allow HLSLOptimizationToggles to control lifetime marker.
2022-02-01 14:17:25 -08:00
Tex Riddell 6fdea4bdf8
Renormalize line endings to lf in index. (#4223)
Various files were committed with mixed line endings.  This change renormalizes them to our settings.
2022-02-01 13:55:43 -08:00
Natalie Chouinard c3a61b1cd3
[dxil2spv] Add initial testing (#4222)
Add whole file testing for dxil2spv, starting with a simple passthrough
pixel shader. dxil2spv does not yet generate complete output for this
sample, but adding testing now will help reviewing iterations.
2022-02-01 16:01:15 -05:00
Natalie Chouinard e3da12e19d
[dxil2spv] Construct minimal SPIR-V module (#4216)
Modify SpirvBuilder to allow unset astContext, because astContext is
unavilable when translating from DXIL. Initialize a SpirvContext and
SpirvBuilder to generate a basic module, and output as disassembled
SPIR-V to STDOUT.
2022-02-01 11:53:52 -05:00
Xiang Li 392d5b5f3f
Merge resource props for global resource. (#4211)
* Merge resource props for global resource.
2022-01-31 17:23:06 -08:00
Greg Roth 9263ff4b56
Correct validation error for col/row of storeoutput (#4214)
The validation error was missing the arguments that gave important
information on the problem.
2022-01-28 11:24:50 -08:00
Natalie Chouinard 57d4d2b8f1
[dxil2spv] Add basic dxil2spv CI test (#4209) 2022-01-28 11:54:52 -05:00
Jaebaek Seo d996e8b339
Fix build failure for Linux clang 13.0.0-9+build1 (#4213) 2022-01-28 11:44:48 -05:00
Jeff Noyle ba2069d67a
PIX: Handle zeroInitializer for SM6.6 resource handles. (#4210)
Under -Od, a resource handle (passed to a function?) can be zero-initialized.
2022-01-27 12:10:50 -08:00
Natalie Chouinard c45db48d56
Add initial dxil2spv executable (#4199)
Parses files containing DXIL (IR or bitcode) to an LLVM module.
2022-01-26 14:55:19 -05:00
Grace Jennings 796ddc43dc
FixIt for HLSL 2021 logical operations && and || (#4202)
* Adding fixit for HLSL2021 logcal operators

* Adding operation specific error mesage
2022-01-26 09:52:44 -08:00
Jaebaek Seo c3b5a62337
[spirv] propagate Volatile semantics for raytracing interface vars (#4207)
Based on Vulkan spec

> VUID-StandaloneSpirv-VulkanMemoryModel-04678
If the VulkanMemoryModel capability is not declared, the Volatile
decoration must be used on any variable declaration that includes
one of the SMIDNV, WarpIDNV, SubgroupSize, SubgroupLocalInvocationId,
SubgroupEqMask, SubgroupGeMask, SubgroupGtMask, SubgroupLeMask, or
SubgroupLtMask BuiltIn decorations when used in the ray generation,
closest hit, miss, intersection, or callable shaders, or with the
RayTmaxKHR Builtin decoration when used in an intersection shader

> VUID-StandaloneSpirv-VulkanMemoryModel-04679
If the VulkanMemoryModel capability is declared, the OpLoad
instruction must use the Volatile memory semantics when it accesses
into any variable that includes one of the SMIDNV, WarpIDNV,
SubgroupSize, SubgroupLocalInvocationId, SubgroupEqMask,
SubgroupGeMask, SubgroupGtMask, SubgroupLeMask, or SubgroupLtMask
BuiltIn decorations when used in the ray generation, closest hit,
miss, intersection, or callable shaders, or with the RayTmaxKHR
Builtin decoration when used in an intersection shader

We have to propagate the volatile semantics based on the spec. Since
adding Volatile decoration to interfaces is allowed in Vulkan 1.3 or
above, we simply add Volatile decoration for such interfaces. If it is
Vulkan 1.2 or earlier, we have to set the Volatile for OpLoad
instruction, which need the VulkanMemoryModel capability. In addition,
since Vulkan 1.1 or earlier does not have the VulkanMemoryModel
capability in the core spec, we use SPV_KHR_vulkan_memory_model.
2022-01-25 19:00:41 -05:00
Natalie Chouinard d7cb516b94
[SPIR-V] Handle storage buffer interfaces in structs (#4188)
This change modifies the RemoveBufferBlockVisitor to recurse through nested pointers to transform the storage class of inner pointers where required, as well as the fields of structs. Some uses arrays are handled by hasStorageBufferInterfaceType, but this PR leaves as a TODO further verification of the handling of of other composite types.

Fixes #4185, #4187
2022-01-25 13:18:57 -05:00
Jaebaek Seo 85947a043e
[spirv] add documentation for inline SPIR-V (#4201) 2022-01-25 12:24:11 -05:00
Adam Yang dc5eac8d0d
Remove redundant dbg.value instructions (#4182) 2022-01-24 20:22:55 -08:00
Tex Riddell 6943738700
Fix OOB index when propagating precise through GEP (#4203)
This fixes the OOB indexing by ending the loop early if GEP is deeper than the index list being matched.

Libraries with vectors, and intrnisics that operate on aggregate PTRs are not handled properly for precise propagation.

Some potential over/under marking is partially fixed by additional cases in PropagateOnPointerUsers:
  - recurse GEP and Bitcast
  - skip llvm intrinsics like lifetime

There's still some question as to how much we should really be marking precise (at function boundaries like TraceRay, for instance).

Basically, there's more to be done to improve precise propagation, potentially requiring a rewrite in the future.
But this change should improve things for now, and prevent a crash.
2022-01-21 19:31:03 -08:00
Jaebaek Seo 8c6767e6d4
[spirv] support [[vk::ext_decorate_id]] attribute (#4194)
As a part of HLSL version of GL_EXT_spirv_intrinsics, this commit adds
vk::ext_decorate_id attribute.

Related to #3919
2022-01-21 14:09:32 -05:00
Jaebaek Seo 29874c9247
[spirv] support vk::ext_execution_mode_id(..) (#4190)
As a part of HLSL version of GL_EXT_spirv_intrinsics, this commit adds
`vk::ext_execution_mode_id(..)` intrinsic function. In addition, it allows users
to enable capabilites and extensions via `vk::ext_execution_mode[_id](..)`
using `[[vk::ext_capability(..)]]` and `[[vk::ext_extension(..)]]`.

Related to #3919
2022-01-21 14:08:45 -05:00
Jaebaek Seo 0d338ee974
[spirv] support bindless array of ConstantBuffer (#4200) 2022-01-21 14:07:25 -05:00
Greg Roth 437ae1e5b6
Re-enable a swath of DXIL tests for *nix builds (#3888)
These were disabled at a point that the DXC CI didn't reject builds for
failing on Linux, now that they do, we can enable these tests sure in
the knowledge that any changes to them that break on Linux will be
detected and fixed quickly

Fixed *nix error code return. The previous caused an infinite loop of retries.
This definition more accurately identifies the error that has occurred as not
benefiting from repeated attempts

Skip tests and filechecker elements that entirely depend on reflection or
linker interfaces that aren't implemented on *nix yet.

Correct capitalization in a few places to satisfy a case-sensitive filesystem

Detect directories from test include handler. *nix virtual filesystem will try to
load the file using the include handler when performing stat() on a directory.
The test include handler is pretty basic and would provide the next file, leaving
it without a file to offer when the real include came along.
By detecting a name that looks like a dir and returning failure, it
correctly indicates that the file isn't found by the handler and saves
the virtual file for when its needed.

Don't mark non-debug builds as such. The DEBUG define determines which
tests get run. Some of which depend on consistencies that can only be relied
upon in debug builds. So DEBUG is disabled for all non-debug builds.

Correct free of new() memory. Incidental regex allocations were changed for
HLSL to use the global new() operator, but were still freed using the standard
free(), but replacing the default free() with regex_free() allows the default new()
operator to be paired with the default delete() operator

Correct misnamed test flag. The *nix flag was mistakenly called InputFile instead
of InputPath. By renaming it, the ManualFile test can target a specific HLSL file.

Fix misused ArrayRef in legacy GV replacement. The replacement of the GV with
the legacy form used in libraries collected the arguments into an arrayref without
an array to ref, which caused garbage in release builds. Also moved to using end
vars for loops where the elements can get deleted during the loop.

Fix *nix conversion to utf8. When an unknown codepage is found, it tries to convert
to utf16, but that isn't' actually helpful for *nix for a shader codepage derived from
the BOM, which is correctly identified as utf32
2022-01-20 13:53:47 -08:00
Minmin Gong 2bd9843e95
Fix frequent warnings on gcc and clang (#4175) 2022-01-20 13:43:05 -08:00
Adam Yang e9378896be
Fixed SlotTracker slowness bug (#4197) 2022-01-20 12:17:49 -08:00