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

3783 Коммитов

Автор SHA1 Сообщение Дата
Chris B ce495eb611
Fix last LLVM tests on Windows (#4829)
This handles a few last Windows fixes for LLVM tests.

* The YAML praser convertes \r to \n, resulting in repeated newlines in
  YAML tests on Windows.
* The MS filesystem changes on Windows cause one of the MemoryBuffer
  tests to fail. I've disabled that test on Windows.
* Because we convert many crash cases to exceptions on Windows the
  GoogleTest DEATH tests fail to die on Windows.

This change addresses the same issue #4794 solves, but restricts the
change to Windows only. I'm only merging this since @python3kgae is out
and I don't really want to wait until he returns.

utils/unittest/googletest/include/gtest/internal/gtest-port.h
2022-12-02 15:42:58 -06:00
Chris B 36fdecf357
Update Linux build and test workflows to use lit (#4836)
* Update Linux build and test workflows to use lit

This change updates the build and test workflows in our azure pipelines
and the GitHub action for code coverage data to use lit instead of ctest
as the test runner. This adds additional test coverage by running some
of the LLVM & Clang tests.

* Fix missing dependency between LLVMAnalysis & DXIL

The default Linux linker fails because LLVMAnalysis depends on LLVMDXIL
and BFD doesn't cycle libraries.

* Updating pipelines to remove mkdir and cd

This just cleans up the pipeline shell commands to avoid unnecissary
mkdir and cd invocations.

Based on feedback from @Keenuts. Thanks!

* Disable LLVM LIT tests that use garbage collection

DXC disabled support for the LLVM garbage collection intrinsics.
2022-12-02 12:55:14 -06:00
Chris B 3ae7054214
Tweaks and fixes to clang build and test configs (#4832)
* Tweaks and fixes to clang build and test configs

* Setup dependencies for check-clang.
* Proprely adjust shlibdir for multi-configuraiton builds.
* Move TAEF platform verification earlier to avoid issues on Linux.
* Adjust TAEF suite config to handle build_mode specialization.
* Remove another DXC_BUILD_ARCH that snuck in.
* Add the intermediate library path as an rpath for unit tests.
* Make ClangUnitTests depend on ClangHLSLTests so taef tests build.
* Add clang-test-depends and test-depends targets.

* Fix spelling error.

Thanks @hekota!
2022-12-01 11:06:42 -06:00
Adam Yang 5b2201db00
Fixed lifetime marker causing unroll to fail (#4830)
Fixed a bug where enabling lifetime markers causes unroll to fail. Running instcombine before loop unroll may cause unroll to fail, because instcombine may rewrite expressions in a way that makes ScalarEvolutions unable to evaluate. This change replaces the instcombine with simplify-inst, which serves the same purpose as the instcombine, but leaves the expression easy for ScalarEvolutions to evaluate.

Also moved the original test for instcombine to a new folder with the new test, since instcombine pass is no longer being tested for that test.

The problematic expression rewrite was as follows:
```
limit = (non_const_int_value % 2) ? 1 : 2;
```
Instcombine rewrites it to
```
limit = 2 - (non_const_int_value & 1);
```
Which stumped ScalarEvolutions.
2022-11-30 10:26:29 -08: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
Chris B ea3c096960
Disable LLVM LIT suites and tests (#4827)
Disable LLVM LIT suites and tests

This patch is a little more selective than the clang counterpart. Most
of the LLVM tests are expected to pass in DXC.

In cases where very few tests are failing for obvious reasons I've
disabled individual tests using `REQUIRES` lines. In most places I've
disabled whole suites. Any suite that is expected to pass, I've also
included a comment of the failing test cases so that we can investigate
further.

IR Verifier and Integer tests are disabled only on Windows. These tests
pass on *nix platforms but fail on Windows due to the MS filesystem
modifications causing llvm-as to crash.
2022-11-29 12:53:22 -06:00
Helena Kotas cde8ccc93c
Fix ARM build break (#4823) 2022-11-29 10:37:10 -08:00
Chris B f5442b1fb5
Disable lit shtest suites (#4822)
This disables all the existing lit shell test suites. With this change
and other inflight changes you can now run `check-clang` and have it run
successfully.

Getting this all to work also required some adjustments to the taef test
configuration since it had not been run previously as part of a larger
lit suite.
2022-11-29 12:08:31 -06:00
Chris B 4f5b48e41a
Don't cancel in-progress coverage builds (#4821)
The coverage builds take a _long_ time to run on the standard GitHub
action bots. I initially thought cancelling and restarting was a good
idea and have since reconsidered...
2022-11-28 15:35:11 -06:00
Laura Hermanns 6ef6e91b2a
Don't emit built-in 'vk' namespace in DeclPrinter (#4803) 2022-11-28 10:50:25 -08:00
Greg Roth 54c709f073
Update macos/linux builds to *-latest (#4815)
This updates the ADO yaml to select the latest version of the OS. In the
case of MacOS, this will still be 11 for now. For Ubuntu, it will
silence the warnings that we are using a deprecated version and save us
the headache of having to do this again.

The risk is that a new version of either OS will cause the build to
break without our intervention, but the real motivation for explicit
versions was an earlier impulse to support the minimal build system that
is no longer a priority. As for the risk, I feel it is minimal and we
can respond in a timely fashion if it should occur.
2022-11-28 10:06:18 -08:00
Jeff Noyle ccea7c23c1
PIX: Fix instrumentation of libraries; instruction numbering reports (#4817)
* PIX: A few fixes for instrumentation of libraries; instruction numbering reporting

* Fix for tests: don't debug-instrument the patch constant fn
2022-11-28 09:31:41 -08:00
Chris B d0e0aa92d7
Update GitHub workflow to (hopefully) work (#4812)
There were a few things missing in the initial attempt at this workflow. I left off the file extension for the CMake cache file, and also forgot to initialize the submodules.

Additionally using make is... slow. Using make `-j` causes the VM to run out of memory. To resolve those issues I'm installing ninja and using ninja instead. I'm also setting `LLVM_USE_LINKER=lld` to reduce linker memory usage and `LLVM_PARALLEL_LINK_JOBS=1` to only run one link at a time.

I've also added `--rerun-failed` and `--output-on-failure` to the ctest invocation so that if it fails we get some hopefully helpful output.
2022-11-28 11:16:55 -06:00
Greg Roth 14a55b7738
[linux] Enable Reflection on *nix platforms (#4810)
Needed for the impending enabling on *nix platforms

* Remove circular dependency from RDAT Dumper

A file included by the source that implemented various ToString
converters of reflection data to strings itself depended on those
declarations, which it only found because of the unique way MSVC
processes templates. By moving the definitions and declarations into
their own header and source files, everyone gets what they need
without ouroborosing.

* Create DirectX-Headers submodule

Creates the DirectX-Headers submodule and adds the needed defines to
allow them to be used. As yet makes no use of these headers

* Improve src dir finding error

The check for the file stream that is meant to represent the filechecked
source file wasn't sufficient to detect a non-existent file. By expanding
the error check, it can produce a helpful message.

Also initialize the failure code so it isn't random

* Enable reflection functionality and testing

This flips the switch, removing or repositioning many ifdefs and
including previously excluded files in the build.

* Actually add the DirectX-Headers submodule

* fix *nix build breaks caused while fixing win breaks :P

* Respond to feedback -- some of it anyway ;)

* simplify cmake file to exclude unneeded src dir

* fix cmake (again)

* Fix GCC template specialization finickiness

What compiler is overly permissive now huh? huh? (or just quick to adopt
new language features?)

* LPCBYTE isn't a thing

Loathe as I am to push one more commit onto this. I don't want to
propagate a misconception. I meant to remove this earlier and caught it
from one final self-review >:(
2022-11-23 19:10:29 -07: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
Greg Fischer b348d24071
[SPIR-V] Add -fspv-debug=vulkan-with-source to usage and README (#4811)
-fspv-debug=vulkan will be kept for testing purposes but will
not be documented in usage or README (for now).
2022-11-23 10:37:55 -05:00
Chris B 2f6da0f2ef
Make clang taef lit config conform to conventions (#4809)
The new taef lit configuration names don't conform to the normal
conventions which makes it difficult for them to have automatically
generated targets. This updates them to match LLVM & Clang conventions.
2022-11-22 15:32:18 -06: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
Chris B fb6b287c23
Remove DXC_BUILD_ARCH variable (#4156)
* Remove DXC_BUILD_ARCH variable

This commit simplifies the cross-targeting build support to not require
specifying the build architecture explicitly. Instead it is derived from
the build tools used in the generation.

I've tested this change locally for Win32, x64 and arm64.

* Special handling for arm64ec

* Bump required CMake to 3.10

CMake 3.10 is very old, but has a feature this PR uses. Raising the
requirement should have no impact on our users.

* Fix build issues caused by changes in CMake 3.10
2022-11-22 09:33:06 -06:00
Chris B 90b2935587
Workarounds for arm64ec build (#4808)
I encountered two issues building arm64ec. First CMake and/or link.exe
seem to have a disagreement about flag ordering and how to handle
`/INCREMENTAL`. This change results in disabling kernel-mode debugging
on arm64ec builds, but it means we can build... so that's a win.

The other issue is that libClangSema has some files that have gotten too
big, so we need `/bigobj` for Sema.
2022-11-22 09:27:16 -06:00
Chris B eb1b3ace67
Add option for building with clang-cl and ninja (#4807)
This change adds a new `-clang` flag to hctbuild. It also fixes an issue
where ninja builds were getting passed the MSBuild parallization option.
2022-11-21 19:21:32 -06:00
Chris B 590d36d4a6
Enable running unit tests without extra arguments (#4798)
This change provides a default value based on the build configuration
which can be used in the absence of a specified HLSL Data Dir when
running the tests. This does not change any existing functionality, but
enables the common configuration of running the tests inside the
configured source directory to omit specifiying a path.
2022-11-21 15:37:43 -06:00
Chris f6f90d3066
Create action to generate code coverage (#4796)
This is a first stab at generating a github action to generate code coverage reports.
2022-11-21 13:40:34 -06:00
Nathan Gauër 8f279baaef
spirv: get field index from SPIR-V type, not AST (#4806)
Before this commit, struct field indices were computed from the AST
type. This was correct as SPIR-V types and AST types had the same
structure.

When adding bitfields, we started to squash some fields together, as
long as some rules were respected (bitfield, same type, doesn't span
over multiple type-sized words, etc).
This means indices now diverge between SPIR-V types and AST types.

This requires us to lower the AST type before the lowering pass, when
generating instructions like OpAccessChain.
A cleaner alternative would be to lower all types before instruction
generation, and only operate on SPIR-V type. But cost of making this
refactoring is large, and we don't believe it is worth it since we plan
to upstream to clang (hence rewrite this code).

note: this code prevents AST indices to diverge from SPIR-V indices when
computed. This is just a safeguard until bitfields are in place in case
I made a mistake with the layout rules, allowing us to catch those bugs
faster.

Signed-off-by: Nathan Gauër <brioche@google.com>
2022-11-21 18:42:53 +01:00
Chris B f12b050405
Enable SPIR-V tests to run without arguments (#4802)
* Enable SPIR-V tests to run without arguments

This specifies a default value for the --spirv-test-root flag based on
the source directory at configuration time. This simplifies the command
line for running the tests manually, but does not alter the ability to
override the test directory explicitly.

* Restoring code I should not have deleted
2022-11-21 10:25:23 -06:00
Chris B b0d5211b5a
Fix failing LLVM ArrayRef unit test (#4800)
The initializer list goes out of scope after the expression it is used
in, so the ArrayRef points to invalid memory. This change keeps the
initialization list around so that the array ref remains valid through
the test.
2022-11-21 10:24:14 -06:00
Chris B 8869654b0d
TAEF Tests only work on Windows (#4799)
Disable the TAEF lit suite on non-Windows platforms.
2022-11-21 10:23:46 -06:00
TY-AMD 97bafd2a60
[SPIR-V] Add support for the extension VK_EXT_mesh_shader (#4725)
* Support VK_EXT_mesh_shader

* Fix errors when compiling with SPV_NV_mesh_shader

* Minor tweak onto amplification shaders

* Fix pre-checkin failure

* Add amplification and mesh tests for EXT_mesh_shader

* Add some comments

* Fix primitive indices

Co-authored-by: Tianyuan <Tianyuan.Wu@amd.com>
2022-11-18 15:43:59 -08:00
Chris B 55be2117a6
[CMake] Simplify code coverage CMake configuration (#4793)
* [CMake] Simplify code coverage CMake configuration

This just addes an option processed by the CMake cache file to configure
code coverage for DXC. With this patch you can generate a coverage
report locally if you build with Clang using the following commnads:

cmake -G Ninja -DDXC_COVERAGE=On <other options> -C
<path to dxc>/cmake/caches/PredefinedParams.cmake <path to dxc>
ninja
ctest
ninja generate-coverage-report

* Adding code comment explaining caches

CMake cache scripts aren't super common, but are very useful. Adding a
comment to explain how they work is probably generally valuable.
2022-11-17 14:53:32 -06:00
Nathan Gauër 4670813096
misc: fix clang warnings: deprecated,bitwise-logic (#4776)
Fixing some clang warnings about mixing logical and bitwise and
the use of one deprecated CPP type (Removed in cpp17, same change
as seen in #4761).

Some are using those bitwise operation to avoid operator laziness. It
was fixed upstream by an int cast, applying the same fixes.

Signed-off-by: Nathan Gauër <brioche@google.com>
2022-11-16 19:52:09 +01:00
Xiang Li 6dd31be007
On Windows, use CreateFileW to delete files in sys::fs::remove. (#4791)
* On Windows, use CreateFileW to delete files in sys::fs::remove.

Merged from
0f9e889881

This will fix fail on llvm unit test ProgramTest::CreateProcessLongPath.

Use MSFileSystemRef::CreateFileW.
2022-11-15 22:59:10 -08:00
Chris B 3962ff2f80
Bring in code coverage tooling (#4759)
This cherry-picks in a bunch of upstream LLVM changes and has a few small modifications for DXC.

* [CMake] Add LLVM_BUILD_INSTRUMENTED option to enable building with
-fprofile-instr-generate

This is the first step in supporting PGO data generation via CMake.
I've marked the option as advanced and experimental until it is fleshed
out further.

llvm-svn: 255298

* Add support for collating profiles for use with code coverage

Differential Revision: http://reviews.llvm.org/D20993

llvm-svn: 272599

Patch by: Vedant Kumar <vsk@apple.com>

* [CMake] Add targets for generating coverage reports

This is a pretty small bit of CMake goop to generate code coverage
reports. I always forget the right script invocation and end up
fumbling around too much.

Wouldn't it be great to have targets that "Just Work"?

Well, I thought so.

At present this only really works correctly for LLVM, but I'll extend
it in subsequent patches to work for subprojects.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D109019

* Update prepare-code-coverage.py from llvm/main

Theres's a swath of changes that went in here. Cherry-picking them all
indivudially is not worth it. Contained commits:

8773822c578a [Zequan Wu] [Utils] Add -compilation-dir flag to
prepare-code-coverage-artifact.py
577d59bc679d [Nico Weber] svn propset svn:executable on
utils/prepare-code-coverage-artifact.py
9a10eac663dd [Chris Bieneman] [Coverage] Apply filtered paths to summary
16776315460e [Vedant Kumar] [utils] coverage: Add help text about the
--restrict flag (NFC)
f4df0edf3ea3 [Vedant Kumar] [utils] Add a '--unified-report' option to
the code coverage prep script
7466987cb7ba [Vedant Kumar] [utils] Use print_function in the code
coverage prep script, NFC.
273b6dc3e2f7 [Vedant Kumar] [utils] Add an '--only-merge' option to the
code coverage prep script
547ebad0b984 [Vedant Kumar] [utils] Teach the code coverage prep script
about --restrict
05ee94f1b573 [Vedant Kumar] [utils] Generate html reports with the code
coverage utility script
d9aed82cf7e2 [Vedant Kumar] Add support for collating profiles for use
with code coverage

* HLSL-specific change to coverage reporting

This works around DXC not having a cmake target to run tests by
exposing a new variable which can configure which target gets run to
produce profiles. A similar change will be useful upstream, so I'll add
a change there too.
2022-11-15 12:17:03 -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
Adam Yang f9bc4f598b
Fixed bug where MergeGepUse doesn't return true (#4785)
Variable `changed` should be set to true as soon as `MergeGEP` returns a value.
2022-11-11 12:21:26 -08:00
Adam Yang 0392e60dbc
MergeGepUse improvements (#4784)
- Added a comment warning  about using MergeGepUse while iterating.
- Changed MergeGepUse to return bool for whether anything actually changed.
- Adding GEP's user to worklist, even when GEP and GEP's source pointer GEP cannot be merged.
2022-11-10 15:34:17 -08:00
Daniele Vettorel 4349c3e1f7
Handle structured conditions in for and while loops (#4783) 2022-11-10 13:57:11 -08:00
Nathan Gauër 90225f0fea
bitfields: refactorize struct offset computation (#4781)
This is some preliminary work to bitfield addition into the SPIR-V
backend. This commit should not change the behavior of our backend.

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

Signed-off-by: Nathan Gauër <brioche@google.com>
2022-11-10 12:27:05 -08:00
Nathan Gauër 7b5200b9fa
maintenance: update submodules (#4782)
Signed-off-by: Nathan Gauër <brioche@google.com>

Signed-off-by: Nathan Gauër <brioche@google.com>
2022-11-10 11:07:39 -08:00
Nathan Gauër 0ff2aa5fd7
doc: fix code display on Github (#4775) 2022-11-08 16:04:11 +01:00
Xiang Li 7cf0019578
Add check-prefixes support for FileCheck. (#4769)
Merge from fd557cb01f (diff-216ac5edd1cbc96da1241dc98b8d114529a874800aac4622871dbc99d16892d7)
2022-11-07 15:58:21 -08:00
Cassandra Beckley 161ddc2b7c
Update submodules (#4770) 2022-11-07 13:46:49 +01:00
Xiang Li 72585c0188
Avoid > in FileCheck run line. (#4768)
Things like -DResType=RasterizerOrderedStructuredBuffer<uint> could be workaround with
-DResType="RasterizerOrderedStructuredBuffer<uint>" for lit.
But clang-hlsl-tests will not work.
So put the template inside the test.
2022-11-04 17:57:31 -07:00
Jeff Noyle 5bb5559a9f
PIX: Switch back to non-raw buffer stores (#4764)
* PIX: No raw access for PIX UAVs (upsets some drivers)

* Fix tests
2022-11-04 12:29:01 -07:00
Xiang Li 4e3a243af5
Remove > %s in FileCheck tests (#4765)
Things like RUN: %dxc /Tps_6_0 /Eps_main > %s will overwrite the test when running with lit.
2022-11-03 20:06:48 -07:00
Cassandra Beckley aabcd6e10e
[SPIR-V] Run clang-format (#4756) 2022-11-01 16:32:22 -04:00
Helena Kotas 6fdabdb1f0
IsNormalTest - correct Disassemble arguments (#4754) 2022-10-31 20:10:55 -07:00
Cassandra Beckley 036b2e3f6d
Update Windows build link (#4753) 2022-10-31 15:53:42 -04:00
Jeff Noyle 8492f4a165
PIX: Fix shader-access-tracking pass' reportage of dynamic indexing (#4748) 2022-10-28 13:13:00 -07:00
Adam Yang 80fb4622a4
Made shader reflection return thread group size for AS and MS (#4745)
Fixed DxilShaderReflection::GetThreadGroupSize returning only thread group size only for CS but not MS and AS.
2022-10-27 16:23:58 -07:00
Helena Kotas 61725a51d6
Reduce IsNormalTest dependencies and revert Hlsl/DxcTestUtils refactoring (#4744) 2022-10-27 13:22:45 -07:00