Skip to content

Commit 3d4b3ab

Browse files
committed
Merge branch 'staging-sm6.9' into anupamac/coop-vec-5
2 parents e40b24d + 4ce225f commit 3d4b3ab

105 files changed

Lines changed: 7514 additions & 2356 deletions

File tree

Some content is hidden

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

.github/CODEOWNERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
* @microsoft/hlsl-release
1+
# Uncomment the next line in release branches after ask-mode begins
2+
# * @microsoft/hlsl-release

CMakeLists.txt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,6 @@ if(POLICY CMP0022)
1717
cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
1818
endif()
1919

20-
if (POLICY CMP0051)
21-
# CMake 3.1 and higher include generator expressions of the form
22-
# $<TARGETLIB:obj> in the SOURCES property. These need to be
23-
# stripped everywhere that access the SOURCES property, so we just
24-
# defer to the OLD behavior of not including generator expressions
25-
# in the output for now.
26-
cmake_policy(SET CMP0051 OLD)
27-
endif()
28-
2920
if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
3021
set(cmake_3_2_USES_TERMINAL)
3122
else()

CONTRIBUTING.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,32 @@ Before submitting a feature or substantial code contribution please discuss it w
4040

4141
### Coding guidelines
4242

43-
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.
43+
The coding, style, and general engineering guidelines follow those described in the [LLVM Coding Standards](docs/CodingStandards.rst). For additional guidelines in code specific to HLSL, see the [HLSL Changes](docs/HLSLChanges.rst) docs.
4444

4545
DXC has adopted a clang-format requirement for all incoming changes to C and C++ files. 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.
4646

47+
#### Applying LLVM Standards
48+
49+
All new code contributed to DXC should follow the LLVM coding standards.
50+
51+
Note that the LLVM Coding Standards have a golden rule:
52+
53+
> **If you are extending, enhancing, or bug fixing already implemented code, use the style that is already being used so that the source is uniform and easy to follow.**
54+
55+
The golden rule should continue to be applied to places where DXC is self-consistent. A good example is DXC's common use of `PascalCase` instead of `camelCase` for APIs in some parts of the HLSL implementation. In any place where DXC is not self-consistent new code should follow the LLVM Coding Standard.
56+
57+
A good secondary rule to follow is:
58+
59+
> **When in doubt, follow LLVM.**
60+
61+
Adopting LLVM's coding standards provides a consistent set of rules and guidelines to hold all contributions to. This allows patch authors to clearly understand the expectations placed on contributions, and allows reviewers to have a bar to measure contributions against. Aligning with LLVM by default ensures the path of least resistance for everyone.
62+
63+
Since many of the LLVM Coding Standards are not enforced automatically we rely on code reviews to provide feedback and ensure contributions align with the expected coding standards. Since we rely on reviewers for enforcement and humans make mistakes, please keep in mind:
64+
65+
> **Code review is a conversation.**
66+
67+
It is completely reasonable for a patch author to question feedback and provide additional context about why something was done the way it was. Reviewers often see narrow slices in diffs rather than the full context of a file or part of the compiler, so they may not always provide perfect feedback. This is especially true with the application of the "golden rule" since it depends on understanding a wider context.
68+
4769
### Documenting Pull Requests
4870

4971
Pull request descriptions should have the following format:

azure-pipelines.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
trigger:
22
- main
33
- release*
4+
- staging*
45

56
pr:
67
- main
78
- release*
9+
- staging*
810

911
resources:
1012
- repo: self

docs/SPIR-V.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,7 @@ Supported extensions
320320
* SPV_KHR_maximal_reconvergence
321321
* SPV_KHR_float_controls
322322
* SPV_NV_shader_subgroup_partitioned
323+
* SPV_KHR_quad_control
323324

324325
Vulkan specific attributes
325326
--------------------------
@@ -4008,6 +4009,8 @@ Quad ``QuadReadAcrossX()`` ``OpGroupNonUniformQuadSwap``
40084009
Quad ``QuadReadAcrossY()`` ``OpGroupNonUniformQuadSwap``
40094010
Quad ``QuadReadAcrossDiagonal()`` ``OpGroupNonUniformQuadSwap``
40104011
Quad ``QuadReadLaneAt()`` ``OpGroupNonUniformQuadBroadcast``
4012+
Quad ``QuadAny()`` ``OpGroupNonUniformQuadAnyKHR``
4013+
Quad ``QuadAll()`` ``OpGroupNonUniformQuadAllKHR``
40114014
N/A ``WaveMatch()`` ``OpGroupNonUniformPartitionNV``
40124015
Multiprefix ``WaveMultiPrefixSum()`` ``OpGroupNonUniform*Add`` ``PartitionedExclusiveScanNV``
40134016
Multiprefix ``WaveMultiPrefixProduct()`` ``OpGroupNonUniform*Mul`` ``PartitionedExclusiveScanNV``
@@ -4016,6 +4019,11 @@ Multiprefix ``WaveMultiPrefixBitOr()`` ``OpGroupNonUniformLogicalOr`` `
40164019
Multiprefix ``WaveMultiPrefixBitXor()`` ``OpGroupNonUniformLogicalXor`` ``PartitionedExclusiveScanNV``
40174020
============= ============================ =================================== ==============================
40184021

4022+
``QuadAny`` and ``QuadAll`` will use the ``OpGroupNonUniformQuadAnyKHR`` and
4023+
``OpGroupNonUniformQuadAllKHR`` instructions if the ``SPV_KHR_quad_control``
4024+
extension is enabled. If it is not, they will fall back to constructing the
4025+
value using multiple calls to ``OpGroupNonUniformQuadBroadcast``.
4026+
40194027
The Implicit ``vk`` Namespace
40204028
=============================
40214029

include/dxc/DXIL/DxilConstants.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,6 @@ inline bool IsFeedbackTexture(DXIL::ResourceKind ResourceKind) {
495495
// Enumeration for operations specified by DXIL
496496
enum class OpCode : unsigned {
497497
//
498-
RawBufferVectorLoad = 303, // reads from a raw buffer and structured buffer
499-
RawBufferVectorStore =
500-
304, // writes to a RWByteAddressBuffer or RWStructuredBuffer
501498
Reserved0 = 226, // Reserved
502499
Reserved1 = 227, // Reserved
503500
Reserved10 = 236, // Reserved
@@ -922,8 +919,11 @@ enum class OpCode : unsigned {
922919
GetDimensions = 72, // gets texture size information
923920
RawBufferLoad = 139, // reads from a raw buffer and structured buffer
924921
RawBufferStore = 140, // writes to a RWByteAddressBuffer or RWStructuredBuffer
925-
TextureLoad = 66, // reads texel data without any filtering or sampling
926-
TextureStore = 67, // reads texel data without any filtering or sampling
922+
RawBufferVectorLoad = 303, // reads from a raw buffer and structured buffer
923+
RawBufferVectorStore =
924+
304, // writes to a RWByteAddressBuffer or RWStructuredBuffer
925+
TextureLoad = 66, // reads texel data without any filtering or sampling
926+
TextureStore = 67, // reads texel data without any filtering or sampling
927927
TextureStoreSample = 225, // stores texel data at specified sample index
928928

929929
// Sampler Feedback
@@ -1081,8 +1081,6 @@ enum class OpCode : unsigned {
10811081
// Groups for DXIL operations with equivalent function templates
10821082
enum class OpCodeClass : unsigned {
10831083
//
1084-
RawBufferVectorLoad,
1085-
RawBufferVectorStore,
10861084
Reserved,
10871085

10881086
// Amplification shader instructions
@@ -1311,6 +1309,8 @@ enum class OpCodeClass : unsigned {
13111309
GetDimensions,
13121310
RawBufferLoad,
13131311
RawBufferStore,
1312+
RawBufferVectorLoad,
1313+
RawBufferVectorStore,
13141314
TextureLoad,
13151315
TextureStore,
13161316
TextureStoreSample,
@@ -1449,6 +1449,12 @@ const unsigned kRawBufferLoadElementOffsetOpIdx = 3;
14491449
const unsigned kRawBufferLoadMaskOpIdx = 4;
14501450
const unsigned kRawBufferLoadAlignmentOpIdx = 5;
14511451

1452+
// RawBufferVectorLoad.
1453+
const unsigned kRawBufferVectorLoadHandleOpIdx = 1;
1454+
const unsigned kRawBufferVectorLoadIndexOpIdx = 2;
1455+
const unsigned kRawBufferVectorLoadElementOffsetOpIdx = 3;
1456+
const unsigned kRawBufferVectorLoadAlignmentOpIdx = 4;
1457+
14521458
// RawBufferStore
14531459
const unsigned kRawBufferStoreHandleOpIdx = 1;
14541460
const unsigned kRawBufferStoreIndexOpIdx = 2;
@@ -1460,6 +1466,13 @@ const unsigned kRawBufferStoreVal3OpIdx = 7;
14601466
const unsigned kRawBufferStoreMaskOpIdx = 8;
14611467
const unsigned kRawBufferStoreAlignmentOpIdx = 9;
14621468

1469+
// RawBufferVectorStore
1470+
const unsigned kRawBufferVectorStoreHandleOpIdx = 1;
1471+
const unsigned kRawBufferVectorStoreIndexOpIdx = 2;
1472+
const unsigned kRawBufferVectorStoreElementOffsetOpIdx = 3;
1473+
const unsigned kRawBufferVectorStoreValOpIdx = 4;
1474+
const unsigned kRawBufferVectorStoreAlignmentOpIdx = 5;
1475+
14631476
// TextureStore.
14641477
const unsigned kTextureStoreHandleOpIdx = 1;
14651478
const unsigned kTextureStoreCoord0OpIdx = 2;

include/dxc/DXIL/DxilInstructions.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5079,15 +5079,15 @@ struct DxilInst_RawBufferLoad {
50795079
bool requiresUniformInputs() const { return false; }
50805080
// Operand indexes
50815081
enum OperandIdx {
5082-
arg_buf = 1,
5082+
arg_srv = 1,
50835083
arg_index = 2,
50845084
arg_elementOffset = 3,
50855085
arg_mask = 4,
50865086
arg_alignment = 5,
50875087
};
50885088
// Accessors
5089-
llvm::Value *get_buf() const { return Instr->getOperand(1); }
5090-
void set_buf(llvm::Value *val) { Instr->setOperand(1, val); }
5089+
llvm::Value *get_srv() const { return Instr->getOperand(1); }
5090+
void set_srv(llvm::Value *val) { Instr->setOperand(1, val); }
50915091
llvm::Value *get_index() const { return Instr->getOperand(2); }
50925092
void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
50935093
llvm::Value *get_elementOffset() const { return Instr->getOperand(3); }

include/dxc/DXIL/DxilOperations.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,9 +162,9 @@ class OP {
162162

163163
static bool IsDxilOpExtendedOverload(OpCode C);
164164

165-
// Return true if the overload name for this operation may be constructed
166-
// based on a type name that may not represent the same type in different
167-
// modules.
165+
// Return true if the overload name suffix for this operation may be
166+
// constructed based on a user-defined or user-influenced type name
167+
// that may not represent the same type in different linked modules.
168168
static bool MayHaveNonCanonicalOverload(OpCode OC);
169169

170170
private:

include/dxc/DxilPIXPasses/DxilPIXPasses.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ ModulePass *createDxilDebugInstrumentationPass();
2727
ModulePass *createDxilShaderAccessTrackingPass();
2828
ModulePass *createDxilPIXAddTidToAmplificationShaderPayloadPass();
2929
ModulePass *createDxilPIXDXRInvocationsLogPass();
30+
ModulePass *createDxilNonUniformResourceIndexInstrumentationPass();
3031

3132
void initializeDxilAddPixelHitInstrumentationPass(llvm::PassRegistry &);
3233
void initializeDxilDbgValueToDbgDeclarePass(llvm::PassRegistry &);
@@ -41,5 +42,7 @@ void initializeDxilShaderAccessTrackingPass(llvm::PassRegistry &);
4142
void initializeDxilPIXAddTidToAmplificationShaderPayloadPass(
4243
llvm::PassRegistry &);
4344
void initializeDxilPIXDXRInvocationsLogPass(llvm::PassRegistry &);
45+
void initializeDxilNonUniformResourceIndexInstrumentationPass(
46+
llvm::PassRegistry &);
4447

4548
} // namespace llvm

include/dxc/HlslIntrinsicOp.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,10 @@ enum class IntrinsicOp {
107107
IOP_WorldToObject = 99,
108108
IOP_WorldToObject3x4 = 100,
109109
IOP_WorldToObject4x3 = 101,
110-
IOP___builtin_MatVecMul = 360,
111-
IOP___builtin_MatVecMulAdd = 361,
112-
IOP___builtin_OuterProductAccumulate = 362,
113-
IOP___builtin_VectorAccumulate = 363,
110+
IOP___builtin_MatVecMul = 363,
111+
IOP___builtin_MatVecMulAdd = 364,
112+
IOP___builtin_OuterProductAccumulate = 365,
113+
IOP___builtin_VectorAccumulate = 366,
114114
IOP_abort = 102,
115115
IOP_abs = 103,
116116
IOP_acos = 104,
@@ -235,6 +235,9 @@ enum class IntrinsicOp {
235235
IOP_VkReadClock = 223,
236236
IOP_Vkext_execution_mode = 224,
237237
IOP_Vkext_execution_mode_id = 225,
238+
IOP_Vkreinterpret_pointer_cast = 360,
239+
IOP_Vkstatic_pointer_cast = 361,
240+
MOP_GetBufferContents = 362,
238241
MOP_Append = 226,
239242
MOP_RestartStrip = 227,
240243
MOP_CalculateLevelOfDetail = 228,
@@ -370,7 +373,7 @@ enum class IntrinsicOp {
370373
IOP_usign = 355,
371374
MOP_InterlockedUMax = 356,
372375
MOP_InterlockedUMin = 357,
373-
Num_Intrinsics = 364,
376+
Num_Intrinsics = 367,
374377
};
375378
inline bool HasUnsignedIntrinsicOpcode(IntrinsicOp opcode) {
376379
switch (opcode) {

0 commit comments

Comments
 (0)