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

417 Коммитов

Автор SHA1 Сообщение Дата
Tex Riddell 6244ab8337
Validator/Dxil version error improvements (#3623)
- Move validator/dxil version checks up-front
  These should fail first rather than side effects of trying to validate
  details of a version we don't support.
- Improve message for unsupported validator or dxil version
  These errors are most likely if compiling separately from validation
  and failing to override the validator version properly, or running on
  an external validator that doesn't support a newer dxil.
- Use dxil version from metadata for DxilModule when loading,
  rather than just setting it to minimum based on shader model.
- Remove TODO from validator messages that shouldn't be there
2021-03-25 14:03:31 -07:00
Tex Riddell de00b014ac
Fix const error check for object subscript operator (#3580) 2021-03-17 11:40:48 -07:00
Helena Kotas 259ce00a78
Use D3D12 headers from the same Windows 10 SDK version as cmake is using (#3586)
* Use D3D12 headers from the same Windows 10 SDK version as cmake is using (cmake variable CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION)

* For ARM64EC builds detect SDK version from VSDevCmd environment variable instead of a fixed version in hctbuild.cmd

* Add option -show-cmake-log to hctbuild and enable it in AppVeyor
2021-03-16 09:15:03 -07:00
Adam Yang 95850daf8f
Made -Zs the flag for slim PDB. Added -Qpdb_in_private. (#3541) 2021-03-09 19:06:52 -08:00
Tex Riddell a48ae7e097
Update version to 1.6.2104 (#3534) 2021-03-03 16:56:15 -08:00
Greg Roth 3bd5f9ccfa
Errors on non-immediate load/gather offsets (#3283)
Gather operations that take four separate offsets are meant to allow for
programmable, non-immediate values. This removes them from the immediate
and range validations by giving the immediate versions their own opcodes
For these intrinsics and loads, errors are generated when offsets are non-literal
or out of range. These largely use the slightly altered validation paths that the
sample intrinsics use.

Reword error when texture access offsets are not immediates to be
more all encompassing and grammatical.

Incidentally remove duplicate shaders being used for the validation
test from the old directory while identical copies in the validation
directory went unused. Redirected validation test to the appropriate
copies. This is consistent with the test shader re-org's stated intent

Sample operations have a maximum of 3 args, but gather has a maximum of
two since it always operates on 2D images. So gather operations only
pass in two offset args to the offset validation, which resulted in an
invalid access.

Rather than adding a specialized condition to evade this, just iterate
over the number of elements in the array. For sample it will be 3 and
for gather 2 and it will still check for expected undefined args
appropriately.

For the offset legalization pass, the opcode is used to determine the
start and end of the offset args

Only produce the loop unroll suggestion when within a loop

Base error line on call instruction instead of source of the offset

Sort by location in source when possible and remove duplicates

Adapt tests to verify and match these changes

Fixes #2590
Fixes #2713
2021-03-02 18:42:09 -08:00
Tex Riddell 19360a8fa6
Validate CBuffer size to max of 65536 bytes (#3507) 2021-03-02 16:34:35 -08:00
Greg Roth 5fbaf73466
Error for groupshared outside of compute (#3472)
groupshared variables shouldn't be allowed outside of compute and
compute-like shaders. This adds a validation error when such
variables are used.

Add shader mask where groupshared are used

Correct several tests that used groupshared incorrectly

Incidental fix to atomics tests where the special case initializations
might have allowed the threads that failed to write to proceed
before the write took place and read the improperly initialized values

Changed up the assignments to avoid write collisions and be more
readable

Fixes #2603, #2677
2021-02-24 15:22:29 -08:00
Vishal Sharma 6fd578cff4
Fix crash in refract intrinsic lowering (#3498) 2021-02-23 16:09:49 -08:00
Xiang Li b8c8f1f1d9
Fix dup name. (#3492) 2021-02-23 12:43:14 -08:00
Helena Kotas e2e2636930
Update version to 1.6.2102 (#3466) 2021-02-16 12:55:00 -08:00
Adam Yang 01135442bb
Fixed the parameter for QuadReadLaneAt incorrectly being const (#3421) 2021-02-01 15:44:12 -08:00
Xiang Li 48a661e490
Remove DxilCondenseResourcesPass. (#3386) 2021-01-22 23:49:34 -08:00
Tex Riddell 7c9e487afd
Implement IsHelperLane() (#3382) 2021-01-22 12:45:18 -08:00
Xiang Li 797d4b8adc
Mutate resource to handle for shader model 6.6+. (#3374)
* Mutate resource to handle for sm_6_6+.

* Use bitcast to save global symbol and HLSL type for DxilResourceBase.
2021-01-21 17:16:06 -08:00
Adam Yang 2b8ef5b57e
Removed source from debug module. Support slim PDB. (#3348) 2021-01-20 12:25:28 -08:00
Helena Kotas 87b11c2e05
Disable LLVMBuild.txt dependencies and DummyConfigureOutput writing for official builds (#3319) 2020-12-14 20:26:29 -08:00
Vishal Sharma b0820241c1
Update validation rule info in hctdb.py (#3311) 2020-12-10 17:27:07 -08:00
Helena Kotas ef84d9e045
Disable voice in build script by default (#3307) 2020-12-07 17:06:15 -08:00
Helena Kotas 0eb2aa1d14
Update version to 1.6.2012 (#3308) 2020-12-07 16:56:30 -08:00
Greg Roth d574d27c1f
Implement Shader Model 6.6 (#3293)
This is the work of many contributors from Microsoft and our partners.
Thank you all!

Add support for 64-bit atomics, compute shader derivatives, dynamic
resources (from heap), 8-bit Packed Operations, and Wave Size.
All of these require compiling with 6_6 targets with just a few
exceptions. Each of these features include unittests and Execution
tests.

64-bit atomics add 64-bit variants of all Interlocked* intrinsic
operations. This involves changing some of the code that matches
intrinsic overloads to call instructions. Also adds a few float
intrinsics for compare and exchange interlocked ops which are available
for all shader models 6.0 and up.

Compute shader derivatives adds dd[x|y], CalculateLevelOfDetail, and
Sample operations that require derivatives to compute. QuadRead
operations have been allowed in compute from 6.0+ and tests are added
for them here.

Dynamic resources introduce global arrays that represent the resource
and sampler heaps that can be indexed without requiring root signature
representations. This involves a new way of creating and annotating
resource handles.

8-bit Packed operations introduces a set of intrinsics to pack and
unpack 8-bit values into and out of new 32-bit unsigned types that can
be trivially converted to and from uints.

WaveSize introduces a shader attribute that indicates what size the
shader depends on the wave being. If the runtime has a different wave
size, trying to create a pipeline with this size will fail.
2020-12-02 21:10:44 -08:00
Ehsan d7bb9ee170
Introduce the implicit 'vk' namespace (#3133)
* [spirv] Introduce the implicit 'vk' namespace

If any of these are used for DXIL code generation, the compiler will
report an error about the unknown "vk" namespace.

* [spirv] Introduce vk::ReadClock intrinsic.

The following Vulkan specific intrinsic functions are added:

```hlsl
uint64_t vk::ReadClock(in uint32 scope);
```

Also the following Vulkan-specific implicit constants are added:

```
vk::CrossDeviceScope; // defined as uint 0
vk::DeviceScope       // defined as uint 1
vk::WorkgroupScope    // defined as uint 2
vk::SubgroupScope     // defined as uint 3
vk::InvocationScope   // defined as uint 4
vk::QueueFamilyScope  // defined as uint 5
```

Sample usage looks as follows:

```hlsl
uint64_t clock = vk::ReadClock(vk::WorkgroupScope);
```

If any of these are used for DXIL code generation, the compiler will
report an error about the unknown "vk" namespace.

* [spirv] Add documentation.

* Address code review comments.

* Test: Validate vk namespace is not allowed for dxil.

* Fix usage of DXASSERT.

* Move ValidateVkNamespaceNotAllowed test to HlslFileCheck.
2020-12-01 14:04:14 -06:00
Helena Kotas f1f60648df
Fix hctbuild to enable passing of quoted values and values with parenthesis (#3256) 2020-11-12 14:29:18 -08:00
Helena Kotas 6008113f60
Support for ARM64EC and custom cmake (#3245)
* Merged PR 5375287: Support for ARM64EC and custom cmake

* Fix linux build break

* Change argument name to -dxc-cmake
2020-11-06 14:46:44 -08:00
Adam Yang 3be547b67c
Fixing store undef later in the compilation. (#3212) 2020-10-20 21:15:49 -07:00
Adam Yang d8dec0efd7
Fixed some cases where O0 fails compilation (#3205)
- Fixed value tracking for dxil intrinsics
- Fixed some selects holding on to invalid resource uses
- Fixed some cases where unused globals hold on to invalid resource uses
- Fixed some cases where stores of undefs stick around
2020-10-14 22:41:03 -07:00
Helena Kotas c565b3d20b
Cleanup and minor changes to improve integration with internal projects (#3199)
* Cleanup and minor changes to improve integration with internal projects

Adds -Debug option to hcttest.cmd

* Case insensitive compare for -Debug and -Release flags in hctbuild and hcttest
2020-10-13 16:22:50 -07:00
Helena Kotas 0024844574
Update version to 1.5.2010 (#3185) 2020-10-06 12:29:24 -07:00
Helena Kotas 634a23537d
Remove VS checks that assume Visual Studio is installed on C: drive (#3157)
These checks were there only to provide a nice error message when VS 2019 is not installed but it does not take into account that it can be installed at other locations than the default one. Removing these will still result in an error from cmake if it can't find Visual Studio installed.
2020-09-23 12:02:08 -07:00
Helena Kotas bf5d585492
Enable Visual Studio 2019 build by default (#3138)
This PR is switching the default build of DXC to Visual Studio 2019.
The build script hctbuild.cmd will error when VS2019 is not installed. Use -vs2017 option to build with VS2017.
VS2015 is no longer supported.

Removes cmake version checking from hctstart.cmd
Fixes cmake detection in Visual Studio installations
Fixes DIA SDK lookup - use CMAKE_GENERATOR to detect VS version used and select the corresponding DIA SDK
Use environment variable instead of c:\Program Files
2020-09-17 17:42:08 -07:00
Tex Riddell 8d9e1cbb86
Dxil.dll <= 1.5 compat: Fix RDAT break and validation tests (#3117)
Fix compatibility with released DXIL.dll binaries:
- 1.4: 18362 SDK
- 1.5: GitHub release v1.5.2003

There are expected test failures when run against 1.5 19041 SDK DXIL.dll,
due to later fixes in the GitHub v1.5.2003 release.  Tests that fail by
design on this DLL have a comment added.

Also moved readme text to more discoverable readme.
2020-09-08 13:52:14 -07:00
Adam Yang 0e77209223
Moved unroll to after dxilgen and scalarizer. (#3094) 2020-08-28 09:09:53 -07:00
Greg Roth efc14a6c40
Sundry code cleanups (#3073)
refactor usage of resourceparams to just use RP

create common way of extracting res properties

make getoverloadtype static

so it can be used to determine version
requirements

Disallow literals where not included

Previously, whether an intrinsic parameter type included an entry for
literals or not, a literal was permitted to be cast to it.

By moving up the explicit per-param check to before this cast takes
place, these implicit casts won't be added
2020-08-12 08:16:12 -07:00
Greg Roth 6971d25e1e
Restrict parameters to Interlocked* Intrinsics (#3057)
Because the defined types of Interlocked* Parameters do not restrict
type casting, they can result in late errors that cause crashes due to
reference params with casts that aren't actually respected by dxil
generation.

By constraining the parameters as they should be, instead of crashes, we
get errors.

Fixes #2077
Fixes #2483
2020-07-28 12:56:50 -07:00
Greg Roth 174fb21fa9
Allow double to WaveReadLaneFirst (#3053)
A single character omission made WaveReadLaneFirst lack double support.
This corrects that omission, evading the unneeded validation error and
adds a test that covers various types for various wave and quad
intrinsics.

Fixes #2501
2020-07-22 22:54:42 -06:00
Helena Kotas 84c2b946ce
Support -h on hctbuild/hcttest and -Release on hcttest (#3049) 2020-07-22 17:20:14 -07:00
Greg Roth e62e7481be
Allow integer attribs to GetAttributeAtvertex (#3032)
An oversight left out integer types for the attribute accessed by
GetAttributeAtVertex. This adds the integer indicator to the generation
script, which prevents the validation fail.
2020-07-08 22:30:17 -06:00
Helena Kotas 73c0d97f0d
Enable arm build (#3030) 2020-07-08 15:10:02 -07:00
Xiang Li 73a9d7fe8b
SROA alloca and global variable at same worklist. (#3019)
* SROA alloca and global variable at same worklist.
This will allow memcpy replacement works for case like cb->global->alloca->global.
2020-07-01 22:05:23 -07:00
Greg Roth dd27189bab
Enable recompile of shaders with includes in dxc (#2996)
* Enable recompile of shaders with includes in dxc

When recompiling, the dxc executable stores all file blobs under names
that use backslashes. However, when recompiling, the filenames of the
includes in a shader are joined with the directory using a forward
slash. In addition, many authors use forward slashes to separate
subdirectories in these includes. Because of this, no includes could
ever match.

By converting all / in the path to \ just before trying to retrieve the
associated pseudo-file, the file is found. Recompilation is only
supported on Windows presently, so other OS path dividers needn't be
considered. The same native() call that generates the keys originally is
used to generate the keys to retrieve them.

Modify smoke.hlsl to verify that recompilation works
2020-06-26 11:20:56 -07:00
Tex Riddell e0cb412916
Add resource rename pass, dx op overload fix (#2986)
- Add method to DxilModule to rename resources based on a prefix,
  preventing resource merging during linking.
- Also one to rename by binding if desired.
- Add pass to access this resource renaming.
- Fix dxil intrinsic overload names when type disambiguation causes
  types with same name to be renamed with .0+ suffix, but intrinsic
  names remain in collision.
- Handle colliding intrinsic names with unique types in linker.
2020-06-19 15:33:58 -07:00
Tex Riddell b59671accf
Use HlslDataDir for DxilConv instead of DxilConvDataDir (#2961)
This was using a define before a header to change the option name.
An inline function used the define when adding the path to a filename.
Unfortunately, this header was included from multiple places with
different values defined for the variable name, and it seems that
sheer luck made it work for a while, even when called from a cpp
file that would have had it defined differently.
2020-06-09 20:19:38 -07:00
Tex Riddell a6b6c26d77
Add option to dump FileCheck input to directory for diffing (#2949) 2020-06-08 14:43:57 -07:00
Greg Roth 0af56b4ab9
Clarify assignment of undefined value to UAV (#2941)
The validation error message for when one or more of the components of a
storeBuffer (or similar) operation are undefined was terribly confusing
to anyone not developing the compiler. It mentioned mask mismatches when
one of the masks was generated based on which operands were undefined.

This changes the error message when the flaw results from the user under-
specifying the copied variable to simply state that the assignment involves
undefined values. If the masks mismatch because the type-based mask didn't
expect values that the user somehow defined, the original error message
results as this is likely a compiler error.

In addition, this consolidates some of the mask checking for rawbuffer,
texture, and generic buffer storage.
2020-06-08 13:04:15 -07:00
Greg Roth ce645d1c11
Improve location reporting for validation errors (#2938)
This strips the previous method of error reporting from DxilValidation
in favor of the DxilUtil methods. With these comes a new way to find
location information for those associated with functions or globals.
Instruction reporting is slightly changed in that the asm informtion
including the instruction and its block is added as a note so as to not
clutter up the line with the error and hlsl location.

For the most part, the existing EmitError* functions were retained, but
their implementation was changed to largely format inputs for the
dxilutil:: function and call it.

Errors that had clear associations with instructions, functions, or
globals had their emitting functions changed to variants that had this
information. The result is error message with as much location
information as is available.

In some cases, functions that implicitly added format arguments where
removed in favor of explicit formatted error calls that are clearer.

* Avoid directory duplication in DIFile MD

Change #2030 prevented the duplication of the directory for filenames
with full paths. However the same problem exists for relative paths that
include directories. This results in duplicate DIFile entries and
confusing error message outputs for Global Variables.

This skips the original code which was meant to prepend the directory
name since our filenames always have that information already.

* Validation error message text changes

This includes a number of different changes to validation error
messages. Some correct grammar. Some add a format argument to the
message for better information. Many of them just add a period to the
end of the error message for consistency and to allow the "Use /Zi"
message to be tagged on the end without jumbling the output.

* Enhancements for Dxil DiagnosticInfo and DxilUtil

Introduce *OnContext diagnostic reporting for messages that don't
clearly adhere to any instruction, global, or function. Also includes
the ability to add a note to supplement an earlier diagnostic.

Add function to DiagnosticInfo. This provides a fallback option for
printing location information when debug info isn't available. At least
we can print the function where the issue occurs.

For GV errors, we can't depend on the module having a dxil module in it.
Debug modules don't get the dxil part cloned. The only use of it was the
potentially cached debuginfofinder. Lacking it, we can just create it on
the fly.

Corrected the format of the output for DiagnosticInfoDxil::print. In
addition to minor fixups, when the diagnostic is a remark or note, it
doesn't need the "Use /Zi" prompt.

DxilLoopUnroll has its own diagnostics reporting. This adds the
associated function for the messages.

* Add function location information for interp mode error

This is to satisfy a specific request for line information for this
specific error. It got left out of the original batch, but it's
important enough for a followon.
2020-06-02 18:26:36 -07:00
Tex Riddell ee442e01bc
Support instruction counts in reflection (#2930) 2020-05-29 20:09:29 -07:00
Xiang Li 3562970cd8
Add DxilLoopDeletion to remove unused loops. (#2927) 2020-05-29 08:13:43 -07:00
Adam Yang 0c3cab299f
Fixed broken debug info for "out" and "inout" args. (#2914) 2020-05-26 13:32:26 -07:00
Adam Yang 0d3210d3c8
Fixed debugger jumping around. Got rid of preserve value. (#2893) 2020-05-23 14:31:00 -07:00
Tex Riddell 28d88dfa75
Allow SV_CullPrimitive on PS input, resolve to false (#2900) 2020-05-20 22:23:09 -07:00