Skip to content

Commit de3339c

Browse files
authored
Merge main to staging-sm-6.8 (microsoft#5968)
Merging main @ 5f87376 to staging-sm-6.8.
2 parents cd03365 + 273f431 commit de3339c

File tree

429 files changed

+22427
-11591
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

429 files changed

+22427
-11591
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ Here's a few things you should always do when making changes to the code base:
4444

4545
The coding, style, and general engineering guidelines follow those described in the docs/CodingStandards.rst. For additional guidelines in code specific to HLSL, see the docs/HLSLChanges.rst file.
4646

47+
DXC has adopted a clang-format requirement for all incoming changes. PRs to DXC should have the _changed code_ clang formatted to the LLVM style, and leave the remaining portions of the file unchanged. This can be done using the `git-clang-format` tool or IDE driven workflows. A GitHub action will run on all PRs to validate that the change is properly formatted.
48+
4749
**Commit/Pull Request Format**
4850

4951
```

azure-pipelines.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ stages:
3434
call utils\hct\hctstart.cmd %HLSL_SRC_DIR% %HLSL_BLD_DIR%
3535
call utils\hct\hcttest.cmd -$(configuration) noexec
3636
displayName: 'DXIL Tests'
37-
- script: |
38-
call utils\hct\hctstart.cmd %HLSL_SRC_DIR% %HLSL_BLD_DIR%
39-
call utils\hct\hcttest.cmd -$(configuration) spirv_only
40-
displayName: 'SPIRV Tests'
4137
4238
- job: Nix
4339
timeoutInMinutes: 90

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,11 @@ if(LLVM_USE_SANITIZER)
533533
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
534534
endif()
535535
else()
536-
message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
536+
if (LLVM_USE_SANITIZER STREQUAL "Address")
537+
append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
538+
else()
539+
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
540+
endif()
537541
endif()
538542
if (LLVM_USE_SANITIZE_COVERAGE)
539543
append("-fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)

docs/SPIR-V.rst

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ more than one shader_record_nv block statically used per shader entry point
252252
otherwise results are undefined."
253253

254254
The official Khronos ray tracing extension also comes with a SPIR-V storage class
255-
that has the same functionality. The ``[[vk::shader_record_ext]]`` annotation can
255+
that has the same functionality. The ``[[vk::shader_record_ext]]`` annotation can
256256
be used when targeting the SPV_KHR_ray_tracing extension.
257257

258258
Builtin variables
@@ -297,10 +297,10 @@ Supported extensions
297297
* SPV_EXT_mesh_shader
298298
* SPV_EXT_shader_stencil_support
299299
* SPV_AMD_shader_early_and_late_fragment_tests
300-
* SPV_AMD_shader_explicit_vertex_parameter
301300
* SPV_GOOGLE_hlsl_functionality1
302301
* SPV_GOOGLE_user_type
303302
* SPV_NV_mesh_shader
303+
* SPV_KHR_fragment_shading_barycentric
304304

305305
Vulkan specific attributes
306306
--------------------------
@@ -1279,6 +1279,39 @@ will be translated into
12791279
%myBuffer1 = OpVariable %_ptr_Uniform_type_ByteAddressBuffer Uniform
12801280
%myBuffer2 = OpVariable %_ptr_Uniform_type_RWByteAddressBuffer Uniform
12811281
1282+
Rasterizer Ordered Views
1283+
------------------------
1284+
1285+
The following types are rasterizer ordered views:
1286+
1287+
* ``RasterizerOrderedBuffer``
1288+
* ``RasterizerOrderedByteAddressBuffer``
1289+
* ``RasterizerOrderedStructuredBuffer``
1290+
* ``RasterizerOrderedTexture1D``
1291+
* ``RasterizerOrderedTexture1DArray``
1292+
* ``RasterizerOrderedTexture2D``
1293+
* ``RasterizerOrderedTexture2DArray``
1294+
* ``RasterizerOrderedTexture3D``
1295+
1296+
These are translated to the same types as their equivalent RW* types - for
1297+
example, a ``RasterizerOrderedBuffer`` is translated to the same SPIR-V type as
1298+
an ``RWBuffer``. The sole difference lies in how loads and stores to these
1299+
values are treated.
1300+
1301+
The access order guarantee made by ROVs is implemented in SPIR-V using the
1302+
`SPV_EXT_fragment_shader_interlock <https://github.com/KhronosGroup/SPIRV-Registry/blob/main/extensions/EXT/SPV_EXT_fragment_shader_interlock.asciidoc>`_.
1303+
When you load or store a value from or to a rasterizer ordered view, using
1304+
either the ``Load*()`` or ``Store*()`` methods or the indexing operator,
1305+
``OpBeginInvocationInterlockEXT`` will be inserted before the first access and
1306+
``OpEndInvocationInterlockEXT`` will be inserted after the last access.
1307+
1308+
An execution mode will be added to the entry point, depending on the sample
1309+
frequency, which will be deduced based on the semantics inputted by the entry
1310+
point. ``PixelInterlockOrderedEXT`` will be selected by default,
1311+
``SampleInterlockOrderedEXT`` will be selected if the ``SV_SampleIndex``
1312+
semantic is input, and ``ShadingRateInterlockOrderedEXT`` will be selected if
1313+
the ``SV_ShadingRate`` semantic is input.
1314+
12821315
HLSL Variables and Resources
12831316
============================
12841317

@@ -1550,7 +1583,7 @@ some system-value (SV) semantic strings will be translated into SPIR-V
15501583
+---------------------------+-------------+----------------------------------------+-----------------------+-----------------------------+
15511584
| SV_StencilRef | PSOut | ``FragStencilRefEXT`` | N/A | ``StencilExportEXT`` |
15521585
+---------------------------+-------------+----------------------------------------+-----------------------+-----------------------------+
1553-
| SV_Barycentrics | PSIn | ``BaryCoord*AMD`` | N/A | ``Shader`` |
1586+
| SV_Barycentrics | PSIn | ``BaryCoord*KHR`` | N/A | ``FragmentBarycentricKHR`` |
15541587
+---------------------------+-------------+----------------------------------------+-----------------------+-----------------------------+
15551588
| | GSOut | ``Layer`` | N/A | ``Geometry`` |
15561589
| +-------------+----------------------------------------+-----------------------+-----------------------------+
@@ -3858,14 +3891,14 @@ implicit ``vk`` namepsace.
38583891
38593892
// Implicitly defined when compiling to SPIR-V.
38603893
namespace vk {
3861-
3894+
38623895
const uint CrossDeviceScope = 0;
38633896
const uint DeviceScope = 1;
38643897
const uint WorkgroupScope = 2;
38653898
const uint SubgroupScope = 3;
38663899
const uint InvocationScope = 4;
38673900
const uint QueueFamilyScope = 5;
3868-
3901+
38693902
uint64_t ReadClock(in uint scope);
38703903
T RawBufferLoad<T = uint>(in uint64_t deviceAddress,
38713904
in uint alignment = 4);
@@ -3918,20 +3951,20 @@ functionality to HLSL:
39183951

39193952
.. code:: hlsl
39203953
3921-
// RawBufferLoad and RawBufferStore use 'uint' for the default template argument.
3954+
// RawBufferLoad and RawBufferStore use 'uint' for the default template argument.
39223955
// The default alignment is 4. Note that 'alignment' must be a constant integer.
39233956
T RawBufferLoad<T = uint>(in uint64_t deviceAddress, in uint alignment = 4);
39243957
void RawBufferStore<T = uint>(in uint64_t deviceAddress, in T value, in uint alignment = 4);
39253958
39263959
3927-
These intrinsics allow the shader program to load and store a single value with type T (int, float2, struct, etc...)
3960+
These intrinsics allow the shader program to load and store a single value with type T (int, float2, struct, etc...)
39283961
from GPU accessible memory at given address, similar to ``ByteAddressBuffer.Load()``.
3929-
Additionally, these intrinsics allow users to set the memory alignment for the underlying data.
3930-
We assume a 'uint' type when the template argument is missing, and we use a value of '4' for the default alignment.
3962+
Additionally, these intrinsics allow users to set the memory alignment for the underlying data.
3963+
We assume a 'uint' type when the template argument is missing, and we use a value of '4' for the default alignment.
39313964
Note that the alignment argument must be a constant integer if it is given.
39323965

3933-
Though we do support setting the `alignment` of the data load and store, we do not currently
3934-
support setting the memory layout for the data. Since these intrinsics are supposed to load
3966+
Though we do support setting the `alignment` of the data load and store, we do not currently
3967+
support setting the memory layout for the data. Since these intrinsics are supposed to load
39353968
"arbitrary" data to or from a random device address, we assume that the program loads/stores some "bytes of data",
39363969
but that its format or layout is unknown. Therefore, keep in mind that these intrinsics
39373970
load or store ``sizeof(T)`` bytes of data, and that loading/storing data with a struct

external/SPIRV-Tools

Submodule SPIRV-Tools updated 49 files

include/dxc/DXIL/DxilOperations.h

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,21 @@ class OP {
4242
OP() = delete;
4343
OP(llvm::LLVMContext &Ctx, llvm::Module *pModule);
4444

45-
void RefreshCache();
45+
// InitWithMinPrecision sets the low-precision mode and calls
46+
// FixOverloadNames() and RefreshCache() to set up caches for any existing
47+
// DXIL operations and types used in the module.
48+
void InitWithMinPrecision(bool bMinPrecision);
49+
50+
// FixOverloadNames fixes the names of DXIL operation overloads, particularly
51+
// when they depend on user defined type names. User defined type names can be
52+
// modified by name collisions from multiple modules being loaded into the
53+
// same llvm context, such as during module linking.
4654
void FixOverloadNames();
4755

56+
// RefreshCache places DXIL types and operation overloads from the module into
57+
// caches.
58+
void RefreshCache();
59+
4860
llvm::Function *GetOpFunc(OpCode OpCode, llvm::Type *pOverloadType);
4961
const llvm::SmallMapVector<llvm::Type *, llvm::Function *, 8> &
5062
GetOpFuncList(OpCode OpCode) const;
@@ -80,8 +92,6 @@ class OP {
8092

8193
// To check if operation uses strict precision types
8294
bool UseMinPrecision();
83-
// Set if operation uses strict precision types or not.
84-
void SetMinPrecision(bool bMinPrecision);
8595

8696
// Get the size of the type for a given layout
8797
uint64_t GetAllocSizeForType(llvm::Type *Ty);

include/dxc/Support/microcom.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ template <typename T> void DxcCallDestructor(T *obj) { obj->T::~T(); }
7474
#define DXC_MICROCOM_REF_FIELD(m_dwRef) \
7575
volatile std::atomic<llvm::sys::cas_flag> m_dwRef = {0};
7676
#define DXC_MICROCOM_ADDREF_IMPL(m_dwRef) \
77-
ULONG STDMETHODCALLTYPE AddRef() override { return (ULONG)++m_dwRef; }
77+
ULONG STDMETHODCALLTYPE AddRef() noexcept override { \
78+
return (ULONG)++m_dwRef; \
79+
}
7880
#define DXC_MICROCOM_ADDREF_RELEASE_IMPL(m_dwRef) \
7981
DXC_MICROCOM_ADDREF_IMPL(m_dwRef) \
8082
ULONG STDMETHODCALLTYPE Release() override { \
@@ -107,7 +109,7 @@ inline T *CreateOnMalloc(IMalloc *pMalloc, Args &&...args) {
107109

108110
#define DXC_MICROCOM_TM_ADDREF_RELEASE_IMPL() \
109111
DXC_MICROCOM_ADDREF_IMPL(m_dwRef) \
110-
ULONG STDMETHODCALLTYPE Release() override { \
112+
ULONG STDMETHODCALLTYPE Release() noexcept override { \
111113
ULONG result = (ULONG)--m_dwRef; \
112114
if (result == 0) { \
113115
CComPtr<IMalloc> pTmp(m_pMalloc); \

include/dxc/Test/HlslTestUtils.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,18 @@
1919
#include <string>
2020
#include <vector>
2121
#ifdef _WIN32
22+
23+
// Disable -Wignored-qualifiers for WexTestClass.h.
24+
// For const size_t GetSize() const; in TestData.h.
25+
#ifdef __clang__
26+
#pragma clang diagnostic push
27+
#pragma clang diagnostic ignored "-Wignored-qualifiers"
28+
#endif
2229
#include "WexTestClass.h"
30+
#ifdef __clang__
31+
#pragma clang diagnostic pop
32+
#endif
33+
2334
#include <dxgiformat.h>
2435
#else
2536
#include "WEXAdapter.h"

include/dxc/dxcpix.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
#define __DXC_PIX__
1414

1515
#include "dxc/dxcapi.h"
16+
#ifdef _WIN32
1617
#include "objidl.h"
18+
#endif
1719

1820
struct __declspec(uuid("199d8c13-d312-4197-a2c1-07a532999727")) IDxcPixType
1921
: public IUnknown {

0 commit comments

Comments
 (0)