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

4625 Коммитов

Автор SHA1 Сообщение Дата
Steven Perron 8b24477c58
Propagate precise from formal parameter to actual parameter (#6058)
It is unclear what should happen if an input parameter on a function is
marked as precise. I am choosing to propagate it to the actual
parameters.

Note that it is not wrong to propagate precise more than we should since
it will only stop some optimizations.
2023-11-30 21:41:01 +00:00
Steven Perron 748a54b4da
Rename test dir in appveyor (#6083)
The CodeGenSPIRV_Lit directory was renamed, but the appveyor script was
not updated. This PR updates it.
2023-11-30 16:55:16 +00:00
Steven Perron beaf633eb0
Refactor create stage vars (#6059)
The `createStageVars` function is very large, and difficult to fix. In
support of two bug fixes, I want to refactor the function so try to make
the code cleaner.

This change will try to keep the exact same functionality. I believe
their could be further simplification after this if needed.
2023-11-30 15:40:02 +00:00
Steve Urquhart 6f51315fe5
[SPIRV] Emit OpLine for internally generated SPIR-V wrapper function (#6074)
This PR improves the experience for profilers and debuggers that consume
SPIR-V produced by dxc. When debugging information is output,
additionally note the beginning of the internally generated wrapper
function. This will assign all parameter setup to the entry point
declaration, providing context to the user of a shader profiler or
debugger.
2023-11-30 15:56:22 +01:00
Adam Yang fc0ecb83b5
Fixed an OOB that potentially causes a crash (#6079)
While emitting diagnostic notes about conversions, the code for checking
`OutConversions` was not included in the loop. This caused an OOB when
`I >= NumConversions`. Normally, this does not affect anything (other
than not emitting the diagnostics for `OutConversions`), since most of
the time `OutConversions[I].isBad()` happens to return false. However,
in some cases when `OutConversions[I].isBad()` is true, calling
`DiagnoseBadConversion()` on the invalid entry will crash.
2023-11-29 17:01:41 -08:00
S. Bharadwaj Yadavalli 6f516dd539
Update DXIL.rst (#6078)
Make the table with supported shader model, major and minor numbers
visible.
2023-11-29 18:39:08 +00:00
Antonio Maiorano aa168736be
CMake: fix FindD3D12.cmake when using non-VS generators (#6056)
FindD3D12.cmake sets WIN10_SDK_VERSION to
CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION; however, this latter variable
is only defined when using a Visual Studio CMake generator. When using
Ninja instead, for example, this variable will be empty, and
WIN10_SDK_VERSION will remain unset.

This change detects when CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION and
attempts to retrieve the latest SDK by listing directories under
${WIN10_SDK_PATH}/Include.
2023-11-29 13:26:52 -05:00
Xiang Li 5cecea9e17
[Test] add test for different matrix representations in refection (#5995)
Not all matrix representations could be generated with current dxc, so
use IR test here.

Fixes #5696
2023-11-28 12:56:38 -08:00
Xiang Li 079d6cbb58
[lit][SPIRV] move shaders back to CodeGenSPIRV (#6072)
Move shaders out of CodeGenSPIRV_Lit and delete CodeGenSPIRV_Lit.
2023-11-28 18:17:37 +00:00
Greg Roth 41241d7fe3
[lit][SPIRV] convert runFileTest shaders to lit FileCheck test (#6069)
Convert the moved shaders to lit FileCheck test.
5 shaders not used by runFileTest are also converted and left in
CodeGenSPIRV with CodeGenSPIRV folder enabled for lit.
Now all shaders are converted to lit.
Will move all files back to CodeGenSPIRV and delete CodeGenSPIRV_Lit
next.
2023-11-28 09:38:30 -07:00
Xiang Li bc56be9fe1
[CMake] add another hint for DIASDK (#6061)
Fail to find DIASDK when using VisualStudio "Open a local folder". Both
VS_DIA_INC_PATH and VSWHERE_LATEST are empty. But MSVC_DIA_SDK_DIR is
set correctly.

Add MSVC_DIA_SDK_DIR/include as hint for DIASDK_INCLUDE_DIR.
2023-11-28 08:24:57 -08:00
ChristianReinbold b9c5bec821
Fix segfault when compiling hlsl intrinsics with variadic argu… (#6012)
For hlsl intrinsics with variadic argument lists (in my case: printf),
the number of param modifiers and function arguments did not match,
resulting in segfaults when creating a FunctionProtoType. The presumed
oversight: The paramsMods was made twice as large as intended, by first
resizing to the expected number of arguments, and then pushing back the
same number of arguments again. A fix that seems to resolve this issue
comes with this PR. Please have a look.

Edit: The suggested modifications do not feel as if they are the proper
way to handle modParams initialization. They only defuse the issue I had
with printf. If you think this issue needs a better solution and/or a
proper bug report before suggesting a PR, please let me know - and
please apologize in case I opened up a PR too early.
2023-11-28 10:22:45 -06:00
Antonio Maiorano c97d48847d
Python: fix calls to os.makedirs to avoid existence check races (#6060)
In parallel builds of DXC, hctgen.py in particuilar would sometimes
throw an exception from os.makedirs because the directory would already
exist. The conditional check for file existence introduces a race when
running the script in parallel. Fix this, and all other cases where such
conditional checks were done, by using the `exist_ok = True` argument.
2023-11-28 16:11:51 +00:00
Xiang Li 7b222ff6b4
[CI] remove contents write permission from code_formatter job. (#6068)
Only apply_diff job needs conntents write permission. 
code_formatter job only needs pull-request write permission.
2023-11-27 23:49:05 +00:00
Greg Roth 426f6cbbbe
Update format checker action (#6067)
Updates the format checker action yaml to conform to our policies
2023-11-27 23:07:34 +00:00
Xiang Li 9f2a358672 [lit][SPIRV] convert shaders to lit FileCheck test
Convert the moved shaders to lit FileCheck test.
5 shaders not used by runFileTest are also converted and left in CodeGenSPIRV with CodeGenSPIRV folder enabled for lit.
Will move all files back to CodeGenSPIRV and delete CodeGenSPIRV_Lit next.
2023-11-27 17:57:12 -05:00
Xiang Li 59249a1beb [lit][SPIRV] move shaders to lit folder
Everything used by runFileTest is moved.
2023-11-27 17:45:45 -05:00
Greg Roth 14b0da7b2e
[lit][SPIRV] convert runFileTest shaders to lit FileCheck test (36 left to go) (#6065)
Convert from bottom of CodeGenSpirvTest.cpp
Skipped FileTest::CompatibilityWithVk1p1 as barrier for runCodeTest.
2023-11-27 15:38:11 -07:00
Xiang Li 2f473a3d8d [lit][SPIRV] convert shaders to lit FileCheck test (36 left to go)
Convert the moved shaders to lit FileCheck test.
2023-11-27 10:08:49 -05:00
Xiang Li 016288f902 [lit][SPIRV] move shaders to lit folder (36 left to go)
Started from CompatibilityWit6hVk1p1
2023-11-27 10:08:25 -05:00
Xiang Li 5d5a940fdb
[lit][SPIRV] convert runFileTest shaders to lit FileCheck test (61 left to go) (#6062)
Convert from bottom of CodeGenSpirvTest.cpp
Skipped FileTest::CompatibilityWithVk1p1 as barrier for runCodeTest.
2023-11-27 10:20:45 +01:00
Xiang Li f2dd3e33cd
[lit][SPIRV] convert runFileTest shaders to lit FileCheck test (107 left to go) (#6055)
Convert from bottom of CodeGenSpirvTest.cpp
Skipped FileTest::CompatibilityWithVk1p1 as barrier for runCodeTest.
2023-11-24 11:10:16 +01:00
Cassandra Beckley b32b169bd3
[SPIR-V] Enable vk::ext_extension and vk::ext_capability for variables (#6052)
`ext_extension` and `ext_capability` can only be added to functions at
the moment. This PR enables adding them to variable declarations, so
that using the variable results in the extensions and capabilities being
added to the module. This is useful for the builtin variable syntax
proposed in https://github.com/microsoft/hlsl-specs/pull/129.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-11-22 16:38:56 -08:00
Antonio Maiorano 37a082651d
CMake dxc as subproject fixes (#6050)
These changes allow us to use DXC as as CMake subproject (via
add_subdirectory).

Commit comments from each commit:

===

cmake: allow CMAKE_INSTALL_RPATH to be defined in superproject on APPLE
platforms

As on Linux, allow CMAKE_INSTALL_RPATH to be defined in a CMake
superproject.

===

cmake: Allow LLVM_ENABLE_ASSERTIONS=OFF to disable assertions in Debug
builds

Currently, this flag is only used to enable assertions in non-Debug
builds, but is not respected in Debug builds. That is, if set to false,
Debug builds will still assert. This change fixes that.

Note that by default, LLVM_ENABLE_ASSERTIONS is true in Debug builds, so
unless it's explicitly set to false, this is a no-op for most people.

===

cmake: Allow DIRECTX_HEADERS_INCLUDE_DIR to be defined from superproject

Useful for when DXC is included as a subdirectory. In Dawn/Chrome, we
use our own mirror of DirectX-Headers instead of checking out the repo's
submodules, so we need to override this variable.
2023-11-22 14:33:09 -05:00
Jeff Noyle 71afbcc7cf
PIX: Fix recent regression in debug instrumentation of void instructions (#6053)
The misplacement of that "return" in DxilDebugInstrumentation.cpp meant
that a thread would continue to the following call to
addStepDebugEntryValue, even if pix_dxil::PixDxilReg::FromInst had
failed (i.e. returned false), which means that RegNum is not valid
(although initialized to 0).

This meant that PIX was instrumenting a bunch of void-return DXIL
instructions that it shouldn't have.
Didn't think to test that it WASN'T instrumenting instructions, but
herein is added a test to do just that.
2023-11-22 08:39:26 -08:00
Natalie Chouinard 1b405f63a5
[SPIR-V] Add support for 64-bit switch sel (#6049)
Allow 64-bit integer variables as switch statement selectors and clarify
the error message for literal selectors (related to #4338).
2023-11-22 16:29:47 +00:00
Cassandra Beckley 2c913d608d
[SPIR-V] Fix push_constant and shader_record_ext to work with LowerTypeVisitor (#6011)
Since `ConstantBuffer` is now lowered in `LowerTypeVisitor`, lower
`push_constant` and `shader_record_*` with `ConstantBuffer` types there
as well.

Fixes #5808.
2023-11-22 15:19:32 +01:00
Xiang Li 773fed3060
[lit][SPIRV] convert runFileTest shaders to lit FileCheck test (154 left to go) (#6051)
Convert from bottom of CodeGenSpirvTest.cpp
Skipped FileTest::CompatibilityWithVk1p1 as barrier for runCodeTest.
2023-11-22 11:36:20 +01:00
Nathan Gauër 3861c5eef7
[SPIR-V] disable validation on error (#6044)
When the codegen fails, it shows an error, but the SPIR-V validation
still runs. Because the generation fails, the generated SPIR-V code
could be invalid without it being a compiler bug. But the validation
error message could confuse the user as it says this is a DXC bug.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-11-21 16:56:07 +01:00
Xiang Li f0aed97223
[lit][SPIRV] convert runFileTest shaders to lit FileCheck test (204 left to go) (#6048)
Convert from bottom of CodeGenSpirvTest.cpp
Skipped FileTest::CompatibilityWithVk1p1 as barrier for runCodeTest.
2023-11-21 11:45:25 +01:00
Nathan Gauër 62781d044a
build: add missing include file (#6045)
NodeInputRecordProps is used in this file, but the corresponding header
is not directly included. This breaks out build.

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-11-21 11:08:27 +01:00
Xiang Li c486ec1987
[SM6.8] Diagnostic for output records with SV_DispatchGrid (#5996)
Check both Input and Output node type when diagnose Semantic of
DispatchGrid.

Fixes #5958
2023-11-21 00:05:18 +00:00
Nathan Gauër c5ec2772bc
Update submodules (#6043)
Bumping submodule dependencies.
2023-11-20 14:24:49 -08:00
Greg Roth d712bf34c9
[lit][SPIRV] convert runFileTest shaders to lit FileCheck test (245 left to go) (#6031)
Convert from bottom of CodeGenSpirvTest.cpp
Skipped FileTest::CompatibilityWithVk1p1 as barrier for runCodeTest.
2023-11-20 14:15:36 -07:00
Joshua Batista dc7a595092
[Sema] Move more diagnostics over (#5992)
This PR moves over some more diagnostics from CGHLSLMS.cpp. Some
diagnostics are moved into DiagnoseEntryAttrAllowedOnStage, to
specifically diagnose when an attribute appears on a shader stage that
it shouldn't appear on. Other diagnostics that are covered in Sema are
removed in CGHLSLMS.
Fixes #5990

---------

Co-authored-by: Chris B <cbieneman@microsoft.com>
2023-11-20 13:15:05 -08:00
Helena Kotas 8c945e8280
Update WinSDK version with WaveMatrix support to 613 (#6046)
Version 612 does not have a public WaveMatrix support yet.
2023-11-20 20:05:57 +00:00
Natalie Chouinard f5b259ad5d
[SPIR-V] Emit error for unsupported HLSL res obj (#5956)
Emit an explicit error message when HLSL `ResourceDescriptorHeap` or
`SamplerDescriptorHeap` are used with `-spirv` as they are not yet
supported.

Fixes #5913
2023-11-20 19:08:31 +00:00
Xiang Li 42c429365a [lit][SPIRV] convert shaders to lit FileCheck test (245 left to go)
Convert the moved shaders to lit FileCheck test.
2023-11-20 12:55:21 -05:00
Xiang Li ef8c2f42fa [lit][SPIRV] move shaders to lit folder (245 left to go)
Started from CompatibilityWit6hVk1p1
2023-11-20 12:55:21 -05:00
Nathan Gauër 115a2093e6
[SPIRV] allow location index to be > than 64 (#6015)
There was an arbitrary limit to set the maximum number of locations to
64.
This commit allows the set to be resized, to allow arbitrarily large
location indices.

Curiously, one test, vk.location.large.hlsl started to fail. This test
assumed 123456 was an invalid location. From the SPIR-V spec, I don't
think this is true, as it only days Location should be an arbitraty
number.
In addition, it seems like this test was triggering an out-of-bound
access, which is now solved. Only drawback: we now end-up with a 123456
sized bitset.
I believe this is OK, as WHY would someone only require this index.

Fixes #3735

---------

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-11-20 09:32:02 -05:00
Nathan Gauër 6883e9bf8b
[SPIR-V] Fix interlock output parameter validation (#6029)
Interlock* functions takes output parameters. Because HLSL had no real
concept of references, this is allowed:

```
  int value;
  takeAnOutput(value);
```

This weirdness makes using `isLValue()` to validate output parameters a
bit tricky. If a function returns a local array, and we take the
subscript of this r-value, the r-value is now marked as l-value, but
this shouldn't be allowed.

This forces us to walk the expression, and add heuristics to determine
if the output parameter is valid or not. Not pretty, but I think this is
required until HLSL gets proper references.

Fixes #5772

---------

Signed-off-by: Nathan Gauër <brioche@google.com>
2023-11-20 11:47:47 +01:00
Helena Kotas 92e96cc3c7
Update WinSDK version with WaveMatrix support (#6040)
Direct3D version 611 does not have SM 6.8 support yet.
2023-11-17 18:34:16 -08:00
Natalie Chouinard 7f073c045b
[SPIR-V] Add name to unregisterd decl error (#5957)
Parameter was missing from error message so decl name was not being
emitted.
2023-11-17 15:16:16 -05:00
Steven Perron da3a1be65b
[SM66,SPIRV] Implement InterlockedExchange for floats (#6032)
This implements the atomic exchange for floating point values that was
added in SM6.6. See
https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_Int64_and_Float_Atomics.html#interlockedexchange.
2023-11-17 18:33:45 +00:00
Xiang Li 93c4b3202c
[CI] use build/main_src instead main when checkout main for save diff (#6034)
This is avoid possible issue when git add . might add main.
2023-11-17 10:37:43 -05:00
Justin Bogner 74a32065d6
Don't rely on a high level opcode in a test (#6035)
In the test added by ba90e249d "Remove InsertAddrSpaceCastIfRequired
which is redundant (#5862)" we have a check line for a `dx.hl.op` that
refers to an opcode. Since the HL opcodes aren't stable, we should avoid
that.
2023-11-17 02:22:49 +00:00
Jeff Noyle 9a29cd337b
WinPix: Inline functions test update (#6014)
I had a couple of test updates that should have gone in my previous PR
but got left out due to me forgetting, due to a two-week mental context
switch :-). The new test adds some useful regression testing, so here it
is.
2023-11-16 16:40:51 -08:00
Jeff Noyle 5ffdf14527
PIX: Instrument ret instructions for shader debugging (#6033)
Got a couple reasons to do this: 1) so that users can step over the last
value assignment and actually see that value in the debugger and 2) so
that I can easily distinguish the final instruction in DXR traces
wherein two different function's traces might be intermingled in the
debug output data in PIX's UAV.
2023-11-16 16:40:32 -08:00
Xiang Li 9dbfde5d51
[CI] fix issue when apply format (#6019)
Fix issues hit when apply format.
1. tmp diff file is not opened binary form, don't need to encode.
2. add contents write to "Check code formatting" workflow for commit and
push change.
3. put main branch to different path to avoid issue when checkout head
branch to same path.
2023-11-16 16:27:26 -05:00
Tex Riddell 3db94d17a8
Add EntryFunctionName to PSV0 data (#5946)
- In `DxilPipelineStateValidation.h`, add `PSVRuntimeInfo3` derived from
`PSVRuntimeInfo2`, containing one `uint32_t EntryFunctionName` member.
- Update `MAX_PSV_VERSION` and `RuntimeInfoSize()` for new version.
- Add pointer to `DxilPipelineStateValidation` and assign in
`ReadOrWrite` along with other versioned pointers.
- Add `DxilPipelineStateValidation::GetEntryFunctionName()` accessor to
look up name in string table.
- Update PSV0 versioning to key off validator version 1.8 in
`DxilContainerAssembler.cpp`
- Add entry name to string table and set `EntryFunctionName` to offset.
- Add initialization to DxilPSVWriter members
- Add asserts in DxilPSVWriter::write() to ensure buffer sizes not
changed after m_PSVInitInfo is set.
- Add test to DxilContainerTest, adding/updating common functions as
needed

Note: Testing the HS passthrough case revealed problems blocking that
scenario.
Filed issue #6001 to track this.

Fixes #5944
2023-11-16 20:52:55 +00:00