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

3647 Коммитов

Автор SHA1 Сообщение Дата
Chris B b49ecd10ee
Add option to force disabling debug info (#4645)
This is (admittedly) a little hacky. DXC spends a lot of compile time
updating debug information because we always generate it so that we can
generate diagnostics for late-running validation.

This patch adds a new flag -fdisable-loc-tracking, which disables
generating debug locations if the user is not generating debug info.

This flag results in about a 15% compile time improvement on a pessimistic
test case. YMMV.
2022-09-16 16:36:16 -05:00
Daniele Vettorel 42eb79311e
[SPIR-V] Add short-circuiting logical operators for HLSL 2021 (#4658) 2022-09-16 11:38:26 -04:00
Adam Yang de70ea29bc
Pulled the zlib compression code into a library (#4660) 2022-09-15 22:43:07 -07:00
Joshua Batista d52a2848d2
move entry point default code (#4653)
* move entry point default so it doesn't assume dxilcontainer needs shader source header

* ensure override also sets entry point to default after clearing it

* address feedback, excluding tests

* add compiler test case for entry point default with Qsource_in_debug_module
2022-09-15 22:03:57 -04:00
Greg Fischer 8d34bcf59d
[SPIRV] Do not include input file in DebugEntryPoint args (#4650) 2022-09-15 17:31:13 -07:00
Greg Fischer 3eb2fa5b26
[SPIRV] Do not require extension if included in Vulkan version (#4651) 2022-09-15 15:38:27 -07:00
Nathan Gauër 6d62e57524
Fix Layer & ViewportIndex ext in 1.2+ (#4597)
* llvm: fix UB when building with sized-deletion ON

This issue can show up with compiling DXC with libasan.
It has been fixed upstream:
21c303e9ea

Signed-off-by: Nathan Gauër <brioche@google.com>

* [spirv] specify correct SPV env for disassembling

When DXC finishes generating SPIR-V, the binary is disassembled and
printed to stdout.
The target env was hardcoded to Vulkan1.1, meaning disassembly would
fail if we tried disassembling Vulkan1.2+ SPIR-V.

Fixes #4067

Signed-off-by: Nathan Gauër <brioche@google.com>

* [spirv] Fix Layer & ViewportIndex ext in 1.2+

Back in Vulkan1.1, ShaderViewportIndexLayer was required to use
SV_RenderTargetArrayIndex. This was promoted in VK1.2:

https://www.khronos.org/registry/vulkan/specs/1.2-extensions/man/html/VK_EXT_shader_viewport_index_layer.html

Sadly, DXC didn't checked the target SPV environment, and always
requested the extension. This commit addresses this.

Fixes #4067

Signed-off-by: Nathan Gauër <brioche@google.com>

Signed-off-by: Nathan Gauër <brioche@google.com>
2022-09-15 21:17:30 +02:00
Nathan Gauër d6eb722516
build: fix include in header files. (#4652)
Building DXC with another build system revealed that some includes
were dependent on headers only available by chance. Adding missing
headers.

Signed-off-by: Nathan Gauër <brioche@google.com>

Signed-off-by: Nathan Gauër <brioche@google.com>
2022-09-15 16:00:29 +02:00
Helena Kotas db3baf1392
Include branch name in build name (#4647) 2022-09-14 12:09:57 -07:00
Chris B 79856c4a74
Add option to enable LTO/LTCG (#4646)
This adds a new option to the build to enable link-time optimzied builds
of DXC. On Windows with MSVC this seems to give about a 4% runtime
performance boost on my one locally run test case... and on Linux I'm
seeing about 6% on that same locally run test case.

LTO/LTCG is enabled by default for "Official" builds.

It's free performance so yay :D
2022-09-13 13:04:23 -05:00
Helena Kotas e578f266af
Remove lookup of full paths of D3D12 libraries (#4642)
Let the build system find the libraries based on the Windows SDK used.
Enables use of Windows SDK from nuget packages.
2022-09-09 17:54:10 -07:00
Tex Riddell bdb110f425
Fix version string in metadata, support optional toolname override (#4641)
Version string in metadata no longer old clang string or stale
HLSL_FIXED_VER.  Now it's derived from the defines in dxcversion.inc that's
generated by gen_version.py or copied from fixed version file.

Addition of toolname in latest-release.json allows for this to be changed
for every build out of a branch or project that sets this.  It defaults to
"dxcoob" which matches the dxc "Out Of Box" name used for releases before.

The fixed version file can also define the HLSL_TOOL_NAME,
HLSL_LLVM_IDENT, and HLSL_VERSION_MACRO to override these.
2022-09-08 19:47:41 -07:00
Joshua Batista e97577bba4
Skip test when using BDA, move check logic up as high as possible (#4639)
* Skip test when using BDA, move check logic up as high as possible

* remove unused variable to prevent build breaks

* remove unnecessary log, set output settings at top matching other tests

* remove logging that somehow reappeared?
2022-09-06 23:06:17 -04:00
Joshua Batista 0daadd0bc9
Isnormal hlktest (#4505)
* isnan test works on sm 66

* isnan test works on sm 60

* builds fine

* passing, replacement successful

* running without nv adapter works!

* start planning for bit ops

* bit ops compilation done

* prevent const expr eval by forcing dynamic indexing in for loop in xml

* attempt to change callback fn to use dxc over d3d blobs, breaks build

* changed part picker to pick from correct blob, defined IDxc by including dxilcontainer in exectest, etc, test passes

* remove gbv, and pblob=null assertion

* remove once-used functions, comment out double-type cases

* add generic shader callback function, make root signature reassembly optional

* clarify comment on expected results array

* fix problem with accurately translating semantics as a result of removing CompileAndRewriteAssemblyToText

* Use resource init callback to allow inputs to be defined in exectest cpp

* float input, uint output works, test passes

* clean up the xml

* make test multithreaded

* change unsigned int to uint, more conventional

* address PR feedback

* create container builder only when necessary

* remove boolean param determining whether or not root sig is in xml, fix up shader assembly code

* whitespace changes to restart appveyor
2022-09-02 16:15:19 -07:00
Greg Fischer 41650a4a55
[SPIR-V] Generate DebugEntryPoint for Vulkan DebugInfo (#4630) 2022-09-01 18:34:25 -04:00
Xiang Li 8bf2b087c2
Change /P to match cl.exe /P behavior. (#4624)
/P will write to InputFile.i
/P -Fi filename will write to filename.
/P filename still work with warning.
2022-08-31 22:07:30 -04:00
Greg Fischer 57663a9a4a
[SPIR-V] Generate DebugFunctionDefinition in the wrapper function (#4618)
The DebugFunctionDefintion in the user's entry function called
by the wrapper is omitted. All other DebugFunctionDefinition
instructions are still generated.

This is done because inlining during legalization omits
inlining the DebugFunctionDefintion because its function
no longer exists. This results in all DebugFunctionDefinitions
being eliminated for HLSL because every function is inlined into
the wrapper function.

The solution is to generate the entry point function's
DebugFunctionDefinition in the wrapper to start with.
2022-08-31 19:46:23 -04:00
Helena Kotas c9e04c06b0
Remove clang-format-vs (#4623)
It is an outdated version that no longer works and is not included in DXC build.
2022-08-29 18:30:13 -07:00
Greg Roth 38b746c1c3
Initialize all DxilModule members (#4617)
m_bResMayAlias was not initialized, leading to intermittent failures
when it was not explicitly set. The only functional change here is
setting that variable to eliminate that volatility. The other changes
are to move the setting of these simple typed variables to the header to
make it less likely taht future added members will suffer the same fate.

Also in the process, I couldn't resist removing an unused variable added
along with the Payload Access Qualifiers in error and moving the private
methods out of the middle of all the variable members.

Fixes #4616
2022-08-25 19:02:10 -04:00
Grace Jennings 21e56159ea
Add diagnostic tests (#4599)
* Adding more testing for diagnostics

* Added more diagnostic testing and changed some to internal compiler errors

* cleaning up HLOperationLower.cpp and HLSignatureLower.cpp diagnostics

* Update tests and error messages

* Reverting GV mapping to user errors with TODO for tests

* Add error message var
2022-08-25 10:29:07 -07:00
Greg Fischer 96bbe6bb05
[SPIRV] Generate DebugSource for API invocation with in-memory source (#4600)
Was not passing along the text of the source if it was coming
through the API and was in-memory.
2022-08-24 14:30:43 +02:00
Greg Roth 940df03ceb
Accept all ROV types as resources (#4606)
Includes all the Raster Order Views types in the check for UAVs and add
a test that exercises all of them, verifying they can be assigned
properly.

Followon to fix #4581 for bug #4578
2022-08-19 17:46:03 -07:00
Adam Yang 1e0de6211c
Fix unroller crash in library targets (#4604)
Fixed when there are multiple functions with loops that can't be unrolled at
the point of doing [unroll], the unroll pass crashes because it didn't clean up
memory between runs.
2022-08-19 11:37:19 -07:00
Nathan Gauër fc8c775ea6
bump SPIRV-Tools to fix #4429 (#4598)
SPIRV-Tools contains a fix for copy-propagate-arrays optimization pass.

Fixes #4429

Signed-off-by: Nathan Gauër <brioche@google.com>
2022-08-18 16:43:28 +02:00
Greg Fischer 6fff764915
[SPIRV] Do not create counter for RWStructuredBuffer by default (#4590)
* [SPIRV] Do not create counter for RWStructuredBuffer by default

Defer creating counter for RWSBuffer until Inc/DecrementCounter method
is invoked.

Fixes #4569
2022-08-16 19:18:02 +02:00
Joshua Batista 76a10d1ed7
allow array sizes defined by min ops to not be treated as variable length (#4591)
* allow array sizes defined by min or mul ops to not be treated as variable length

* add accompanying test

* remove mul attempt because of dxil assertion

* remove mul test, add const qualifier

* add const to cast

* update variable names, update check string
2022-08-13 18:07:20 -07:00
Nathan V. Morrical 44c767c8e3
[SPIRV] Add support for vk::RawBufferStore (#4573)
* initial code stubbed in to get vk raw buffer store working

* adding in additional intrinsic to support custom alignment of store

* altering test, forgot to add template argument

* some changes to unit test, though not sure checks are correct... and then added support for bool

* updating unit test, correcting some mistakes with the checks

* more changes to unit test

* removing addr variable to see if thats causing tests to fail

* fixing tests

* Updating documentation

* Small typo fix in docs
2022-08-13 13:56:16 -04:00
Cassandra Beckley d58442d57d
Bump SPIRV-Tools to include bugfix for #4444 (#4587) 2022-08-11 15:52:32 -04:00
Greg Roth f0d4dcbee3
Add vs2022 support to hctstart (#4585)
vs2022 installs in a different location, so finding cmake requires a
slightly different path. Variable assignment in batch files is ugly.
Duplication of code slightly less ugly.

Mostly done by @tex3d

Also invert loop order to avoid having to repeat the loop over the
different version variants
2022-08-11 11:40:25 -07:00
Nathan Gauër b3101a2feb
Bump spirv-tools, spirv-headers, effcee & re2 (#4582)
Signed-off-by: Nathan Gauër <brioche@google.com>
2022-08-09 15:16:51 +02:00
Greg Roth 4692c5ea6c
Recognize RaserizerOrderedTexure as resource type (#4581)
The HLSL type system was failing to recognize the
RasterizerOrderedTexture2D type as a resource type. As a result, it was
not getting annotated properly during UAV codegen and when the time came
to assign a struct member of that type, there was no declaration to use
to do so. This resulted in a validation failure when used as a struct
member.

By simply adding it to the list of detected resource types, the
assignments are successful.

Fixes #4578
2022-08-08 21:38:25 -04:00
Jeff Noyle 398d94c676
PIX: MeshShaderOutput: Disambiguate meshlets in no-AS case (#4579)
Co-authored-by: Jeff Noyle <jeffno@ntdev.microsoft.com>
2022-08-08 15:29:30 -07:00
Greg Roth 9c86296ef9
Allow unbound, multidimensional resource arrays (#4475)
FXC permitted unbound multidimensional resource arrays such as
Texture2D<float> iAmAnArray[][3];

The DXC exception for unbound array errors when used with resources
failed to drill through any additional arrays. As did the code to create
a constant buffer view for cbuf and tbuf and the disassembler

Adds involved test for correct and incorrect usages as well as
augmenting existing tests to touch on multidimensional unbound resources
2022-08-08 13:02:57 -07:00
Chris B 9463be1cd5
NFC. Ensure that the output directory exists (#4571)
Depending on build ordering the output directory may not be created
before the output file is written. This resolves the issue by forcing
the creation.

Resolves #4570.
2022-08-08 13:36:28 -05:00
Cassandra Beckley 396e45cbc4
Bump spirv-tools, spirv-headers, effcee, and re2 submodules (#4577) 2022-08-08 10:09:35 -04:00
Cassandra Beckley 9ce4a5317c
[SPIRV] Fix crash when returning void (#4576)
* [SPIRV] Fix crash when returning void

This fixes a bug where invalid SPIR-V would be emitted when returning a
void value from a void function. According to the spec, the `Value` of
`OpReturnValue` must not have type `OpTypeVoid`; therefore, `OpReturn`
will now be emitted instead.

Fixes #3596

* assert instead of branch
2022-08-08 05:38:46 -07:00
Joshua Batista 7a45cbbf8b
Add semantic clarification to error on missing output semantic (#4562)
* test that when output of entry point function is missing semantic, the output is specified in the error message

* remove old comment

* add alternate error output message among the set of expected errors
2022-07-19 23:49:25 -07:00
Xiang Li 267f84cc57
Use VertexID to check last lane. (#4556) 2022-07-14 23:12:08 -07:00
Jeff Noyle f7c7eb0b66
Weirdness with common subroutines for exported functions in libs (#4555)
Co-authored-by: Jeff Noyle <jeffno@ntdev.microsoft.com>
2022-07-14 15:10:52 -07:00
Greg Roth 0611d3f01d
Add checks to advanced tex ops exectests (#4551)
Two of the Advanced Texture Ops feature tests were missing the check for
the feature in addition to the check for 6.7 support. This adds those
checks
2022-07-13 11:16:27 -04:00
Adam Yang 5e01d70fbb
Splitting simple array during mem2reg. (#4539)
Added a simple transformation before mem2reg to change all allocas of scalar arrays to individual scalar allocas. This could make value deduction easier in Od compilation.
2022-07-12 16:58:32 -07:00
Tex Riddell fc4ab175ed
Fix version skip for UAVStoreMaskGap to exclude v1.6 (#4522)
SkipDxilVersion skips test if the either the DXIL version (DxCompiler) or
Validator version (DXIL.dll if external) is less than the specified version.
This message is being added in version 1.7, so the skip value needs to be
1.7 to skip unless it's version 1.7 or higher.
2022-07-12 16:14:21 -07:00
Adam Yang c555b792ab
Fixed assert in delete dead region with simple loops. (#4547)
Fixed an assert caused by DxilDeleteDeadRegion making the incorrect assumption that loops with no outgoing values must have no PHI nodes in its exit block. Exit blocks could have phis anyways by referencing incoming values from outside the loop.
2022-07-12 16:01:21 -07:00
Adam Yang c93453a64c
Fixed HLMatrixLower not copying over debug location to dbg.delcare (#4544) 2022-07-08 18:49:57 -07:00
Helena Kotas cbd19f8e30
Update version to 1.7.2207 (#4543) 2022-07-07 17:24:50 -07:00
Minmin Gong 76fed39c36
Pass parameters to CMake in a correct way (#4531) 2022-06-29 11:17:18 -07:00
Natalie Chouinard 02cfc68de0
[spirv] Fix ByteAddressBufferTemplatedStoreStruct2 test (#4535)
This test was previously excluded from running. Add it back in and fix
issues causing it to fail.

Fixes #4532
2022-06-27 15:36:13 -04:00
Natalie Chouinard c6f0ea4eea
[spirv] Fix crash on some ternary ops (#4534)
Sometimes the Clang AST does not include an implicit cast wrapper around
an integer-type condition in the ternary operator, which causes a crash
when the SPIR-V generated has a non-bool type for the
OpBranchConditional. This change checks for this case and casts the
condition to bool.

Example ASTs:
```
// | `-ConditionalOperator 0x24022c82d48 <col:10, col:19> 'bool'
// |   |-ImplicitCastExpr 0x24022c82d00 <col:10> 'bool' <IntegralToBoolean>
// |   | `-IntegerLiteral 0x24022c82c58 <col:10> 'literal int' 1

bool b1, b2;
bool b = 1 ? b1 : b2;

// | `-ConditionalOperator 0x1ede5137380 <col:18, col:27> 'SamplerState'
// |   |-IntegerLiteral 0x1ede5137308 <col:18> 'literal int' 1

SamplerState s1, s2;
SamplerState s = 1 ? s1 : s2;
```

Fixes #3831
2022-06-27 13:01:31 -04:00
Jakub Kuderski 24ea9e83d2
Treat matrix load/stores as column major in raw buffers (#4526)
Assume that matrices are stored in the column major order in raw
buffers, e.g., `ByteAddressBuffer` and `RWByteAddressBuffer`.

Add a new flag,`-fspv-use-legacy-buffer-matrix-order`, so that shaders
that depend on the previous matrix order (row major) can opt-out of this
change.

Fixes: https://github.com/microsoft/DirectXShaderCompiler/issues/3370
2022-06-24 17:29:49 -04:00
Natalie Chouinard 0ef9b70289
[SPIR-V] Error when -Gis is used with -spirv (#4529)
Though we may support -Gis with the SPIR-V backend in future, it is
currently not supported, so this change makes that explicit to the user
with an error message when it is used.

Related to #3331
2022-06-23 18:28:27 -04:00