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

1226 Коммитов

Автор SHA1 Сообщение Дата
Greg Roth 93a98982cf
Prevent sinking coord calculation for sample (#3655)
The mark convergent pass is meant to prevent unwanted moving of
operations on derivative op input. It was previously only run on pixel
shaders. Because derivatives are supported in CS/MS/AS shaders as part
of shader model 6.6, it needs to be run on these stages for that target
too.
2021-04-01 14:01:22 -07:00
Vishal Sharma 3daa429525
Update BaseAlignLog2 field in ResourceProperties for StructuredBuffer (#3652) 2021-04-01 04:55:31 -07:00
Jaebaek Seo 09f5b6d7cf
Fix build failure with undefined variable (#3647)
PR #3636 (commit 6b44d611f7) changes the definition of
`llvm_unreachable(msg)`. Now it evaluates the `msg` even when
NDEBUG flag is defined.

For the following code,
```
static const char *const BundlingNotImplementedMsg =
  "Aligned bundling is not implemented for this object format";

void MCObjectStreamer::EmitBundleAlignMode(unsigned AlignPow2) {
  llvm_unreachable(BundlingNotImplementedMsg);
}
```

`llvm_unreachable(BundlingNotImplementedMsg)` did not evaluate
`BundlingNotImplementedMsg`. After PR #3636, it is evaluated and it
results in "undefined object" for `BundlingNotImplementedMsg`.
2021-03-31 09:54:00 -04:00
Adam Yang c8123cf7f7
Fixed a bug in pdb where -W[...] type options are split into two tokens (#3646) 2021-03-30 14:26:11 -07:00
Greg Roth cf135fa88b
Allow removal of trivially dead convergent marker (#3640)
Failing to remove this because it is marked as having side effects so it
can prevent unwanted code movement resulted in trivially dead code being
retained unnecessarily because the marker isn't removed until after dead
code elimination. By allowing its removal when the operation that needed
it has been removed so it has no users, this dead code can be
eliminated.
2021-03-29 17:54:28 -07:00
Greg Roth 6b44d611f7
convert recoverable exceptions to c++ (#3636)
Instead of raising structured exceptions for unreachable and fatal
errors, raising c++ exceptions allows returning an error code and
getting a useful message instead of requiring a structured exception
handler to catch it.

Add cast failure assert
2021-03-26 19:56:42 -07:00
Jeff Noyle ea1efe96ba
PIX passes: Centralize handle-generation code and update for 6.6 (#3628)
This is little more than a move of the "create-uav" code in lib/DxilPIXPasses/DxilShaderAccessTracking.cpp to PixPassHelpers.cpp, followed by a factoring-out of the parts that create a handle (either pre-SM6.6 fashion, or with the newer create-from-binding etc.).
All the other passes' near-identical code was then deleted and made to call the centralized function.
2021-03-26 12:55:08 -07:00
Tex Riddell 634cd49ba5
Disallow CreateHandle in SM66+ and library targets (#3629) 2021-03-25 23:09:16 -06:00
Greg Roth 82422d7761
Only keep legacy struct types from resources (#3624)
When compiling a library without 16-bit support, certain struct types
containing either min precision types or matrices must be saved in
reflection data for conversion after linking. However, this is only
necessary when the types are used by a resource.

Instead of evaluating all matrix types and saving those that meet this
criteria, only the types used by resources are evaluated and possibly
preserved. This significantly shrinks the reflection size in this case.
2021-03-25 14:47:29 -07:00
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
Jeff Noyle 880c1359c5
PIX SM 6.6 resource access tracking (#3594)
This change updates the existing PIX resource-tracking code to handle dynamic resources (and SM6.6's resource binding apparatus in general).
The output UAV is now segmented into three parts: the original formatted buffer at the beginning, for old-style createHandle resources, followed by a block for resource (texture, buffer etc) access, followed by a block for sampler access.
The latter two are divided into 8-byte records. The first dword records writes to a resource/sampler, the second reads.
The writes are encoded bit fields denoting the access performed by the shader.
2021-03-24 13:04:46 -07:00
Tex Riddell 2791c51979
Generate descriptions for resources with no names (#3598)
Module with stripped reflection will have no name for error messages.
Try to get the name from the debug module.
Failing that, use ID, type and binding info.
2021-03-21 15:04:02 -07:00
Tex Riddell 2039610190
Fix Dxil validator compat and test issues (#3610) 2021-03-21 15:00:53 -07:00
Adam Yang 86104f415f
Internal validator error messages don't need /Zi anymore. (#3606) 2021-03-20 19:21:26 -07:00
Greg Roth 9b475a7fa3
Add dxc exception handler (#3604)
The most common cause of internal compiler errors are access violations
or stack overflows. This registers an exception handler in dxc.exe for
these cases that are otherwise unhandled. It prints a simple message
for these errors and passes the exception along.

In case this is unwanted for some reason, a hidden disabling flag is
added as well.

Adds LLVM builtin exceptions for assert, fatal, and unreachable. Adds a
default message for exceptions not explicitly addressed.

Alters behavior of llvm_unreachable so it always raises an exception
regardless of compiler support for unreachable hints.

Reports errors using fputs instead of std::cerr to ensure that no
allocation is necessary. Custom output is performed in a static array
that is output with fputs.
2021-03-18 20:37:21 -07:00
Adam Yang e8372b9b9a
Fixed arg pairs not correct for old source in module pdbs (#3599) 2021-03-18 01:33:06 -07:00
Tex Riddell 3f6589a30b
Fix coverage bing used to init dx.ishelper when only discard is used (#3589) 2021-03-16 08:26:56 -07:00
Vishal Sharma 6ad56561e2
Fix a misfiring assert due to unused static const involving matrix type (#3582) 2021-03-15 11:01:55 -07:00
Xiang Li de09119850
Add -link to dxc. (#3577)
* Add -link to dxc.
2021-03-15 09:09:58 -07:00
Tex Riddell fd07613a95
Texture2DMS fixes: missing ResProp data; reflection default NumSamples = 0 (#3578)
- Fix missing component type and count for Texture2DMS in ResProps
- Fix reflection for Texture2DMS with default NumSamples
2021-03-15 01:14:05 -07:00
Michael Haidl 1db765ea9c
DXC extension for DXR Payload Access Qualifiers (#3171)
This extension adds qualifiers for payload structures accompanied with semantic checks and code generation. This feature is opt-in for SM 6.6 libraries.  The information added by the developer is stored in the DXIL type system and a new metadata node is emitted during code generation. The metadata is not necessary for correct translation of DXIL, so it may be safely ignored, but it provides hints to unlock potential optimizations in payload storage between DXR shader stages.
2021-03-14 18:31:40 -07:00
Adam Yang b2c85528e7
Fixed some potential O0 failures (#3569) 2021-03-12 19:34:09 -08:00
Xiang Li 48b2c4611a
Support -export-shaders-only for linker. (#3571)
* Support -export-shaders-only for linker.
2021-03-11 23:49:28 -08:00
Greg Roth 094b1087ab
Correct WaveSensitivity debug test iterations (#3562)
Instead of verifying that the args of an known phi were not known to be
sensitive, it was checking the users, which can very well be wave
sensitive
2021-03-09 23:18:06 -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
Xiang Li b6258c65b6
Take care case dynamic indexing on vector start with offset. (#3558)
* Take care case dynamic indexing on vector start with offset.
2021-03-09 16:19:36 -08:00
Greg Roth 35380ea12c
Wave sensitivity unused var errors (#3551)
An esoteric build produced errors as a result of only using assigned
variables in asserts. This makes a dummy use of them to quiet it.
2021-03-09 10:53:10 -08:00
Greg Roth 1351ab9ee7
Infer wave-sensitivity of cyclic dependencies (#3543)
Cycles in the dependency graph can result in phis and other instructions
failing to get a wave sensitivity result after analysis. This can only
happen when nothing in the loop has wave sensitive operations.

By collecting phis that are unknown and marking them as non-sensitive
after analyze is complete and rerunning it, we can correctly evaluate
their dependants too.

Because incompletely processed blocks might still be wave-sensitive,
unknown phis are only added to be reprocessed when their preds have all
be processed fully.

In addition to cycles preventing wave sensitivity determination on
dependant operations, they can prevent entering blocks that depend on
values with cyclic dependencies. Even when reprocessing all unknown
phis, this can result in not all values getting a determination.

To resolve this, all blocks are added to the block list from the start
to ensure that they are all processed eventually. Since instruction
processing is more intelligent and targetted, this change is accompanied
by a change that only processes a single block from the worklist before
attempting to address queued instructions again.

To catch wave-sensitive instructions sooner, when visiting an
instruction, all arguments are checked for wave sensitivity even after
an unknown argument is found whereas before an unknown argument ended
the search.

Add some tricky loop tests that failed in ToT and various intermediate
stages of the change. Add a more aggressive assert to check for failures
to find the wave-sensitivity.

Fixed #2556 (again)
2021-03-08 14:34:25 -08:00
Greg Roth bb5dc9fdb0
Return Scatterer object for argument values (#3540)
An unrelated earlier change mistakenly removed the return on a line
calling the Scatterer constructor for an argument value. As a result,
the constructor is called, but the resulting object which would insert
new extraction ops in the entry block is not used at all. Instead,
the default case is encountered where the vector PHI op is used as an
insertion point, which places the extractions after the new scalar PHIs
that use them. This is caught in the loop case by an assert because the
assumptions that caused LCSSA to be skipped for this BB are faulty.
2021-03-05 08:40:27 -07:00
Tex Riddell 5bdf3574bc
Revert "Report error for unsupported types of SV semantics (#3043)" (#3532)
This reverts commit bece3d4faf.

Revert system value type checking code due to regressions.
Will re-merge once it's fully verified fixed.
2021-03-02 21:24:25 -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
Xiang Li ae834522b3
Use vector size from vector type when dynamic indexing cb vector. (#3530) 2021-03-01 18:00:47 -08:00
Greg Roth 1ca779732f
Correct atomics on heap usage for libs (#3525)
The previous shader flag code failed to account for the library-specific
handle creation function
2021-02-28 16:02:44 -08:00
Greg Roth bf112930d1
Remove unneded, incompatible function inheritance (#3523)
C++17 removes these function templates. they aren't needed anyway
2021-02-27 14:13:48 -08:00
Greg Roth 62f390cb58
Set shader flags for dynamic resources (#3521)
Set shader flags for resource and sampler descriptor heap indexing based
on the CreateHandleFromHeap call and its ShaderHeap argument
2021-02-27 10:37:57 -07:00
Greg Roth c3f9997709
64-bit atomics usage resource flags (#3518)
When a resource comes from a binding, we can't determine if it is on a
heap or not, so we set a flag on it to let the runtime sort it out.

When a resource comes from the heap directly, we know it's on the heap
so we set the shader flag to check for platform support.
2021-02-26 19:55:59 -08:00
Tex Riddell d8499bb975
Fix uninitialized m_bHasAtomic64Use in DxilResource. (#3516) 2021-02-26 13:17:02 -08:00
Greg Roth deacf03358
Add used by atomics resource flag (#3513)
To identify resources that are used in 64-bit atomics operations in order to catch invalid use of heap resources
2021-02-26 11:25:28 -08:00
David Peixotto 58163b04cf
Add support for specifying overload arg index in extension function (#3510)
Any extension function that includes the specical string "$o" in its name
needs to have the $o replaced with the type name of the overload. Previously
we used a default heuristic to select the overload type from a function
argument.

This commit adds support for explicitly setting the argument to use for the
overload name by appending a ":<ArgIndex>" to the overload marker. For example,
using a name like "my_special_function.$o:3" would take the overload type from
the third function argument.
2021-02-25 19:52:09 -08:00
Xiang Li 9eb7f4f40e
Don't replace readfirstlane in GVN::propagateEquality. (#3504) 2021-02-25 17:23:40 -08:00
Vishal Sharma bece3d4faf
Report error for unsupported types of SV semantics (#3043) 2021-02-25 16:38:12 -08:00
Tex Riddell 97b0b1a3ee
Fix Dynamic Resources when used with -Od (#3499)
- SROA was not skipping handle type, now present with dynamic resources
  changes, or ConstantBuffer<> / TextureBuffer<> types, as it should.
- Updated unit tests to add combinations of -Od and -Zi.
2021-02-25 14:10:22 -08:00
Greg Roth b89f06578f
Consider ranges when counting UAVs for 64UAV (#3470)
The 64UAV flag is meant to indicate that 9 or more UAVs are in use.
Previously, each UAV was considered as one regardless of range. By
adding up the ranges, we get a more accurate determination.

Only use the new counting when using the latest validtor to maintain
compatibility with the old ones

Fixes: #2964
2021-02-24 19:17:30 -08:00
Vishal Sharma 43267d1b06
Fix byte-offset calculation when writing to RWByteAddressBuffer with elements greater than four (#3485) 2021-02-24 18:52:33 -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
Xiang Li 81eb9808ce
Check wave sensitive on operand of gradient ops instead of gradient ops. (#3489)
* Check wave sensitive on operand of gradient ops instead of gradient ops.
2021-02-22 22:37:52 -08:00
Greg Roth 8fb57e7e27
Add barycentric shader flag when used (#3491)
A Dxil shader flag should be added when SV_Barycentrics semantic or
AttributeAtVertex() are used. It was defined and member variables
created for it, but it wasn't actually set.
2021-02-22 21:26:34 -08:00
Greg Roth e2b32bc70b
Avoid trying to get disubprogram without debug MD (#3488)
When trying to fixup line numbers when inlining a function, if the call
instruction had no debug location, the DIsubprogram was queried. That
query took a very long time and was pointless when there is no debug
info.

The code now checks for debug metatdata before trying to get the
disubprogram

Fixes #3130
2021-02-22 16:41:51 -08:00
Greg Roth 72e46b3709
Fix crashing from null elements producing errors (#3487)
Under certain rare circumstances, it is possible for errors to be
reported for function or global variables that are null.

This eliminates the absolute necessity for a non-null function or GV by
passing in the context needed to report any error. It also avoids some
of the cases where trying to get a debug function would give a null
which would replace the non-null function.
2021-02-22 14:56:54 -08:00