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

54 Коммитов

Автор SHA1 Сообщение Дата
Xiang Li 5155b0934c
[Validator] Check content of PSV0 part in validation (#6859)
Replace the memcpy check for PSV0 part.
Build DxilPipelineStateValidation object from data in PSV0 part. Then
compare the content with information from input DxilModule.

With this change, the order of signature elements and resources could be
different between the container and the DxilModule.
And the StringTable could be in different order as well.

Second step for #6817
2024-09-19 07:24:28 -07:00
Xiang Li 0e7591a6ee
[NFC] Move DxilValidation to a dedicated folder. (#6849)
Move DxilValidation out of HLSL.
Also move code to validate dxil container into
DxilContainerValidation.cpp from DxilValidation.cpp.

This is a preparatory step for #6817.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-08-13 17:33:09 -07:00
Helena Kotas 49d1ae9a02
Add duplicate pragma (#6732)
Internal build that has DXC as a submodule and that is built with a
different VC toolset version started failing after the pragma got moved
up in commit 0b9acdb75. Adding a duplicate pragma back at the original
location makes both compiler versions happy.
2024-06-27 22:30:22 +00:00
Chris B 0b9acdb75e
Workaround broken GitHub runner images (#6683)
This PR contains two changes:
1) Moves a pragma to disable a warning, which seems to be required by
the new compiler.
2) Adds a preprocessor define to workaround the crashes caused by the
runner image mismatching C++ runtime versions.

The second change we will want to revert once the runner images are
fixed. The issue tracking the runner images is:

https://github.com/actions/runner-images/issues/10004

Related #6668
2024-06-11 10:02:33 -05:00
Cooper Partin 422a60e6d0
Update locale setting logic to support UTF-8 only for Apple and Linux distros (#6488)
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>
2024-04-10 10:04:32 -07:00
Xiang Li 956fa34b4f
[ClangCL] Cleanup rest clang-cl warnings (#5847)
1. printf format mismatch.
2. avoid cast from CComPtr<IncludeHandlerVFSOverlayForTest> to
CComPtr<IDxcIncludeHandler>.
3. fix signed unsigned mismatch.
4. fix order of fields in constructor.
5. add override for override methods.
6. port
01f4209631
7. add copy assignment operator to avoid
-Wdeprecated-copy-with-user-provided-copy
8. disable -Wignored-qualifiers for taef header WexTestClass.h.
9. remove unused fields.
10. add -clang-cl for hctbuild.
2023-10-16 19:40:51 +00:00
Xiang Li dd8a287bec
[ClangCL] fix warning in DxbcConverter (#5694)
1. fix order of fields in constructor.
2. fix compare warning for type mismatch by cast to same type.
3. use {} instead of {0} when initialize to all zero.
4. add override for override methods.
2023-10-09 16:58:37 -04:00
Minmin Gong 755d111ccd
Fix several bugs in code (#4516)
1. Wrong usage of memset
2. Member initializer list in order of declaration
3. Add explicit to MSFileSystemHandle's single parameter constructors
2023-09-25 23:11:25 -07:00
Minmin Gong fc05f49254
More conforming to C++ standards (#4521)
1. Can't mix char* and const char*
2. Remove redundant const and std::move
3. Use standard types and macros to replace platform dependent ones
2023-09-23 18:01:44 -04:00
Chris B 37ed613864
[NFC] Clang-format DXC sources (#5602)
This change applies clang-format to all of the sources added in DXC that
were not part of the original LLVM/Clang 3.7 release when DXC forked.
This provides consistent code formatting across the codebase.

Fixes #5591.
2023-09-19 07:49:22 -05:00
Greg Roth 4d132f95ff
[lit] allow for spaces in taef commands (#5720)
The way taef tests were gathered and executed previously flattened the
list of arguments to a string. This allowed the weird /select: flag to
work correctly, but if any of the arguments had spaces, they were
misinterpretted having lost the implicit quotes around each.

By removing the flattening, putting a space between the flag and the
argument for /select: and removing the explicit quotes around that
argument, the command executes properly whether there are spaces or not

Additionally added a way to detect when these commands failed since they
were silently failing and skipping a large swath of testing when spaces
were present.

Fixes #5719
2023-09-18 19:58:04 +00:00
Xiang Li 67fde16627
[CLANG_CL] Fix clang-cl warnings (#5660)
Add -Wno-unused-parameter -Wno-unknown-pragams -Wno-switch which are
enabled for clang in linux build.
Fix
-Wimplicit-fallthrough
-Wconstant-logical-operand (Thanks patch from Chris)
 -Wunused-function
-Wunused-variable
-Wtrigraphs
-Wnonportable-include-path

Still more warnings to be fixed.
2023-09-14 13:25:46 -04:00
Chris B 3266a87f9a
[NFC] Remove SAL annotations from internal APIs (#5639)
We don't keep these annotations up to date or rely on them, so to
simplify our platform layering and ease code formatting this change
removes all the SAL annotations from internal APIs. This change also
replaces most `_Analysis_Assme_(...)` annotations with `assert(...)`.

One `_Analysis_Assume_` in ParseDecl.cpp needed to be updated because it
was incorrect. The code was `_Analysis_Assume_(assert(name.size() >
sizeof("space"));`. When converted to an `assert` it fired in our test
suite because the sizeof a string literal includes the null terminator,
but the size of a StringRef does not.

A few of the `_Analysis_Assume_` annotations were removed because they
didn't make sense (like the ones inside the `DXASSERT` implementation,
and a few others were removed to avoid introducing additional header or
linkage dependencies.

This change does not introduce any functional or behavioral changes.
2023-09-14 08:59:49 -05:00
Xiang Li 6a97408eb3
[BUILD] add clang-cl to CMakeSettings (#5596)
This is for enable clang-cl build.
The change will fix build error when use clang_cl_x64_x64 with
CMakeSettings.

Still many warnings and other issue to fix.
2023-08-28 20:13:06 +00:00
Chris B 578114efb9
[NFC] Update DXC sources for clang-format (#5593)
One more batch of NFC changes to get DXC ready to clang-format. This
change disables clang-format of some include blocks and breaks other
include blocks into groups. With this change all of the sources in DXC
can be clang-formatted and will continue to build on all supported
platforms.
2023-08-24 13:55:19 -05:00
Chris B 64348c7eec
[NFC] Prepare DXC sources for clang-format (#5571)
This change prepares DXC sources to be ready to clang-format. This
change adds annotations to skip formatting parts of the code that will
break if clang-format modifies them due to include ordering or generated
C++. It also adds missing include and forward declarations where
clang-formatting resulted in moving things around that caused code
breakages.
2023-08-23 15:15:21 -05:00
Xiang Li f6a90f07ca
[C++17] Force C++17 when build DXC (#5520)
This is for enable clang-cl build on windows.

The gtest fix is merging from

f66ab00704
to work around 'operator <<' is ambiguous on DefaultPrintNonContainerTo.
2023-08-22 13:20:27 -04:00
Helena Kotas 96e13a0e0a
Lit TAEF fixes: Use filter when listing tests and fix verbose parameter (#5494)
Lit TAEF files fixes:
- Use filter parameter when enumerating tests. This enables listing of
just the tests that should run, and it also filtering by architecture.
This is crucial for isolating ARM64 and ARM64EC versions of tests that
are in the same test dll.
- Fix verbose parameter - it was not getting applied
- Enable verbose on all tests - the output is shown only when the test fails

Related to #5489.
2023-08-08 10:28:39 -07:00
Antonio Maiorano 44f8833938
Add macro to disable usage of allocator overrides (#5296)
Add macro DXC_DISABLE_ALLOCATOR_OVERRIDES which, if defined, will use
the default CRT allocator for new/delete and malloc/realloc/free.

We need this on Chrome for our GN build of DXC, because our component
builds use libc++as a shared library, and we end up with mismatched
new/delete calls between libc++ and these custom overrides.

---------

Co-authored-by: Chris Bieneman <cbieneman@microsoft.com>
2023-07-17 15:27:30 -04:00
Helena Kotas 40e3d02e5c
Revert "[DxbcConverter] Fix corruption of ICB integer values (#4790)" (#5253) (#5279)
This reverts commit 0a1f7a19f4.

Use an array of 32-bit integer values instead of 32-bit float values for the "dx.icb" immediate constant buffer data.
This prevents the FPU flipping the 22nd bit of integer constants, when their bit pattern represents a float32 signalling NaN on x86 architecture.

This change is causing rendering issues on PCs with AMD GPU and is blocking an upcoming Windows release.

The target branch of this revert is a release branch based on release-1.7.2212 at commit 83f8c6c5 and it will be used for the upcoming Windows release. The dxilconv change stays in main, at least for now.

(cherry picked from commit 03df61df18)
2023-06-08 12:02:27 -07:00
Greg Roth ae51624fca
Allow libdxcompiler.so and dxc to find libdxil.so (#5004)
When present in the library search path, linux builds of
libdxcompiler.so and the dxc executable should load libdxil.so and use
it for validation and signing. However, the code to do that was still
searching for dxil.dll even on these platforms.

This change creates appropriate names for the dxcompiler and dxil
libraries for each platform and uses them where appropriate.

In addition, this changes some of the internal interfaces from wide
chars to simple chars as the wide interface wasn't useful here.
2023-02-10 04:24:22 +00:00
Xiang Li 689084cadd
Fix lit test fails (#4973)
1. added dxc_batch as dependent for clang tests.
2. Not run exec test by default.
3. Strip directory which has dxil.dll from %PATH% for taef test which not need it.
4. Add select_filter and use @Name for TestName.
    * Enable mix select filter by use shell=True when open subprocess.
5. Only run execution test when dxil.dll exist or experimental mode enabled.
2023-02-02 16:24:03 -08:00
Xiang Li 9c3dab6896
Add lit test for execution test. (#4964)
* Add lit test for execution test.
* Treat taef skipped as lit Unsupported.
2023-01-27 01:34:56 +00:00
Chris B ac3a6ae9f4
Enable building with ninja through Visual Studio (#4889) 2023-01-05 23:07:36 -06:00
Greg Roth 7ad9c9c032
Fallthrough (#4843)
A common source of bugs. Although many of these were harmless, some were
not. By eliminating them and enabling this warning as an error, we won't
add more in the future.


Fixed a real SPIRV bug that required a test update to expect the correct behavior.
SPIRV testing was expecting incorrect results that came from a fallthrough error
2022-12-09 10:13:56 -08:00
harshpg 6eedcd2afa
Replacing fileIO exceptions with error codes (#4841)
Exceptions for error handling can have a significant performance impact. The exception-throw codepaths are usually cold, and rely on large in-memory tables that need to be paged in.

This change to instead propagate returned error codes simplifies the code and allows the compiler to more aggressively optimize around both success and failure conditions.
2022-12-05 16:24:30 -06:00
Chris B 7d9567cf80
Enable running tests under LIT (#4813)
* Enable running tests under LIT

If `CLANG_INCLUDE_TESTS=On`, the googletest unit tests are built as
part of the clang unit test suite. This allows them to run via lit
using the `check-clang-unit` target.

* Configure DXILConv tests to run under check-all
2022-11-29 18:59:16 -06:00
Ben Clayton 0a1f7a19f4
[DxbcConverter] Fix corruption of ICB integer values (#4790)
Use an array of 32-bit integer values instead of 32-bit float values for the `"dx.icb"` immediate constant buffer data.
This prevents the FPU flipping the 22nd bit of integer constants, when their bit pattern represents a float32 signalling NaN on x86 architecture.

Fixes #4786
2022-11-23 11:41:56 -05:00
Chris B 8ee6ed19f3
Cleanup Windows code to conform to stricter C++ 17 compiler (#4804)
* Cleanup windows build to conform to C++ 17

MSVC's C++ language implementation deviates from the standard in a
number of ways, this patch cleans up several issues that become errors
if you build DXC using clang-cl, which has a more strict
interpreteation of C++.

This change should not have any functional impact on the final program.

Specific changes include:
* static_assert(false...) is removed, this is always ill-formed by the
C++ standard.
* Under template instantiations implicit `this` is not always allowed.
* Character array `<` comparision is... probably not what was intended.
* Implicit conversions are stricter than MSVC enforces.
* Template base types need explicit type specialization when referred
to.
* It is illegal to initialize more than one member of a union.
* Scope nested enums cannot be forward declared.
* Header paths should be case-sensitive.
* Exception specifications of specific types are disallowed in C++ 17.
* Clang is stricter about const-correctness, especially as it relates
to constant c strings.

* Update based on review feedback.

* Converted string construction to copy-constructor calls.
* Removed constexpr method bodys to cause linker error.

* Catching other methods I missed.

* I was a bit too over-zealous deleting methods.
2022-11-22 15:31:36 -06:00
Xiang Li 24ca1f498e
Support taef run in lit. (#4762)
* Support taef run in lib.

lit.formats.taef is added to run taef under lit.

New lit target check-clang-hlsl is added to run clang-hlsl-test taef tests.

Add lit-target for dxil conv to set different hlsl data dir.
2022-11-14 10:33:16 -08:00
Helena Kotas 3ee5e140fc
Remove dxilconv tests dependency on FXC to enable testing on ARM64 (#4494) 2022-06-01 15:14:31 -07:00
Tex Riddell 07bf1ae857
Fix leak of FixedSizeMemoryStream object from DxilConv (#4483) 2022-05-27 18:56:48 -04:00
Tex Riddell 0c64351247
Fix leak of DxilContainerWriter in DxbcConverter (#4400) 2022-04-19 14:22:14 -07:00
Helena Kotas e38970626d
Remove test output files; update .gitignore (#4333)
- added *.dxo.converted to the list of extensions ignored by git
- renamed 3 test outputs from .fxc to .dxbc (which will make them to be ignored by git)
2022-03-17 13:55:33 -07:00
Tex Riddell e51701e707
DxilConv: Pad copied IO signature parts (#4330)
DXBC containers from some sources may have signature parts with unaligned sizes, such as from 9on12.

This change pads these signature parts when this is the case to avoid any
problems down the line.
2022-03-16 01:03:16 -04:00
Chris B fb873d0a14
Clean up debug preprocessor macros (#4305)
* Clean up debug preprocessor macros

This change removes the `DBG` macro value in favor of `NDEBUG`, and
also converts many uses of `_DEBUG` with `NDEBUG`.

_DEBUG is set by MSVC when debug information generation is enabled.
NDEBUG is set by CMake debug configurations and by LLVM on all
configurations when `LLVM_ENABLE_ASSERTIONS` is set.

Aligning with LLVM's NDEBUG usage allows a consistent pattern
throughout the codebase.

* Address PR feedback
2022-03-02 14:55:24 -06:00
Tex Riddell b338314f6e
Implement Shader Model 6.7 (#4260)
Shader Model 6.7 is still a work in progress.
Thanks to multiple contributors at Microsoft for this work.

Added support for additional advanced texture operations, including:
Raw Gather, Programmable Offsets, SampleCmpLevel, and RWTexture2DMSAA.

Added new QuadAny/QuadAll intrinsics to help with writing quad-uniform control flow.

Added [WaveOpsIncludeHelperLanes] pixel shader entry attribute, changing the
behavior of wave ops to treat helper lanes as active lanes.
2022-02-15 11:38:42 -08:00
Xiang Li 4452103355
Change getPassName return type to StringRef. (#4247) 2022-02-10 14:14:43 -08:00
Xiang Li 53ccb3adce
Support vs2022 build. (#4031)
* Support vs2022 build.
Still some issues like dndxc not work.
2021-10-26 08:38:29 -07:00
Helena Kotas 53b2ad9ffd
Add d3d12TokenizedProgramFormat.hpp header from the Windows Driver kit (#3617)
* Add d3d12TokenizedProgramFormat.hpp header from the Windows Driver kit.

The header is now open source under the University of Illinois Open Source License.
This change reduces the DX compiler projects dependencies on WDK to TAEF testing
framework only. That means the project can be built without WDK if tests are
excluded from the build (HLSL_INCLUDE_TESTS cmake option to OFF).

Fixes #2965
2021-03-25 12:19:38 -07:00
Tex Riddell 694e5657c3
DxilConv: Fix interface translation regression (uses space != 0) (#3437) 2021-02-08 19:01:06 -08:00
Tex Riddell 9dca645a99
DxilConv: localize caching of handles instead of storing in resource obj (#3376)
Future work would be confused by current meaning of Set/GetHandle
on DxilResourceBase, which didn't make sense anyway for this narrow
use case limited to DxilConv.

This change replaces that use with a local handle Value* cache keyed off
of the resource class and slot.
This is valid only for SM 5.0 and below, where the cache applies.
It can't be used generally for SM 5.1, which is an existing limitation,
so no change here.
2021-01-20 17:39:33 -08:00
Helena Kotas 2ac188b4ce
Minor refactoring to reduce size of dxilconv.dll (#3240)
Move llvm::findScalarElement and LoopSimplifyID into separate files
Remove unused code from DxbcConverter

Reduces dxilconv.dll size from 1,225kB to 1,019kB (-17%).
Measured on x86 release build with compiler optimization for size.
2020-11-05 15:39:09 -08:00
Minmin Gong c607bb3c03
Some improvements to cmake files of dxilconv (#2876)
1. Add unittests only when HLSL_INCLUDE_TESTS is on,
2. Rename dxilconv-tests.vcxproj.user.txt to .in, that's configure_file() normally takes,
3. Use target_include_directories instead of directory-based include_directories for simplicity
2020-10-22 09:55:04 -07:00
Helena Kotas 0d11f8f17b
Add missing DxcEtw dependency to dxilconv (#3194) 2020-10-12 18:24:18 -07:00
Helena Kotas 13961cfe1f
Removing unnecessary DisableThreadLibraryCalls() calls (#3042) 2020-07-15 21:03:05 -07:00
Helena Kotas 73c0d97f0d
Enable arm build (#3030) 2020-07-08 15:10:02 -07:00
Tex Riddell b59671accf
Use HlslDataDir for DxilConv instead of DxilConvDataDir (#2961)
This was using a define before a header to change the option name.
An inline function used the define when adding the path to a filename.
Unfortunately, this header was included from multiple places with
different values defined for the variable name, and it seems that
sheer luck made it work for a while, even when called from a cpp
file that would have had it defined differently.
2020-06-09 20:19:38 -07:00
Helena Kotas 355c4fb6a3
Move Dxc runtime tracing one level up so other project can use it without referencing dxilconv (#2948) 2020-06-05 20:35:33 -07:00
Helena Kotas 1f767d7194
hcttest.cmd: Enable running standalone dxilconv tests (#2878)
Adds an option to hcttest to specify a custom set of binaries to copy to a test folder
plus a custom location of dxilconv.dll
2020-05-12 12:25:40 -07:00