Skip to content

Implement the WaveMatch HLSL Function #99207

Open
Listed in
@farzonl

Description

@farzonl
  • Implement WaveMatch clang builtin,
    Link WaveMatch clang builtin with hlsl_intrinsics.h
    Add sema checks for WaveMatch to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
    Add codegen for WaveMatch to EmitHLSLBuiltinExpr in CGBuiltin.cpp
    Add codegen tests to clang/test/CodeGenHLSL/builtins/WaveMatch.hlsl
    Add sema tests to clang/test/SemaHLSL/BuiltIns/WaveMatch-errors.hlsl
    Create the int_dx_WaveMatch intrinsic in IntrinsicsDirectX.td
    Create the DXILOpMapping of int_dx_WaveMatch to 165 in DXIL.td
    Create the WaveMatch.ll and WaveMatch_errors.ll tests in llvm/test/CodeGen/DirectX/
    Create the int_spv_WaveMatch intrinsic in IntrinsicsSPIRV.td
    In SPIRVInstructionSelector.cpp create the WaveMatch lowering and map it to int_spv_WaveMatch in SPIRVInstructionSelector::selectIntrinsic.
    Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveMatch.ll

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
165 WaveMatch 6.5 ('library', 'compute', 'amplification', 'mesh', 'pixel', 'vertex', 'hull', 'domain', 'geometry', 'raygeneration', 'intersection', 'anyhit', 'closesthit', 'miss', 'callable', 'node')

SPIR-V

OpGroupNonUniformPartitionNV:

Description:

Reserved.

Capability:
GroupNonUniformPartitionedNV

Reserved.

Word Count Opcode Results Operands

4

5296

<id>
Result Type

Result <id>

<id>
Value

Test Case(s)

Example 1

//dxc WaveMatch_test.hlsl -T lib_6_8 -enable-16bit-types -O1

export uint4 fn(float4 p1) {
    return WaveMatch(p1);
}

Example 2

//dxc WaveMatch_1_test.hlsl -T lib_6_8 -enable-16bit-types -O1

export uint4 fn(uint4 p1) {
    return WaveMatch(p1);
}

Example 3

//dxc WaveMatch_2_test.hlsl -T lib_6_8 -enable-16bit-types -O1

export uint4 fn(int4 p1) {
    return WaveMatch(p1);
}

HLSL:

Syntax

uint<4> WaveMatch(numeric<> value);

Type Description

Name Template Type Component Type Size
ret vector uint 4
value scalar, vector, or matrix float or int any

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 6.5 and higher shader models yes

Shader Stages

See also

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Ready

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @farzonl

        Issue actions

          Implement the `WaveMatch` HLSL Function · Issue #99207 · llvm/llvm-project