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

2523 Коммитов

Автор SHA1 Сообщение Дата
Chris B 0a0ed9f50b
Make it possible to enable building LLVM & Clang unit tests (#4020)
* Changes to get LLVM unit tests building

This change gets the LLVM unit tests building again and running through
LIT via the `check-llvm-unit` target.

This change does not have the tests passing! Subsequent changes will
get the unit tests passing. This change also disables some tests where
the LLVM code is no longer used and making those tests work will
require substantial effort.

* Changes to get Clang unit tests building

This change gets the Clang unit tests building again and running
through LIT via the `check-clang-unit` target.

This change does not have the tests passing! Subsequent changes will
get the unit tests passing. This change also disables some tests where
the Clang code is no longer used and making those tests work will
require substantial effort.

* A few extra Windows fixes

This adds some missing APIs to the Windows Filesystem code and adds an
option to hctbuild to enable building the LLVM & Clang unit tests.

* Disable libClangFormat tests

These tests are a bit gnarly to repair... unless we really start using
the format library we probably just want to disable these tests.
2021-10-20 12:32:45 -05:00
Chris B 4ca3a04252
Restore LLVM Testing Infrastructure (#4012)
* Restore lit and googletest sources from LLVM 3.7.0

This commit just re-adds sources that were removed somewhere along the
way.

* Pull in googletest & googlemock from LLVM 4.0

Googlemock was introduced in LLVM 4.0, and is used by SPIR-V's tests.
This pulls in the LLVM 4.0 version of GoogleTest and GoogleMock to
replace the external submodules.

LLVM's version of GoolgeTest and GoogleMock have some minor extensions
to work better with LIT for error reporting and producing cleaner test
output.

* Remove external googletest

* Fix lit to handle comment in gtest names

This fix came into LLVM with the updated googletest in a977582dead2

* Ignore raw_fd_ostream errors when not closing

There's some odditites with the changes in the filesystem code that
cause this to error sometimes in unit tests. Until we can dedicate time
to looking into the filesystem code, just swallow that error...

* Fix bot failure

Missed an option change.

* Fixing MSVC build failure

* A cleaner build fix

This should address issues with VS 2019 in a cleaner way.

* Fix build
2021-10-19 15:24:11 -05:00
Greg Fischer 5f35caa480
[spirv] Add support for NonSemantic.Shader.DebugInfo.100 generation (#4006)
This commit generally only adds those instructions that intersect with
OpenCL.DebugInfo.100, although it does also add generation of
new DebugFunctionDefinition to tie DebugFunction to function.

Co-authored-by: baldurk <baldurk@baldurk.org>
2021-10-19 14:40:59 -04:00
Chris B b4c09ea9fb
[templates] Instantiate HLSL Annotations (#4007)
* [templates] Instantiate HLSL Annotations

When instantiating decls, the HLSL annotations should be carried over
for any NamedDecls that have them.

This change resolves #4003

* Add test case covering HLSL annotations

This just adds a test case that covers a wide swath of HLSL annotations
and verifies that they all instantiate correctly.
2021-10-18 15:16:16 -05:00
Xiang Li e39defba07
Add rewrite pass to create global cb. (#4000)
* Add rewrite pass to create global cb.
2021-10-15 14:41:25 -07:00
Xiang Li 44e0509d89
Allow namespace in cbuffer. (#4013) 2021-10-15 10:28:26 -07:00
Greg Roth 7c6a6bc7aa
Only define global heap variables in 6.6+ (#4011)
RsourceDescriptorHeap and SamplerDescriptorHeap were predefined in all
shader models, not just 6.6+. By checking the shader model version
before declaring them, we can limit this to relevant shader models.

Added tests for 6.6 and 6.5 behavior when these are redefined
2021-10-14 15:48:54 -07:00
Chris B 4a2ea59d6a
Enable building llvm-dis (#3999)
* Enable building llvm-dis

llvm-dis is a lightweight tool for reading IR modules as bitcode and
dumping them as textual IR. It is useful for debugging and verification
of bitcode-related issues.

This patch just re-enables the llvm-dis build and updates the code to
build cleanly on *nix systems.

* Fix broken windows build

I need to cleanup the WinIncludes usage, but that can be a seprate PR.
2021-10-12 21:39:52 -05:00
Greg Roth 833657810a
Use a type-appropriate 2.0 for reflect (#3998)
The reflection calculation involves a multiply by two that was always
float, which caused an internal assert when the variable was not float.
Now the constant uses the type of the other operand
2021-10-12 10:33:37 -07:00
Chris B 058640e4d4
[Templates] Resolve literal types to 32-bit types (#3994)
When resolving template argument types if the originating type is a
literal type (i.e. `literal float` or `literal int`), we should instead
substitute the appropriate 32-bit type.

This change is two pieces:

The first translates template arguments from `literal <x>` into the
appropriate 32-bit type after deduction but before generating the
instantiated decl for non-builtin templates.

The second part allows `literal <x>` template parameters to match
against the appropriate instantiated 32-bit types.

This resolves #3973.
2021-10-11 14:11:35 -05:00
Chris B f1d310bec7
Fix cast construction in template instantiation for Constant and Texture buffers (#3991)
* Revert "Fix crash in Sema::CheckDerivedToBaseConversion when Paths is
empty. (#3327)"

This reverts commit 2903170ac5, but keeps
the test case, as the test case is important.

* Generate FlatConversion for buffer member access

ConstantBuffers and TextureBuffers need to behave at the AST level as
if they implicitly convert to the underlying buffer data type.

We do this when generting the AST, but we don't have the proper
overrides in place in `Sema::PerformObjectMemberConversion`.

This is the root cause of issue #3327, so this change should be layered
on a revert of 2903170ac.

This also addresses #3972.

'beanz/beanz/constant-buffer-template-issue-3972'.
../tools/clang/test/HLSLFileCheck/hlsl/template/BufferInExpansion.hlsl

'beanz/beanz/constant-buffer-template-issue-3972'.
../tools/clang/test/HLSLFileCheck/hlsl/template/BufferInExpansion.hlsl

'beanz/beanz/constant-buffer-template-issue-3972'.
../tools/clang/test/HLSLFileCheck/hlsl/template/BufferInExpansion.hlsl
2021-10-11 11:14:35 -05:00
Greg Roth 66c0eeefdc
Properly handle parsed HLSL tokens (#3993)
Several instances of handling token strings made the assumption that
the strings were null terminated though they were not necessarily.

By changing the processing to using the full StringRef, the length is
used and the potential for reading invalid characters is eliminated

64-bit linux has 8 byte longs where Windows always uses 4 bytes. As a
result, the strings that exceeded the maximum 32-bit representation on
such platforms were not failing for extreme space/register values as
expected
2021-10-07 14:21:50 -07:00
Chris B 46d97b8cfe
[NFC] Silence a few new clang warnings (#3989)
Clang has added new warnings for possible unintended string
concatenations. When concatonating strings in an array literal warpping
the concatenation in parentesis quiets the warning.
2021-10-05 13:24:11 -05:00
Adam Yang 6a3ae13ff4
Od fixes sep2021 (#3990) 2021-10-05 03:28:21 -07:00
Jeff Noyle d23ede6fc5
PIX: Changes to run PIX passes on libraries. Also add raygen shader debugging prolog (#3985)
These changes are a result of prototype work in PIX to support shader debugging for DXR,, which was an exercise to figure out how to support libraries in general in PIX. These changes are the result. It's all about iterating over all the library functions, rather than "the" entry point function.
In addition, to have something concrete to submit to a driver, there's the addition of codegen for the shader debugging "prolog", which chooses at runtime whether or not to emit instrumentation data for a given shader invocation based on its (in this case) thread id. This last is not yet ready for production in PIX, in that it is necessary but not sufficient to enable DXR shader debugging.
2021-10-04 15:37:50 -07:00
Adam Yang 9b281d0de6
Fixed structurized return when there are phi's from shortcircuiting. (#3981) 2021-10-02 13:55:47 -07:00
Grace Jennings b44b76d1ad
Consistent order gradient ops warnings. (#3984)
Consistent order gradient ops warnings. Added order checking to existing tests.
2021-10-01 15:14:06 -07:00
Tex Riddell 8235aac55d
Follow HLSL rule for shift ops during constant folding (#3976)
- Shift operators (Shl, LShr, AShr) use (RHS & (bitwidth-1))
  (5 LSB for 32-bit operation, 6 LSB for 64-bit operation)
2021-09-30 16:32:31 -07:00
Greg Roth c26f369b5c
Enable -HV 2021 (#3982)
Enables the associated feature flags when 2021 is selected. Also adds a
feature flag for bitfields.

Add to all feature tests a variant that uses -HV 2021

Made some small changes to a template test that relied on vector
operands with binary logical operators
2021-09-29 19:00:44 -07:00
Chris B 8a1e9700e2
[NFC] Add additional helper methods for DXT::ResourceKind (#3975)
* Added `IsAnyTextureArray`, `IsAnyTextureCube`, and `IsArrayKind`
helper
methods.
* Added test case for all non-trival `Is...(ResouceKind)` methods
2021-09-29 15:17:47 -05:00
Xiang Li 207cc4a694
Always update end scope when structurize returns. (#3977)
* Always update end scope when structurize returns.
2021-09-28 19:06:50 -07:00
Adam Yang abbcb9f14e
Fixed an assert when a dxil error happens with global variable (#3974) 2021-09-28 10:09:28 -07:00
JiaoluAMD de6a8ed4ae
[SPIRV] Add support of the GL_EXT_spirv_intrinsics (#3949)
[SPIRV] Add support of the GL_EXT_spirv_intrinsics

Related to the issue: https://github.com/microsoft/DirectXShaderCompiler/issues/3919
Add these attributes

vk::ext_capability
vk::ext_extension
vk::ext_instruction
vk::ext_reference
vk::ext_literal

Note this commit allows the redeclaration of a HLSL intrinsic function using a function declaration with `vk::ext_instruction`.

Co-authored-by: Jaebaek Seo <jaebaek@google.com>
2021-09-24 11:15:04 -04:00
Greg Roth f008085313
Merge pull request #3968 from microsoft/merge-hlsl2021-master
Merge hlsl2021 master
2021-09-23 10:51:09 -06:00
JiaoluAMD d5fb0499f0
Expand AttrKind from 8bit to 32 bits (#3967)
Attributes size exceeds to the limit of the 255, use 32 bit AttrKind
2021-09-23 09:34:39 -07:00
Tex Riddell 5d2a08ee30
Fix cbuffer variable usage in reflection for SM 6.6 (#3966) 2021-09-23 08:23:50 -07:00
Tex Riddell 538c203a5b
Fix bugs in signature reflection, add signatures to dumper and tests (#3961)
- Fix Barycentric system value translation
- Increment Register for array elements
- Add signature dumping to D3DReflectionDumper, plus other minor fixes
- Dump PatchConstantParameters when mesh shader
2021-09-21 14:13:00 -07:00
Greg Roth a4dfa1c40c Merge remote-tracking branch 'origin/hlsl-2021' into merge-hlsl2021-master 2021-09-21 13:01:07 -07:00
Greg Roth f1405e3542
Limit Sema intrinsic checks to builtin "op" table (#3963)
The check for short curcuit intrinsics failed to account for
intrinsic tables other than the default. This ensures that assumption is
correct before performing the check

Added a few other checks for similar uses
2021-09-21 12:47:24 -07:00
Lukas Hermanns a6cf6a06b6
Fix build when `SUPPORT_QUERY_GIT_COMMIT_INFO` is disabled (#3745)
* Use IDxcVersionInfo instead of IDxcVersionInfo2 when git commit info is not available.

* Always add null terminator byte count to 'VersionStringListSizeInBytes'.
2021-09-20 15:53:15 -07:00
David Peixotto 618b207a62
Fix check in dxc extra output processing for non-blob output (#3957)
When processing the DXC_OUT_EXTRA_OUTPUTS output from a compile there
is an attempt to skip non-blob outputs. The check is written incorrectly
because the call to `GetOutput` will fail (when it tries to QueryInterface
on the blob output).

The fix is to check the HRESULT returned from GetOutput and skip the output
if it failed.

Found when using the dxclib from an external project. I did not see an easy
way to add a test for this.
2021-09-18 20:09:00 -07:00
Greg Roth 693103f39d Merge remote-tracking branch 'origin/master' into hlsl-2021 2021-09-17 14:39:31 -07:00
Grace Jennings 5fba0c36b3
Added unused output target warning and moved usage mask fill location (#3947)
* Moved usage mask fill location
Added unused output target warning and test

* Updated for readability
2021-09-14 10:27:59 -07:00
Adam Yang 7914122a97
Reflection interface now accepts a DXIL program header. (#3946) 2021-09-13 14:27:23 -07:00
Adam Yang 29a5af5e7c
NoUnwind fix. HLExtIntrinsic collision fix. (#3942) 2021-09-10 16:38:46 -07:00
Thomas Roughton 8c188558f5
[SPIR-V] Fix an issue with duplicate specialisation constants (#3929)
Fix an issue where specialization constants could be emitted multiple times
(e.g., once by themselves and once in composites).

Note that the const value of a special const specified in the HLSL code cannot
be reused because the value of the special const will be determined at the
runtime. However, the special const itself can be reused similar to variables.

Co-authored-by: Jaebaek Seo <jaebaek@google.com>
2021-09-10 10:16:10 -04:00
David Peixotto d85527d62b
Allow calling DxcInitThreadMalloc again after calling DxcCleanupThreadMalloc (#3941)
Allow calling DxcInitThreadMalloc again after calling DxcCleanupThreadMalloc

Without this change we cannot call a sequence of

    DxcInitThreadMalloc()
    DxcCleanupThreadMalloc()
    ...
    DxcInitThreadMalloc() // <- This will trigger an assert

because we hit an assert that assumes the default malloc pointer is nullptr.
2021-09-09 16:03:24 -07:00
Natalie Chouinard cbd889599f [spirv] Support bool* as texture template type
Add support for bool typed textures to be compatible with FXC.

Fixes #3236
2021-09-09 10:35:23 -04:00
Natalie Chouinard 4c8459b38c [spirv] Add support for RValues with OpaqueArrayType
RValues with OpaqueArrayType can now be legalized with spirv-opt.

Fixes #3677
2021-09-08 10:02:53 -04:00
Jaebaek Seo 555f813c4f
[spirv] add -fspv-reduce-load-size option (#3931)
Since loading a big object takes the memory pressure, reduction of the
load size can have some performance benefit. In particular, it is
useful for mobile GPUs. `-fspv-reduce-load-size` removes
OpLoad/OpCompositeExtract of struct/array types by running spirv-opt
--reduce-load-size pass.

Fixes #3889
2021-09-07 23:32:16 -04:00
Jaebaek Seo 6235ab32c2
[spirv] support vk::combinedImageSampler (#3920)
This PR enables `vk::combinedImageSampler` support.

How to use `vk::combinedImageSampler`:
1. Define `SamplerState` and `Texture2D` with the same descriptor set and binding numbers e.g.,
```
[[vk::combinedImageSampler]][[vk::binding(0, 1)]]
SamplerState sam0;
[[vk::combinedImageSampler]][[vk::binding(0, 1)]]
Texture2D<float4> tex0;
```
2. Use them e.g., `tex0.SampleLevel(sam0, float2(1, 2), 10, 2);`
3. Run the legalization after SPIR-V codegen.

Note that we can use the texture `tex0` with samplers other than `sam0`
but we cannot use `sam0` with textures other than `tex0`.
2021-09-07 15:01:11 -04:00
Xiang Li 5ae4b02c38
Fix issue when updateCounter for dynamic resource, also remove createHandleForLib on handle type when not a library. (#3935) 2021-09-07 10:24:42 -07:00
Adam Yang 794ba5da1a
Fixed debug info in unrolled loops. (#3926) 2021-09-02 00:44:36 -07:00
Greg Roth dd86223362
Correctly handle comma operator w/matrices (#3921)
The special HLSL matrix codegen didn't handle the comma operator. Since
the operation is simple enough, skip special handling and fallback to
the default behavior

Fixed #3916
2021-08-31 14:30:56 -07:00
Xiang Li 7ed55d8ed7
Change umax(a,0) to a. (#3922)
* Change umax(a,0) to a.
2021-08-30 22:18:19 -07:00
JiaoluAMD e21a5daa87
[SPIRV] Add linkageAttributes decorates (#3915)
Add linkageAttributes OpDecorate as required by the spirv spec for the
exported/imported values of Linkage capability
2021-08-30 22:25:20 -04:00
Adam Yang 0e15e09245
Short circuit tests. (#3917) 2021-08-26 18:39:39 -07:00
Adam Yang 2bc41323ff
Added binding table file to specify resource binding (#3843) 2021-08-26 11:56:36 -07:00
Jaebaek Seo 7793f5d3c1
Initial support of operator overloading (#3859) 2021-08-26 12:26:12 -04:00
Grace Jennings 0c2c998326
Add --version flag to print dxc version info (#3912)
* basic -version flag from -? flag

* now --version and added to -? text
2021-08-24 09:53:13 -07:00