Description
AC:
- The intrinsic is implemented
- Tests validate that it is lowered to LLVM-IR
- Tests validate that control forms are not hoisted out of control flow
** Maps to the correct construct
- Implement
GroupMemoryBarrierWithGroupSync
clang builtin,LinkGroupMemoryBarrierWithGroupSync
clang builtin withhlsl_intrinsics.h
Add sema checks forGroupMemoryBarrierWithGroupSync
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
Add codegen forGroupMemoryBarrierWithGroupSync
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
Add codegen tests toclang/test/CodeGenHLSL/builtins/GroupMemoryBarrierWithGroupSync.hlsl
Add sema tests toclang/test/SemaHLSL/BuiltIns/GroupMemoryBarrierWithGroupSync-errors.hlsl
Create theint_dx_GroupMemoryBarrierWithGroupSync
intrinsic inIntrinsicsDirectX.td
Create theDXILOpMapping
ofint_dx_GroupMemoryBarrierWithGroupSync
to80
inDXIL.td
Create theGroupMemoryBarrierWithGroupSync.ll
andGroupMemoryBarrierWithGroupSync_errors.ll
tests inllvm/test/CodeGen/DirectX/
Create theint_spv_GroupMemoryBarrierWithGroupSync
intrinsic inIntrinsicsSPIRV.td
In SPIRVInstructionSelector.cpp create theGroupMemoryBarrierWithGroupSync
lowering and map it toint_spv_GroupMemoryBarrierWithGroupSync
inSPIRVInstructionSelector::selectIntrinsic
.Create SPIR-V backend test case inllvm/test/CodeGen/SPIRV/hlsl-intrinsics/GroupMemoryBarrierWithGroupSync.ll
DirectX
DXIL Opcode | DXIL OpName | Shader Model | Shader Stages |
---|---|---|---|
80 | Barrier | 6.0 | () |
SPIR-V
OpControlBarrier:
Description:
Wait for all active invocations within the specified
Scope to reach the current point of execution.
All active invocations within Execution scope reach
this point of execution before any invocation proceeds beyond it.
When Execution is Workgroup or larger, behavior is undefined
unless all invocations within Execution execute the same dynamic
instance of this instruction.
If Semantics is not None, this instruction also serves as an
OpMemoryBarrier instruction, and also performs
and adheres to the description and semantics of an OpMemoryBarrier
instruction with the same Memory and Semantics operands. This allows
atomically specifying both a control barrier and a memory barrier (that
is, without needing two instructions). If Semantics is None,
Memory is ignored.
Before version 1.3, it is only valid to use this instruction with
TessellationControl, GLCompute, or Kernel execution
models. There is no such restriction starting with
version 1.3.
If used with the TessellationControl execution
model, it also implicitly synchronizes the Output
Storage Class: Writes to Output variables
performed by any invocation executed prior to a OpControlBarrier are
visible to any other invocation proceeding beyond that
OpControlBarrier.
Word Count | Opcode | Results | Operands | |
---|---|---|---|---|
4 |
224 |
Scope <id> |
Scope <id> |
Memory Semantics
<id> |
Test Case(s)
Example 1
//dxc GroupMemoryBarrierWithGroupSync_test.hlsl -T lib_6_8 -enable-16bit-types -spirv -fspv-target-env=universal1.5 -fcgl -O0
export void fn() {
return GroupMemoryBarrierWithGroupSync();
}
HLSL:
Blocks execution of all threads in a group until all group shared accesses have been completed and all threads in the group have reached this call.
Syntax
void GroupMemoryBarrierWithGroupSync(void);
Parameters
This function has no parameters.
Return value
This function does not return a value.
Remarks
The behavior of calls to this function that are within diverging branches of a thread group are undefined.
Minimum Shader Model
This function is supported in the following shader models.
Shader Model | Supported |
---|---|
Shader Model 5 and higher shader models | yes |
This function is supported in the following types of shaders:
Vertex | Hull | Domain | Geometry | Pixel | Compute |
---|---|---|---|---|---|
x |
See also
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Activity
[-][HLSL] implement `GroupMemoryBarrierWithGroupSync` intrinsic[/-][+]Implement the `GroupMemoryBarrierWithGroupSync` HLSL Function[/+]damyanp commentedon Oct 4, 2024
Marking re-estimate this. Since this was originally refined, we have a different approach to implementing intrinsics and the way we've been estimating intrinsics has changed quite a bit.
adam-yang commentedon Oct 7, 2024
I'll be working on this.
26 remaining items