Skip to content

Commit 77ee1cc

Browse files
committed
resolved conflicts, pulled from microsoft main
2 parents 2cf6fa2 + adb2dc7 commit 77ee1cc

File tree

61 files changed

+955
-333
lines changed

Some content is hidden

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

61 files changed

+955
-333
lines changed

CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
11
# See docs/CMake.html for instructions about how to build LLVM with CMake.
22

3+
34
cmake_minimum_required(VERSION 3.17.2) # HLSL Change - Require CMake 3.17.2.
45
cmake_policy(SET CMP0091 NEW)
6+
message(CMAKE_BUILD_TYPE0!!!!!="${CMAKE_BUILD_TYPE}")
7+
message(CMAKE_CONFIGURATION_TYPES!!!!!="${CMAKE_CONFIGURATION_TYPES}")
8+
message(CMAKE_CXX_FLAGS_RELEASE!!!!!="${CMAKE_CXX_FLAGS_RELEASE}")
59
set(CMAKE_CXX_STANDARD 17)
610
set(CMAKE_CXX_STANDARD_REQUIRED ON)
711

812
if (NOT "${DXC_CMAKE_BEGINS_INCLUDE}" STREQUAL "")
913
include(${DXC_CMAKE_BEGINS_INCLUDE})
1014
endif()
1115

16+
1217
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
1318
message(STATUS "No build type selected, default to Debug")
1419
set(CMAKE_BUILD_TYPE "Debug")
1520
endif()
21+
message(CMAKE_BUILD_TYPE1!!!!!="${CMAKE_BUILD_TYPE}")
1622

1723
if(POLICY CMP0022)
1824
cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
@@ -316,11 +322,15 @@ option(LLVM_ENABLE_LIBCXXABI "Use libc++abi when using libc++." OFF)
316322
option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
317323
option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
318324

325+
message(uppercase_CMAKE_BUILD_TYPE!!!!!="${CMAKE_BUILD_TYPE}")
319326
if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
327+
message(assertions OFF)
320328
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
321329
else()
330+
message(assertions ON)
322331
option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
323332
endif()
333+
message(LLVM_ENABLE_ASSERTIONS!!!!!="${LLVM_ENABLE_ASSERTIONS}")
324334

325335
set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING
326336
"Enable abi-breaking checks. Can be WITH_ASSERTS, FORCE_ON or FORCE_OFF.")

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
```

cmake/modules/HandleLLVMOptions.cmake

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ int main() { return (float)x; }"
5656
endif()
5757

5858
if( LLVM_ENABLE_ASSERTIONS )
59+
message(how did I get here?)
5960
# MSVC doesn't like _DEBUG on release builds. See PR 4379.
6061
# HLSL Note: the above comment referrs to llvm.org problem, not pull request:
6162
# https://bugs.llvm.org/show_bug.cgi?id=4379
@@ -533,7 +534,11 @@ if(LLVM_USE_SANITIZER)
533534
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
534535
endif()
535536
else()
536-
message(WARNING "LLVM_USE_SANITIZER is not supported on this platform.")
537+
if (LLVM_USE_SANITIZER STREQUAL "Address")
538+
append("-fsanitize=address" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
539+
else()
540+
message(WARNING "Unsupported value of LLVM_USE_SANITIZER: ${LLVM_USE_SANITIZER}")
541+
endif()
537542
endif()
538543
if (LLVM_USE_SANITIZE_COVERAGE)
539544
append("-fsanitize-coverage=edge,indirect-calls,8bit-counters,trace-cmp" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)

docs/SPIR-V.rst

Lines changed: 42 additions & 9 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
@@ -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

@@ -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

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"

projects/dxilconv/include/ShaderBinary/ShaderBinary.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,11 @@ class COperandBase {
239239
public:
240240
COperandBase() { Clear(); }
241241
COperandBase(const COperandBase &Op) { memcpy(this, &Op, sizeof(*this)); }
242+
COperandBase &operator=(const COperandBase &Op) {
243+
if (this != &Op)
244+
memcpy(this, &Op, sizeof(*this));
245+
return *this;
246+
}
242247
D3D10_SB_OPERAND_TYPE OperandType() const { return m_Type; }
243248
const COperandIndex *OperandIndex(UINT Index) const {
244249
return &m_Index[Index];

tools/clang/include/clang/Basic/Attr.td

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -943,7 +943,7 @@ def CounterStructuredBuffer : SubsetSubject<
943943
S->getType()->getAs<RecordType>()->getDecl()->getName() == "AppendStructuredBuffer" ||
944944
S->getType()->getAs<RecordType>()->getDecl()->getName() == "ConsumeStructuredBuffer")}]>;
945945

946-
// Array of StructuredBuffer types that can have associated counters
946+
// Array of StructuredBuffer types that can have associated counters
947947
def ArrayOfCounterStructuredBuffer
948948
: SubsetSubject<
949949
Var, [{S->hasGlobalStorage() && S->getType()->getAsArrayTypeUnsafe() &&
@@ -974,7 +974,7 @@ def ConstantTextureBuffer
974974
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
975975
"TextureBuffer")}]>;
976976

977-
// Global variable with "RWTexture" type
977+
// Global variable with "(RW|RasterizerOrdered)Texture" type
978978
def RWTexture
979979
: SubsetSubject<
980980
Var, [{S->hasGlobalStorage() && S->getType()->getAs<RecordType>() &&
@@ -988,9 +988,19 @@ def RWTexture
988988
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
989989
"RWTexture2DArray" ||
990990
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
991-
"RWTexture3D")}]>;
991+
"RWTexture3D" ||
992+
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
993+
"RasterizerOrderedTexture1D" ||
994+
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
995+
"RasterizerOrderedTexture1DArray" ||
996+
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
997+
"RasterizerOrderedTexture2D" ||
998+
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
999+
"RasterizerOrderedTexture2DArray" ||
1000+
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
1001+
"RasterizerOrderedTexture3D")}]>;
9921002

993-
// Global variable of array of "RWTexture" type
1003+
// Global variable of array of "(RW|RasterizerOrdered)Texture" type
9941004
def ArrayOfRWTexture
9951005
: SubsetSubject<
9961006
Var, [{S->hasGlobalStorage() && S->getType()->getAsArrayTypeUnsafe() &&
@@ -1005,19 +1015,31 @@ def ArrayOfRWTexture
10051015
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
10061016
"RWTexture2DArray" ||
10071017
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
1008-
"RWTexture3D")}]>;
1018+
"RWTexture3D" ||
1019+
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
1020+
"RasterizerOrderedTexture1D" ||
1021+
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
1022+
"RasterizerOrderedTexture1DArray" ||
1023+
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
1024+
"RasterizerOrderedTexture2D" ||
1025+
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
1026+
"RasterizerOrderedTexture2DArray" ||
1027+
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
1028+
"RasterizerOrderedTexture3D")}]>;
10091029

1010-
// Global variable with "[RW]Buffer" type
1030+
// Global variable with "[RW|RasterizerOrdered]Buffer" type
10111031
def Buffer
10121032
: SubsetSubject<
10131033
Var, [{S->hasGlobalStorage() && S->getType()->getAs<RecordType>() &&
10141034
S->getType()->getAs<RecordType>()->getDecl() &&
10151035
(S->getType()->getAs<RecordType>()->getDecl()->getName() ==
10161036
"Buffer" ||
10171037
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
1018-
"RWBuffer")}]>;
1038+
"RWBuffer" ||
1039+
S->getType()->getAs<RecordType>()->getDecl()->getName() ==
1040+
"RasterizerOrderedBuffer")}]>;
10191041

1020-
// Global variable or array of "[RW]Buffer" type
1042+
// Global variable or array of "[RW|RasterizerOrdered]Buffer" type
10211043
def ArrayOfBuffer
10221044
: SubsetSubject<
10231045
Var, [{S->hasGlobalStorage() && S->getType()->getAsArrayTypeUnsafe() &&
@@ -1026,7 +1048,9 @@ def ArrayOfBuffer
10261048
(S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
10271049
"Buffer" ||
10281050
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
1029-
"RWBuffer")}]>;
1051+
"RWBuffer" ||
1052+
S->getType()->getAsArrayTypeUnsafe()->getElementType()->getAs<RecordType>()->getDecl()->getName() ==
1053+
"RasterizerOrderedBuffer")}]>;
10301054

10311055
// Global variable with "Texture" or "SamplerState" type
10321056
def TextureOrSampler

0 commit comments

Comments
 (0)