Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 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…
Apr 7, 2025
c940161
Bump cryptography from 43.0.1 to 44.0.1 in /utils/git (#7220)
dependabot[bot] Apr 8, 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
33 changes: 28 additions & 5 deletions include/dxc/DXIL/DxilConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,11 @@ const float kMinMipLodBias = -16.0f;

const unsigned kResRetStatusIndex = 4;

/* <py::lines('OLOAD_DIMS-TEXT')>hctdb_instrhelp.get_max_oload_dims()</py>*/
// OLOAD_DIMS-TEXT:BEGIN
const unsigned kDxilMaxOloadDims = 2;
// OLOAD_DIMS-TEXT:END

enum class ComponentType : uint32_t {
Invalid = 0,
I1,
Expand Down Expand Up @@ -893,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 @@ -1039,7 +1047,7 @@ enum class OpCode : unsigned {
NumOpCodes_Dxil_1_7 = 226,
NumOpCodes_Dxil_1_8 = 258,

NumOpCodes = 303 // exclusive last value of enumeration
NumOpCodes = 305 // exclusive last value of enumeration
};
// OPCODE-ENUM:END

Expand Down Expand Up @@ -1273,6 +1281,8 @@ enum class OpCodeClass : unsigned {
GetDimensions,
RawBufferLoad,
RawBufferStore,
RawBufferVectorLoad,
RawBufferVectorStore,
TextureLoad,
TextureStore,
TextureStoreSample,
Expand Down Expand Up @@ -1351,7 +1361,7 @@ enum class OpCodeClass : unsigned {
NumOpClasses_Dxil_1_7 = 153,
NumOpClasses_Dxil_1_8 = 174,

NumOpClasses = 177 // exclusive last value of enumeration
NumOpClasses = 179 // exclusive last value of enumeration
};
// OPCODECLASS-ENUM:END

Expand Down Expand Up @@ -1410,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 @@ -1419,7 +1435,14 @@ const unsigned kRawBufferStoreVal1OpIdx = 5;
const unsigned kRawBufferStoreVal2OpIdx = 6;
const unsigned kRawBufferStoreVal3OpIdx = 7;
const unsigned kRawBufferStoreMaskOpIdx = 8;
const unsigned kRawBufferStoreAlignmentOpIdx = 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;
Expand Down
93 changes: 93 additions & 0 deletions include/dxc/DXIL/DxilInstructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -8923,5 +8923,98 @@ struct DxilInst_HitObject_MakeNop {
// Metadata
bool requiresUniformInputs() const { return false; }
};

/// This instruction reads from a raw buffer and structured buffer
struct DxilInst_RawBufferVectorLoad {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_RawBufferVectorLoad(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::RawBufferVectorLoad);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (5 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_buf = 1,
arg_index = 2,
arg_elementOffset = 3,
arg_alignment = 4,
};
// Accessors
llvm::Value *get_buf() const { return Instr->getOperand(1); }
void set_buf(llvm::Value *val) { Instr->setOperand(1, val); }
llvm::Value *get_index() const { return Instr->getOperand(2); }
void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
llvm::Value *get_elementOffset() const { return Instr->getOperand(3); }
void set_elementOffset(llvm::Value *val) { Instr->setOperand(3, val); }
llvm::Value *get_alignment() const { return Instr->getOperand(4); }
void set_alignment(llvm::Value *val) { Instr->setOperand(4, val); }
int32_t get_alignment_val() const {
return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(4))
->getZExtValue());
}
void set_alignment_val(int32_t val) {
Instr->setOperand(4, llvm::Constant::getIntegerValue(
llvm::IntegerType::get(Instr->getContext(), 32),
llvm::APInt(32, (uint64_t)val)));
}
};

/// This instruction writes to a RWByteAddressBuffer or RWStructuredBuffer
struct DxilInst_RawBufferVectorStore {
llvm::Instruction *Instr;
// Construction and identification
DxilInst_RawBufferVectorStore(llvm::Instruction *pInstr) : Instr(pInstr) {}
operator bool() const {
return hlsl::OP::IsDxilOpFuncCallInst(
Instr, hlsl::OP::OpCode::RawBufferVectorStore);
}
// Validation support
bool isAllowed() const { return true; }
bool isArgumentListValid() const {
if (6 != llvm::dyn_cast<llvm::CallInst>(Instr)->getNumArgOperands())
return false;
return true;
}
// Metadata
bool requiresUniformInputs() const { return false; }
// Operand indexes
enum OperandIdx {
arg_uav = 1,
arg_index = 2,
arg_elementOffset = 3,
arg_value0 = 4,
arg_alignment = 5,
};
// Accessors
llvm::Value *get_uav() const { return Instr->getOperand(1); }
void set_uav(llvm::Value *val) { Instr->setOperand(1, val); }
llvm::Value *get_index() const { return Instr->getOperand(2); }
void set_index(llvm::Value *val) { Instr->setOperand(2, val); }
llvm::Value *get_elementOffset() const { return Instr->getOperand(3); }
void set_elementOffset(llvm::Value *val) { Instr->setOperand(3, val); }
llvm::Value *get_value0() const { return Instr->getOperand(4); }
void set_value0(llvm::Value *val) { Instr->setOperand(4, val); }
llvm::Value *get_alignment() const { return Instr->getOperand(5); }
void set_alignment(llvm::Value *val) { Instr->setOperand(5, val); }
int32_t get_alignment_val() const {
return (int32_t)(llvm::dyn_cast<llvm::ConstantInt>(Instr->getOperand(5))
->getZExtValue());
}
void set_alignment_val(int32_t val) {
Instr->setOperand(5, llvm::Constant::getIntegerValue(
llvm::IntegerType::get(Instr->getContext(), 32),
llvm::APInt(32, (uint64_t)val)));
}
};
// INSTR-HELPER:END
} // namespace hlsl
Loading
Loading