Several workgraph tests had AST checks which check not only the expected
operation attribute by name, but included the opcode value, which is not
stable when HL operations are changed.
This change removes the high-level opcode value from the CHECK lines.
For users of hlsl::ReplaceUsesForLoweredUDT, only
EmitGetNodeRecordPtrAndUpdateUsers will has V and NewV with different
address space. But there will be no addrspacecast for NodeRecordPtr from
clangCodeGen, because NodeRecordPtr doesn't have address space before
HLLowerOperation.
As a result, when hit addrspacecast in hlsl::ReplaceUsesForLoweredUDT,
the address space of V and NewV should match. So
InsertAddrSpaceCastIfRequired will always has AddrSpace !=
Ty->getPointerAddressSpace().
Removed InsertAddrSpaceCastIfRequired and add assert for address space
mismatch.
Fixes https://github.com/microsoft/DirectXShaderCompiler/issues/5695
This is a quick fix to unblock users, but it could hide other issues.
During this iteration, some function down the line push_back to the
debugInstructions vector. If the storage gets moved, then we fail.
Fixes#5566
Signed-off-by: Nathan Gauër <brioche@google.com>
When hit clang-format error in a pull request, edit the comment with
diff.
Add @apply-format at the beginning of the comment and Update comment.
New added "Apply code format" workflow will be triggered.
It will checkout the code from compare branch of the pull request, apply
the diff,
then commit and push it to the compare branch to fix the format issue.
The process should be getting clang-format diff comment first.
Then review the diff in the comment.
If the diff looks good, edit and add @apply-format to apply the diff.
Shader Model 6.8 is still a work in progress.
New features include:
**Work Graphs (experimental)**
Work Graphs define a system of shader nodes that feed into each other to
enable tailored GPU work creation.
**Wave Matrix (experimental)**
Wave Matrices are type abstractions of hardware support for higher
bandwidth matrix multiplications, useful in machine learning and image
processing. Previously called Wave Matrix Multiply and Accumulate or
WaveMMA for short.
**Orthogonal Comparison Sampling**
This is an addition to the existing sampling methods (`SampleCmp`,
`SampleCmpLevel`) with the difference between Orthogonal Comparison
Sampling and the existing methods is how the LOD is computed.
Comparison sampling prior to Shader Model 6.8 has supported the
following ops: `SampleCmp` with implicit LOD and `SampleCmpLevel` with
explicit LOD as of shader model 6.7, prior to that only
`SampleCmpLevelZero` was supported.
Methods added in Shader Model 6.8 are `SampleCmpBias` and
`SampleCmpGrad` as well as requiring `CalculateLevelOfDetail[Unclamped]`
to reference a non-comparison sampler object.
**Extended Command Information**
New system-value semantics `SV_StartVertexLocation` and
`SV_StartInstanceLocation`.
Turn off clang formatting for `RDAT_LibraryTypes.inl` and
`RDAT_SubobjectTypes.inl`. Macro indentation makes these files easier to
read.
This PR was created in 2 steps:
1. `RDAT_LibraryTypes.inl` and `RDAT_SubobjectTypes.inl` were reverted
to the version `64348c7e~1` The commit
64348c7eec is the first that started
preparing the code base for clang formatting. Except for that there were
no functional commits done to these files since then.
2. `//clang-format off` and a comment with explanation was added to the
top of these files
This change implements the translation of the two DP4a intrinsics into
pairs of operations:
```
dot4add_i8packed -> OpSDot + OpIAdd
dot4add_u8packed -> OpUDot + OpIAdd
```
Note that the `OpSDotAccSat` and `OpUDotAccSat` operations are not
matching the HLSL intrinsics as there should not be any saturation.
The SPIR-V test for these intrinsics is also updated by copying and
adjusting the corresponding test from the DXIL side.
Fixes https://github.com/microsoft/DirectXShaderCompiler/issues/4528
Two commits in this one:
azure-pipelines: Fix ASAN not being enabled on Linux bot
Unfortunately, the following CL did not correctly spell out the CMake
variable to enable ASAN properly:
https://github.com/microsoft/DirectXShaderCompiler/pull/5799
This commit fixes that.
azure-pipelines: disable ASAN alloc_dealloc_mismatch checks
We are currently hitting false positives because of this. See the issue
I opened: https://github.com/microsoft/DirectXShaderCompiler/issues/5971
Perhaps a future Linux image will include a build of libc++ that does
not exhibit this false positive, at which point this workaround can be
reverted.
Two commits:
azure-pipelines: Use 'lld' linker for Linux builds
This should speed up the total build time using a faster linker.
azure-pipelines: Add verbose flag to LLVM_LIT_ARGS
With `--xunit-xml-output` set, stderr is not fed to stdout, so we cannot
easily see the errors in the build log. The errors only appear in the
pipeline's "Test" tab. Adding the verbose flag allows it to also output
stderr to the log.
…Vertex
arg1ConstExpr->getValue() returns an APInt by value, and we were calling
getRawData() on the returned temporary, making the pointer dangle after
the statement executed, and the APInt temporary was destroyed. Fixed by
keeping the returned APInt on the stack.
PixStructAnnotation tests were converting an IDxcBlobEncoding to a
std::string, but this isn't valid if the underlying object is an
InternalDxcBlobEncoding_Impl, which holds a buffer that may not be
null-terminated. Fix this by using the BlobToUtf8 helper, which handles
this case gracefully.
Fixes 23 ASAN failures.
Reorder the GetStatus check that earlies out of the function before
creating a MemBufferCopy, otherwise it leaks upon early out.
This is a quick fix, but not the ideal one. The unique_ptr<MemoryBuffer>
gives the false impression that the buffer will be automatically cleaned
up; however, MemoryBuffer is just a pair of string and raw pointer to a
buffer, so no cleanup occurs. Indeed, there's no real need for
unique_ptr at all here. The ASTUnit::RemappedFile is passed down a chain
of functions until SetupCompilerCommon is called, where the buffer is
passed to compiler.getPreprocessorOpts().addRemappedFile, where
ownership is established. Ideally, a unique_ptr to the buffer would be
passed down, safely transferring ownership so that if an error occurs,
no memory is leaked. This will be for another day.
Moving some tests from CodeGenDXIL to HLSLFileCheck because they will be properly gated on validator version here. These can be moved back once we have support for this in lit shell test.
Added %dxilver for %dxv tests requiring new validator version.
Moved `DXILValidation/Metadata` tests to `HLSLFileCheck/validation/Metadata` to allow %dxilver. Needed to add RUN line for the HLSL file there.
Added -select-validator internal to lit shell test that checks diagnostics, thus does not run through validation, and shouldn't be limited by external validator version.
Updated version requirement in ValidationTest::AtomicsInvalidDests because the message was changed in the latest validator version.
The use of OpKill has been deprecated in later versions of spir-v, and
should not be used when OpDemoteToHelper is available. This commit
makes the use of OpKill in the implementation of clip conditional on the
extensions available and the vulkan version used.
Fixes#5955
Previously, there would be no recursion validation performed on any
function declarations in library shaders. This PR adds code that
validates that no function declarations that are found inside library
shaders are recursive. The diagnostics aren't repeated, since there's
logic to prevent the same diagnostic from being emitted by 2 similar
ancestors of the same recursive function. The PR also adjusts recursion
detection for shaders in non-library cases, and improves the original
diagnostic by adding information about the name of the function that is
recursive. The PR is meant to complete the work on issue #5789. However,
more work needs to be done for full accuracy.
The PR checks *all* function declarations in the translation unit for
the library shader case, when it should really only be checking a subset
of function declarations. This issue is filed here: #5857Fixes#5789
Implicit casts of double to integer types result in UB if the value
cannot be represented as the target integer type. Use the APSInt
facilities to round the double, and truncate as necessary.
verify that the input record field with SV_DispatchGrid semantic is a
valid type: 32 or 16-bit uint scalar or array/vector with up to 3
components.
Fixes#5845
---------
Co-authored-by: Chris B <cbieneman@microsoft.com>
- Reorganize part and table IDs to move shader info after ver 1.8
- Move NodeShaderInfo into RuntimeDataFunctionInfo2 shader info union,
since it is mutually exclusive with other shader types
- Remove RuntimeDataFunctionInfo3
- Re-organize RDAT_LibraryTypes into 3 sections by versioning
- Format unformatted section of RDAT_LibraryTypes due to typo
- Add indentation to make definitions easier to read and disable
clang-format for RDAT_LibraryTypes.inl and RDAT_SubobjectTypes.inl
- Include Node in ShaderStageFlags for 1.8+
- Added some explicit scopes due to VS IDE thinking they were ambiguous
- RDATDumper: Don't try to visit or print null records
- Fix reflection tests:
- tests meant to check shader info use: -Vd -validator-version 0.0
- use regex for record strides for versioning robustness
- update ShaderStageFlags to include Node
- use regex for RuntimeDataFunctionInfo name for versioning robustness
- remove shader info CHECKs for cases not meant to test that
Fixes#5900
Fix module loading and validation issues
There are a couple interacting issues:
1. When RefreshCache occurs, it doesn't fill in the m_pResRetType cache.
- This is because in GetOpFunc, if it finds a function matching the
expected name, it simply returns that, skipping function type
construction.
- This causes a validation error if CheckAccessFullyMapped is validated
before a function that calls it. This depends on the order of
function declarations/definitions in the module.
- The solution is to move the check after type construction, and verify
that the function type matches expectations as well.
2. When RefreshCache() and FixOverloadNames() was called from
DxilOperations
constructor, the m_LowPrecisionMode has not yet been set, leading to
incorrect overload types when allowing function type construction to
proceed in GetOpFunc before looking for a matching function by name.
- This leads to an incorrect type for 16-bit CBufRet type being used.
- The solution is to move RefreshCache() and FixOverloadNames() calls
to after we actually know the m_LowPrecisionMode, so that the correct
types may be constructed.
Rename hlsl::OP::SetMinPrecision to InitWithMinPrecision to make clear
what's being done.
Added validation tests to verify the fixes.
Fixed validation test that produced invalid DXIL op function signature.
Fix HLModule not setting min-precision mode when loading from metadata.
Fixes#5879
Added InitSupport to setup m_dllSupport and m_pIncludeHandler.
Work around GetTempPathW and GetFileSize.
RewriterTest.RunNonUnicode is disabled for dependent on Greek language
support.
This is for
https://github.com/microsoft/DirectXShaderCompiler/issues/5877
This commit adds the execution mode to compute shaders when derivatives
are used. I only added a single test because the derivatives are all
handled in one place. The choice of execution mode was tested using the
implicit LOD instructions.
1. Replace extension AMD_shader_explicit_vertex_parameter with
KHR_fragment_shading_barycentric as they define same semantic.
2. Support new usage of SV_BaryCentrics and PerVertexKHR decorated
input.
3. For per-vertex inputs, they will be used as an array if a shader call
new intrinsic GetAttributeAtVertex explicitly.
4. Support mixed deprecate usage of `nointerpolation` qualifier. When
use non-interpolated inputs outside new intrinsic, it will be treated as
accessing to first provoking vertex : data[0]. But it will still be
treated as an array if used as a function call's argument.
5. As now we allow mixed usage of this kind of inputs, add spirv
instruction operand replacement in DXC. A new visitor will replace
normal access to those inputs with a new AccessChain instruction targets
its first element.
6. For bool and bool vector type, we reconstruct a new bool/boolVec type
array in entry function wrapper.