Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3035d31
Require CMake 3.17, remove CMP0051 (#7287)
llvm-beanz Apr 1, 2025
30bfd82
NFC: Infrastructure changes for DXIL op vector and multi-dim overload…
tex3d Apr 1, 2025
a13938d
PIX: Check for existing PIX UAV in roots sigs before adding it again …
jeffnn Apr 1, 2025
2f357a9
Fix assert due to unreachable discard (#7289)
amaiorano Apr 2, 2025
572aef5
Disable code owners in main (#7298)
llvm-beanz Apr 2, 2025
9eb7119
[SPIRV] Implements vk::BufferPointer proposal (#7163)
danbrown-amd Apr 2, 2025
2b1c2e6
Fix typo in exec tests comment (#7299)
alsepkow Apr 2, 2025
3b1a29b
[OMM] Add DXR Entry point test, non-library target test, conforming t…
bob80905 Apr 2, 2025
6556410
[SPIR-V] Implement QuadAny and QuadAll (#7266)
cassiebeckley Apr 3, 2025
9010244
Add UUID compiler extension check on Clang (#7286)
urshanselmann Apr 3, 2025
6a73640
Update DXC's CONTRIBUTING file (#7265)
llvm-beanz Apr 3, 2025
c9170e5
Update SPIRV-Tools (#7303)
s-perron Apr 3, 2025
85f3432
Fixes non-SPIR-V build, broken by PR #7163 ([SPIRV] Implements vk::Bu…
danbrown-amd Apr 3, 2025
e50f599
[NFC] Standardize DxilValidation variable capitalization (#7307)
Apr 4, 2025
0ffd60a
[SM6.9] Native vector load/store lowering (#7292)
Apr 4, 2025
9e91844
[NFC] containsLongVector -> ContainsLongVector (#7255)
llvm-beanz Apr 7, 2025
dc4a2b6
[PIX] Add a pass for PIX to log missing NonUniformResourceIndex usage…
nopandbrk Apr 7, 2025
c940161
Bump cryptography from 43.0.1 to 44.0.1 in /utils/git (#7220)
dependabot[bot] Apr 8, 2025
aca1035
Merge branch 'main' into staging-sm6.9
damyanp Apr 9, 2025
f69f281
chore: autopublish 2025-04-09T15:48:17Z
github-actions[bot] Apr 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* @microsoft/hlsl-release
# Uncomment the next line in release branches after ask-mode begins
# * @microsoft/hlsl-release
9 changes: 0 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ if(POLICY CMP0022)
cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
endif()

if (POLICY CMP0051)
# CMake 3.1 and higher include generator expressions of the form
# $<TARGETLIB:obj> in the SOURCES property. These need to be
# stripped everywhere that access the SOURCES property, so we just
# defer to the OLD behavior of not including generator expressions
# in the output for now.
cmake_policy(SET CMP0051 OLD)
endif()

if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
set(cmake_3_2_USES_TERMINAL)
else()
Expand Down
24 changes: 23 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,32 @@ Before submitting a feature or substantial code contribution please discuss it w

### Coding guidelines

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

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.

#### Applying LLVM Standards

All new code contributed to DXC should follow the LLVM coding standards.

Note that the LLVM Coding Standards have a golden rule:

> **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.**

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.

A good secondary rule to follow is:

> **When in doubt, follow LLVM.**

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.

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:

> **Code review is a conversation.**

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.

### Documenting Pull Requests

Pull request descriptions should have the following format:
Expand Down
8 changes: 8 additions & 0 deletions docs/SPIR-V.rst
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ Supported extensions
* SPV_KHR_maximal_reconvergence
* SPV_KHR_float_controls
* SPV_NV_shader_subgroup_partitioned
* SPV_KHR_quad_control

Vulkan specific attributes
--------------------------
Expand Down Expand Up @@ -4008,6 +4009,8 @@ Quad ``QuadReadAcrossX()`` ``OpGroupNonUniformQuadSwap``
Quad ``QuadReadAcrossY()`` ``OpGroupNonUniformQuadSwap``
Quad ``QuadReadAcrossDiagonal()`` ``OpGroupNonUniformQuadSwap``
Quad ``QuadReadLaneAt()`` ``OpGroupNonUniformQuadBroadcast``
Quad ``QuadAny()`` ``OpGroupNonUniformQuadAnyKHR``
Quad ``QuadAll()`` ``OpGroupNonUniformQuadAllKHR``
N/A ``WaveMatch()`` ``OpGroupNonUniformPartitionNV``
Multiprefix ``WaveMultiPrefixSum()`` ``OpGroupNonUniform*Add`` ``PartitionedExclusiveScanNV``
Multiprefix ``WaveMultiPrefixProduct()`` ``OpGroupNonUniform*Mul`` ``PartitionedExclusiveScanNV``
Expand All @@ -4016,6 +4019,11 @@ Multiprefix ``WaveMultiPrefixBitOr()`` ``OpGroupNonUniformLogicalOr`` `
Multiprefix ``WaveMultiPrefixBitXor()`` ``OpGroupNonUniformLogicalXor`` ``PartitionedExclusiveScanNV``
============= ============================ =================================== ==============================

``QuadAny`` and ``QuadAll`` will use the ``OpGroupNonUniformQuadAnyKHR`` and
``OpGroupNonUniformQuadAllKHR`` instructions if the ``SPV_KHR_quad_control``
extension is enabled. If it is not, they will fall back to constructing the
value using multiple calls to ``OpGroupNonUniformQuadBroadcast``.

The Implicit ``vk`` Namespace
=============================

Expand Down
29 changes: 20 additions & 9 deletions include/dxc/DXIL/DxilConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,6 @@ inline bool IsFeedbackTexture(DXIL::ResourceKind ResourceKind) {
// Enumeration for operations specified by DXIL
enum class OpCode : unsigned {
//
RawBufferVectorLoad = 303, // reads from a raw buffer and structured buffer
RawBufferVectorStore =
304, // writes to a RWByteAddressBuffer or RWStructuredBuffer
Reserved0 = 226, // Reserved
Reserved1 = 227, // Reserved
Reserved10 = 236, // Reserved
Expand Down Expand Up @@ -901,8 +898,11 @@ enum class OpCode : unsigned {
GetDimensions = 72, // gets texture size information
RawBufferLoad = 139, // reads from a raw buffer and structured buffer
RawBufferStore = 140, // writes to a RWByteAddressBuffer or RWStructuredBuffer
TextureLoad = 66, // reads texel data without any filtering or sampling
TextureStore = 67, // reads texel data without any filtering or sampling
RawBufferVectorLoad = 303, // reads from a raw buffer and structured buffer
RawBufferVectorStore =
304, // writes to a RWByteAddressBuffer or RWStructuredBuffer
TextureLoad = 66, // reads texel data without any filtering or sampling
TextureStore = 67, // reads texel data without any filtering or sampling
TextureStoreSample = 225, // stores texel data at specified sample index

// Sampler Feedback
Expand Down Expand Up @@ -1046,7 +1046,6 @@ enum class OpCode : unsigned {
NumOpCodes_Dxil_1_6 = 222,
NumOpCodes_Dxil_1_7 = 226,
NumOpCodes_Dxil_1_8 = 258,
NumOpCodes_Dxil_1_9 = 305,

NumOpCodes = 305 // exclusive last value of enumeration
};
Expand All @@ -1060,8 +1059,6 @@ enum class OpCode : unsigned {
// Groups for DXIL operations with equivalent function templates
enum class OpCodeClass : unsigned {
//
RawBufferVectorLoad,
RawBufferVectorStore,
Reserved,

// Amplification shader instructions
Expand Down Expand Up @@ -1284,6 +1281,8 @@ enum class OpCodeClass : unsigned {
GetDimensions,
RawBufferLoad,
RawBufferStore,
RawBufferVectorLoad,
RawBufferVectorStore,
TextureLoad,
TextureStore,
TextureStoreSample,
Expand Down Expand Up @@ -1361,7 +1360,6 @@ enum class OpCodeClass : unsigned {
NumOpClasses_Dxil_1_6 = 149,
NumOpClasses_Dxil_1_7 = 153,
NumOpClasses_Dxil_1_8 = 174,
NumOpClasses_Dxil_1_9 = 179,

NumOpClasses = 179 // exclusive last value of enumeration
};
Expand Down Expand Up @@ -1422,6 +1420,12 @@ const unsigned kRawBufferLoadElementOffsetOpIdx = 3;
const unsigned kRawBufferLoadMaskOpIdx = 4;
const unsigned kRawBufferLoadAlignmentOpIdx = 5;

// RawBufferVectorLoad.
const unsigned kRawBufferVectorLoadHandleOpIdx = 1;
const unsigned kRawBufferVectorLoadIndexOpIdx = 2;
const unsigned kRawBufferVectorLoadElementOffsetOpIdx = 3;
const unsigned kRawBufferVectorLoadAlignmentOpIdx = 4;

// RawBufferStore
const unsigned kRawBufferStoreHandleOpIdx = 1;
const unsigned kRawBufferStoreIndexOpIdx = 2;
Expand All @@ -1433,6 +1437,13 @@ const unsigned kRawBufferStoreVal3OpIdx = 7;
const unsigned kRawBufferStoreMaskOpIdx = 8;
const unsigned kRawBufferStoreAlignmentOpIdx = 9;

// RawBufferVectorStore
const unsigned kRawBufferVectorStoreHandleOpIdx = 1;
const unsigned kRawBufferVectorStoreIndexOpIdx = 2;
const unsigned kRawBufferVectorStoreElementOffsetOpIdx = 3;
const unsigned kRawBufferVectorStoreValOpIdx = 4;
const unsigned kRawBufferVectorStoreAlignmentOpIdx = 5;

// TextureStore.
const unsigned kTextureStoreHandleOpIdx = 1;
const unsigned kTextureStoreCoord0OpIdx = 2;
Expand Down
6 changes: 3 additions & 3 deletions include/dxc/DXIL/DxilOperations.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ class OP {

static bool IsDxilOpExtendedOverload(OpCode C);

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

private:
Expand Down
3 changes: 3 additions & 0 deletions include/dxc/DxilPIXPasses/DxilPIXPasses.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ ModulePass *createDxilDebugInstrumentationPass();
ModulePass *createDxilShaderAccessTrackingPass();
ModulePass *createDxilPIXAddTidToAmplificationShaderPayloadPass();
ModulePass *createDxilPIXDXRInvocationsLogPass();
ModulePass *createDxilNonUniformResourceIndexInstrumentationPass();

void initializeDxilAddPixelHitInstrumentationPass(llvm::PassRegistry &);
void initializeDxilDbgValueToDbgDeclarePass(llvm::PassRegistry &);
Expand All @@ -41,5 +42,7 @@ void initializeDxilShaderAccessTrackingPass(llvm::PassRegistry &);
void initializeDxilPIXAddTidToAmplificationShaderPayloadPass(
llvm::PassRegistry &);
void initializeDxilPIXDXRInvocationsLogPass(llvm::PassRegistry &);
void initializeDxilNonUniformResourceIndexInstrumentationPass(
llvm::PassRegistry &);

} // namespace llvm
5 changes: 4 additions & 1 deletion include/dxc/HlslIntrinsicOp.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ enum class IntrinsicOp {
IOP_VkReadClock = 223,
IOP_Vkext_execution_mode = 224,
IOP_Vkext_execution_mode_id = 225,
IOP_Vkreinterpret_pointer_cast = 360,
IOP_Vkstatic_pointer_cast = 361,
MOP_GetBufferContents = 362,
MOP_Append = 226,
MOP_RestartStrip = 227,
MOP_CalculateLevelOfDetail = 228,
Expand Down Expand Up @@ -366,7 +369,7 @@ enum class IntrinsicOp {
IOP_usign = 355,
MOP_InterlockedUMax = 356,
MOP_InterlockedUMin = 357,
Num_Intrinsics = 360,
Num_Intrinsics = 363,
};
inline bool HasUnsignedIntrinsicOpcode(IntrinsicOp opcode) {
switch (opcode) {
Expand Down
3 changes: 2 additions & 1 deletion include/dxc/WinAdapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@
#define _countof(a) (sizeof(a) / sizeof(*(a)))

// If it is GCC, there is no UUID support and we must emulate it.
#ifndef __clang__
// Clang support depends on the -fms-extensions compiler flag.
#if !defined(__clang__) || !defined(_MSC_EXTENSIONS)
#define __EMULATE_UUID 1
#endif // __clang__

Expand Down
9 changes: 9 additions & 0 deletions include/dxc/dxcapi.internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
// //
// Provides non-public declarations for the DirectX Compiler component. //
// //
// Modifications Copyright(C) 2025 Advanced Micro Devices, Inc. //
// All rights reserved. //
// //
///////////////////////////////////////////////////////////////////////////////

#ifndef __DXC_API_INTERNAL__
Expand Down Expand Up @@ -35,6 +38,7 @@ typedef struct ID3D10Blob ID3D10Blob;
static const BYTE INTRIN_TEMPLATE_FROM_TYPE = 0xff;
static const BYTE INTRIN_TEMPLATE_VARARGS = 0xfe;
static const BYTE INTRIN_TEMPLATE_FROM_FUNCTION = 0xfd;
static const BYTE INTRIN_TEMPLATE_FROM_FUNCTION_2 = 0xfc;

// Use this enumeration to describe allowed templates (layouts) in intrinsics.
enum LEGAL_INTRINSIC_TEMPLATES {
Expand Down Expand Up @@ -128,7 +132,12 @@ enum LEGAL_INTRINSIC_COMPTYPES {

LICOMPTYPE_HIT_OBJECT = 51,

#ifdef ENABLE_SPIRV_CODEGEN
LICOMPTYPE_VK_BUFFER_POINTER = 52,
LICOMPTYPE_COUNT = 53
#else
LICOMPTYPE_COUNT = 52
#endif
};

static const BYTE IA_SPECIAL_BASE = 0xf0;
Expand Down
14 changes: 9 additions & 5 deletions lib/DXIL/DxilOperations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2633,6 +2633,8 @@ const OP::OpCodeProperty OP::m_OpCodeProps[(unsigned)OP::OpCode::NumOpCodes] = {
0,
{},
{}}, // Overloads: v

// Resources
{OC::RawBufferVectorLoad,
"RawBufferVectorLoad",
OCC::RawBufferVectorLoad,
Expand Down Expand Up @@ -2816,8 +2818,7 @@ bool OP::IsOverloadLegal(OpCode opCode, Type *pType) {
if (OpProps.NumOverloadDims > 1) {
StructType *ST = dyn_cast<StructType>(pType);
// Make sure multi-overload is well-formed.
if (!ST || ST->hasName() ||
ST->getNumContainedTypes() != OpProps.NumOverloadDims)
if (!ST || ST->hasName() || ST->getNumElements() != OpProps.NumOverloadDims)
return false;
for (unsigned I = 0; I < ST->getNumElements(); ++I)
Types[I] = ST->getElementType(I);
Expand Down Expand Up @@ -5757,6 +5758,8 @@ Function *OP::GetOpFunc(OpCode opCode, Type *pOverloadType) {
A(pV);
A(pI32);
break;

// Resources
case OpCode::RawBufferVectorLoad:
RRT(pETy);
A(pI32);
Expand Down Expand Up @@ -6224,11 +6227,12 @@ bool OP::IsResRetType(llvm::Type *Ty) {
if (Ty == ResTy)
return true;
}
// Check for vector overload which isn't cached in m_pResRetType.
StructType *ST = cast<StructType>(Ty);
if (!ST->hasName() || ST->getNumContainedTypes() < 2)
if (!ST->hasName() || ST->getNumElements() < 2 ||
!ST->getElementType(0)->isVectorTy())
return false;
return Ty == GetResRetType(ST->getContainedType(0));
return false;
return Ty == GetResRetType(ST->getElementType(0));
}

Type *OP::GetResRetType(Type *pOverloadType) {
Expand Down
1 change: 1 addition & 0 deletions lib/DxilPIXPasses/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ add_llvm_library(LLVMDxilPIXPasses
PixPassHelpers.cpp
DxilPIXAddTidToAmplificationShaderPayload.cpp
DxilPIXDXRInvocationsLog.cpp
DxilNonUniformResourceIndexInstrumentation.cpp

ADDITIONAL_HEADER_DIRS
${LLVM_MAIN_INCLUDE_DIR}/llvm/IR
Expand Down
Loading