ftime-trace-granularity test was failing in test runs due to the
configured time filter value being too small. The latest test run was
recording duration times of 322308 which is larger than the test's
specified filter value of 99999 causing timings to not be filtered out.
The test is now updated to have a filter value of 999999, which should
properly filter out timings.
Fixes#6528
---------
Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
Implements hlsl-specs proposal 0011, adding `vk::SpirvType` and
`vk::SpirvOpaqueType` templates which allow users to define and use
SPIR-V level types.
During memcpy replacement, the scalarrepl-param-hlsl pass will replace
certain uses of a zero-initialized global variable. The pass uses a
recursive algorithm to replace uses of that global by a zero value. The
current code expects the recursion to bottom out in an aggregate type.
But it can bottom out in a scalar integer or scalar float.
This patch fixes the scalar cases.
Lit-based pass tests are included.
In release branches we've added enforcement of AskMode where approval is
required before merging. This just adds the requisite file to the `main`
branch so that it will appear in future release branches. It DOES NOT
apply the branch protection policy, which is a setting controlled in
GitHub.
There is no policy change to contributions to main with this change.
Context-specific diagnostics are warnings with DefaultError, since in
theory they could be dead code at this stage.
There were some changes to existing Sema diagnostic hooks along the way.
SemaHLSLDiagnoseTU.cpp - HLSLMethodCallDiagnoseVisitor
- extend to non-method calls and pass CallExpr
- instead of skipping when call reached from multiple entry/export
functions, pass locallyVisited flag for skipping of redundant diags not
dependent on entry properties.
- use llvm::SmallPtrSet for DiagnosticCalls
- capture launch type for entry and pass it down
Replace DiagnoseHLSLMethodCall hook with CheckHLSLFunctionCall:
Move hook into Sema::CheckFunctionCall in SemaChecking.cpp to be general
to either a function call or a method call.
Refactor existing code in DiagnoseHLSLMethodCall into
CheckFinishedCrossGroupSharingCall called in the hook for this method.
Add CheckBarrierCall for context-free flag validity check, called by
CheckHLSLFunctionCall.
Refactor CalculateLOD checking into more generic parts, dispatched based
on IntrinsicOp from top-level DiagnoseReachableHLSLCall function.
Switch to using new note: "entry function defined here", instead of
"declared here".
Fix intrinsic checking to use IsBuiltinTable on the intrinsic
attribute's group.
**Preparation Changes**
While these could be broken out, the barrier diagnostic changes are
dependent on them, and testing for some of these is dependent on the
other parts of the barrier diagnostic changes.
Correct errors in tests, check MaxRecords for EmptyNodeOutput in AST
Note that Barrier(..., 3) means SemanticFlags: GroupSync | GroupScope.
These are only valid in a shader with a visible group, and GroupSync on
memory with at least group scope, so they have been changed to 0 in
specific cases in these tests.
Make DiagnoseSVForLaunchType a static function, add FIXME notes.
Use StringRef for IsBuiltinTable, compare strings instead of pointers.
Fix FileCheckerTest for -verify output.
New ShaderModel::HasVisibleGroup uses ShaderKind and NodeLaunchType to
determine whether shader type has a visible group.
Make TextDiagnosticPrinter::setPrefix a virtual function in base class
DiagnosticConsumer. This allows us to avoid using dynamic_cast in
BackendConsumer::DxilDiagHandler, required for codebases that do not
enable RTTI. This is also the only place in the codebase that uses RTTI
(AFAICT).
This commit fixes the setlocale( ) logic to include the UTF-8 supported
string value for Mariner distros.
It also introduces a new RAII class `ScopedLocale' which ensure that the
locale setting is set/reset during string conversion operations.
Fixes: #6201
---------
Co-authored-by: Cooper Partin <coopp@ntdev.microsoft.com>
Co-authored-by: cooppunix <cooppunix&mariner.com>
SPIR-V supported OpBitFieldInsert on all integer types. But Vulkan
requires the operands to be 32bit integers.
This means we need to emulate this instruction for types other then i32.
This PR only adds emulation for OpBitFieldInsert. The next PR will add
support for emulating OpBitFieldExtract,
Related to #6327
---------
Signed-off-by: Nathan Gauër <brioche@google.com>
Invalid thread group size testing is included in the compiler/validator
tests (PR #6332, commit 696a13a). It does not belong in the execution
tests because is it not verifying the driver execution results. The
shaders with invalid thread group sizes fail validation and cannot be
executed.
Also fixing compile warning and override defines in the derivatives test
HLSL code.
Note that the test is incorrectly using the term `dispatch size` instead
of `thread group size`.
Fixes internal bug #49806539. Reported from RITP pass.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
When codegen is broken, and spirv-dis fails, DXC doesn't return any
error, and simply displays nothing, and returns 0.
Signed-off-by: Nathan Gauër <brioche@google.com>
This commit adds new sema checks for SPIR-V to restrict the scope of the
feature: the `nointerpolation` attribute is now required on all
parameters used in GetAttributeAtVertex, and doesn't propagage magically
to parent/child functions.
The current accepted cases this now blocks were mostly broken later in
the codegen, so this should be an acceptable 'regression'.
Related to #6220Fixes#6384, #6383, #6382
---------
Signed-off-by: Nathan Gauër <brioche@google.com>
Error message was updated in #6196 which cause test fail on older
validator.
Since this issue is only caused by error message update, the validation
itself is still the same.
The compiler didn't generate anything that behaves badly with older
validators.
So just limit these tests to sm6.8+ to make it work on older validator.
These features were not included in the dxexp output and they are
important to query for HLK test reports.
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Some SPIR-V types are not direct translations of an AST type, hence they
don't have an AST type attached to it.
The code didn't checked for this possibility when visiting all
variables.
Fixes#2955
Signed-off-by: Nathan Gauër <brioche@google.com>
The struct size & alignment computations were wrong when
bitfields were in use. This was due to a mismatch between size
computations at the AST level, and at the SPIR-V level.
This commit adds logic to correctly compute bitfields offsets on
an AST struct.
**note: there are 2 commits in this PR, one that moves code around with
no change, and one that adds the logic. To help you review.**
Fixes#5648
---------
Signed-off-by: Nathan Gauër <brioche@google.com>
DXIL had a check in the backend for those values.
Moving it to Sema to share it between DXIL and SPIR-V.
Fixes#6387
Signed-off-by: Nathan Gauër <brioche@google.com>
The original payload access qualifiers change disallowed disabling them
on 6.8+ versions. This wasn't an intended feature of 6.8. We'd prefer to
maintain the ability to disable these when needed to avoid issues that
might crop up.
This change extends respect of the disable-payload-qualifiers flag for
all versions. It rewords the warning that is produced when they are
encountered when disabled to be more applicable. Tests are also added to
verify that the implicit enabling in 6.7+ works in the basic cases and
also that disabling in the 6.7+ cases works as well.
Fixes#6462
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
When implementing bitfields, we miss a code path which lowered the AST
type to the SPIR-V type, and thus failed to propagate the bitfield
information.
This commit addresses that.
Fixes#6409
Signed-off-by: Nathan Gauër <brioche@google.com>
These are semantic verification tests, the `-spir-v` option is not
necessary.
It also breaks our internal test passes for builds that do include
SPIR-V backend.
When deleting an unused memcpy, ScalarReplAggregatesHLSL was attempting
to delete both the target and the source of the memcpy without first
checking if they were both same, resulting in a double-delete.
This adds a new issue template for user support issues. These are
distinct from bug reports because they may not be bugs and might just be
users needing help.
According to the documentation: "A hull shader is implemented with an
HLSL function, and has the following properties: [...] The shader output
is between 1 and 32 control points".
https://learn.microsoft.com/en-us/windows/win32/direct3d11/direct3d-11-advanced-stages-tessellation#hull-shader-stage
This change adds a check to verify that the outputcontrolpoints
attribute is set on Hull shaders and has an argument in the valid range.
Fixes#3733 (by making the error consistent between backends)
Before SM4, POSITION was equivalent to today's SV_Position. However, as
HLSL moved to system semantics (SV_), the support for those old
semantics has been deprecated.
Some like VFACE are now completely forbidden, but others like POSITION
or COLOR have been handled differently by FXC and DXC.
Today, usage of POSITION in place of SV_Position is probably a mistake
as POSITION is now considered to be a user-defined semantic.
This commit adds a warning when POSITION is used as an output semantic
for a vertex shader, as most cases should be the result of a mistake. If
this is expected, the warning can be disabled by using
`-Wno-dx9-deprecation`.
Fixes#3742
---------
Signed-off-by: Nathan Gauër <brioche@google.com>
Use identifier name without check the identifier exists will cause
crash.
Fixes#6426
---------
Co-authored-by: Tex Riddell <texr@microsoft.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
When lowering an hl.cast, when the operand was an undef matrix, the pass
would insert a call to a mat2vec stub, but since the undef value is not
an alloca, it never gets handled, and the call to the temporary stub
remains. Since the stub FunctionVal gets deleted, when the instruction
is accessed in a future pass, it reads a dangling pointer.
The fix is to handle undef similarly to how constant 0 is handled, and
to return an undef vector from lowerHLCast.
---------
Signed-off-by: Chris Bieneman <cbieneman@microsoft.com>
Co-authored-by: Antonio Maiorano <amaiorano@google.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
If last arg lpUsedDefaultChar is non-null, the function must set this
value to true or false. WideToEncodedString conditionally passes in a
pointer to 'usedDefaultChar', which was not getting written to, and
causing ubsan to fail on reading an invalid boolean value:
```
.../lib/DxcSupport/Unicode.cpp:156:14: runtime error: load of value 208, which is not a valid value for type 'BOOL' (aka 'bool')
```
Use `isIntegralOrEnumerationType` instead of `isIntegerType` in a couple
places so that enum values can be evaluated to `SpirvConstantInteger`
Fixes#6421
The list initializer code was not always checking the initializer list
size before reading it, causing crashes.
Checking the list size led me to discover paths in which the code could
crash by dereferencing null pointers.
Added a few guards to check if a subpath failed before continuing.
Fixes#6143
Signed-off-by: Nathan Gauër <brioche@google.com>
Bumps [cryptography](https://github.com/pyca/cryptography) from 41.0.6
to 42.0.4.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/pyca/cryptography/blob/main/CHANGELOG.rst">cryptography's
changelog</a>.</em></p>
<blockquote>
<p>42.0.4 - 2024-02-20</p>
<pre><code>
* Fixed a null-pointer-dereference and segfault that could occur when
creating
a PKCS#12 bundle. Credit to **Alexander-Programming** for reporting the
issue. **CVE-2024-26130**
* Fixed ASN.1 encoding for PKCS7/SMIME signed messages. The fields
``SMIMECapabilities``
and ``SignatureAlgorithmIdentifier`` should now be correctly encoded
according to the
definitions in :rfc:`2633` :rfc:`3370`.
<p>.. _v42-0-3:</p>
<p>42.0.3 - 2024-02-15
</code></pre></p>
<ul>
<li>Fixed an initialization issue that caused key loading failures for
some
users.</li>
</ul>
<p>.. _v42-0-2:</p>
<p>42.0.2 - 2024-01-30</p>
<pre><code>
* Updated Windows, macOS, and Linux wheels to be compiled with OpenSSL
3.2.1.
* Fixed an issue that prevented the use of Python buffer protocol
objects in
``sign`` and ``verify`` methods on asymmetric keys.
* Fixed an issue with incorrect keyword-argument naming with
``EllipticCurvePrivateKey``
:meth:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey.exchange`,
``X25519PrivateKey``
:meth:`~cryptography.hazmat.primitives.asymmetric.x25519.X25519PrivateKey.exchange`,
``X448PrivateKey``
:meth:`~cryptography.hazmat.primitives.asymmetric.x448.X448PrivateKey.exchange`,
and ``DHPrivateKey``
:meth:`~cryptography.hazmat.primitives.asymmetric.dh.DHPrivateKey.exchange`.
<p>.. _v42-0-1:</p>
<p>42.0.1 - 2024-01-24
</code></pre></p>
<ul>
<li>Fixed an issue with incorrect keyword-argument naming with
<code>EllipticCurvePrivateKey</code>
:meth:<code>~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey.sign</code>.</li>
<li>Resolved compatibility issue with loading certain RSA public keys in
:func:<code>~cryptography.hazmat.primitives.serialization.load_pem_public_key</code>.</li>
</ul>
<p>.. _v42-0-0:</p>
<p>42.0.0 - 2024-01-22</p>
<pre><code>
</tr></table>
</code></pre>
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fe18470f7d"><code>fe18470</code></a>
Bump for 42.0.4 release (<a
href="https://redirect.github.com/pyca/cryptography/issues/10445">#10445</a>)</li>
<li><a
href="aaa2dd06ed"><code>aaa2dd0</code></a>
Fix ASN.1 issues in PKCS#7 and S/MIME signing (<a
href="https://redirect.github.com/pyca/cryptography/issues/10373">#10373</a>)
(<a
href="https://redirect.github.com/pyca/cryptography/issues/10442">#10442</a>)</li>
<li><a
href="7a4d012991"><code>7a4d012</code></a>
Fixes <a
href="https://redirect.github.com/pyca/cryptography/issues/10422">#10422</a>
-- don't crash when a PKCS#12 key and cert don't match (<a
href="https://redirect.github.com/pyca/cryptography/issues/10423">#10423</a>)
...</li>
<li><a
href="df314bb182"><code>df314bb</code></a>
backport actions m1 switch to 42.0.x (<a
href="https://redirect.github.com/pyca/cryptography/issues/10415">#10415</a>)</li>
<li><a
href="c49a7a5271"><code>c49a7a5</code></a>
changelog and version bump for 42.0.3 (<a
href="https://redirect.github.com/pyca/cryptography/issues/10396">#10396</a>)</li>
<li><a
href="396bcf64c5"><code>396bcf6</code></a>
fix provider loading take two (<a
href="https://redirect.github.com/pyca/cryptography/issues/10390">#10390</a>)
(<a
href="https://redirect.github.com/pyca/cryptography/issues/10395">#10395</a>)</li>
<li><a
href="0e0e46f5f7"><code>0e0e46f</code></a>
backport: initialize openssl's legacy provider in rust (<a
href="https://redirect.github.com/pyca/cryptography/issues/10323">#10323</a>)
(<a
href="https://redirect.github.com/pyca/cryptography/issues/10333">#10333</a>)</li>
<li><a
href="2202123b50"><code>2202123</code></a>
changelog and version bump 42.0.2 (<a
href="https://redirect.github.com/pyca/cryptography/issues/10268">#10268</a>)</li>
<li><a
href="f7032bdd40"><code>f7032bd</code></a>
bump openssl in CI (<a
href="https://redirect.github.com/pyca/cryptography/issues/10298">#10298</a>)
(<a
href="https://redirect.github.com/pyca/cryptography/issues/10299">#10299</a>)</li>
<li><a
href="002e886f16"><code>002e886</code></a>
Fixes <a
href="https://redirect.github.com/pyca/cryptography/issues/10294">#10294</a>
-- correct accidental change to exchange kwarg (<a
href="https://redirect.github.com/pyca/cryptography/issues/10295">#10295</a>)
(<a
href="https://redirect.github.com/pyca/cryptography/issues/10296">#10296</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/pyca/cryptography/compare/41.0.6...42.0.4">compare
view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=cryptography&package-manager=pip&previous-version=41.0.6&new-version=42.0.4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/microsoft/DirectXShaderCompiler/network/alerts).
</details>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Struct lowering is slightly different for push constants, and we didn't
checked if the field was static or not.
In SPIR-V, when a field is const static, we either replace all loads by
a the immediate (when usage is `Struct::field`), or create a global
variable we initialize to the correct value and reference instead. The
field is then ignored from the struct definition, and this variable is
used.
This hasn't changed with this commit, I just made push-buffers use the
same logic.
Fixed#6006
---------
Signed-off-by: Nathan Gauër <brioche@google.com>
The `ComputeSampleTest` is verifying `Sample` and
`CalculateLevelOfDetail` intrinsics calls on a texture in compute, mesh
and amplification shaders. The test is set up in a way that the reported
LOD values should be increasing as the X and Y coordinates increase.
However, since the test results are stored in quad z-order, and it is
perfectly valid for the X-derivative-LOD to decrease when going from
top-right to bottom-left pixel in a quad because in this case the X
coordinate decreases. Therefore, the test needs verify the LOD values
are increasing everywhere except for the bottom-left quad pixel (every
output with `index % 4 == 2`).
Previously, the test coincidentally worked for compute shaders because
it uses thread group of 336 and the 1/336 difference between 0 and pixel
1's X coordinate is not sufficient to change LODs. For mesh, however,
since the limit of a thread group size is 128, the validation is done
using the smaller range of 116, and 1/116 is sufficient to change LOD
for pixel 1.
This PR also fixes a couple of mismatched thread group dimensions in
`VerifySampleResults`.
The shader code for this test is at
[ShaderOpArith.xml](130877392c/tools/clang/unittests/HLSLExec/ShaderOpArith.xml (L454))
line 454.
Fixes#4788Fixes#6181
---------
Co-authored-by: Greg Roth <grroth@microsoft.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
The MSDN spec is not very clear regarding input parameter aliasing, BUT
DXIL & MS agrees (See #3737) using the same semantic annotation twice
should be disallowed.
DXIL currently disallows it for most, and due to a bug, allows some
compute related semantics to be aliased.
SPIR-V did allowed aliasing, but it was a implemented as a hack causing
typing issues if the type changed between the 2 parameters using the
same semantic annotation.
To align more closely with DXIL, and the "spec", we are now disallowing
all semantic attribute reuse for input parameters.
Fixes#3737
Signed-off-by: Nathan Gauër <brioche@google.com>