Skip to content

Implement the WaveMatch HLSL Function #99207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
12 tasks
Tracked by #99235
farzonl opened this issue Jul 16, 2024 · 0 comments
Open
12 tasks
Tracked by #99235

Implement the WaveMatch HLSL Function #99207

farzonl opened this issue Jul 16, 2024 · 0 comments
Labels
backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.

Comments

@farzonl
Copy link
Member

farzonl commented Jul 16, 2024

  • 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

@farzonl farzonl added backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues. labels Jul 16, 2024
@damyanp damyanp moved this to Ready in HLSL Support Oct 30, 2024
@damyanp damyanp moved this from Ready to Planning in HLSL Support Oct 30, 2024
@damyanp damyanp moved this from Planning to Ready in HLSL Support Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend:DirectX backend:SPIR-V bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.
Projects
Status: Ready
Development

No branches or pull requests

1 participant