Skip to content
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

Implement the unpack_u8u16 HLSL Function #99223

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

Implement the unpack_u8u16 HLSL Function #99223

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 unpack_u8u16 clang builtin,
  • Link unpack_u8u16 clang builtin with hlsl_intrinsics.h
  • Add sema checks for unpack_u8u16 to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for unpack_u8u16 to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/unpack_u8u16.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/unpack_u8u16-errors.hlsl
  • Create the int_dx_unpack_u8u16 intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_dx_unpack_u8u16 to 219 in DXIL.td
  • Create the unpack_u8u16.ll and unpack_u8u16_errors.ll tests in llvm/test/CodeGen/DirectX/
  • Create the int_spv_unpack_u8u16 intrinsic in IntrinsicsSPIRV.td
  • In SPIRVInstructionSelector.cpp create the unpack_u8u16 lowering and map it to int_spv_unpack_u8u16 in SPIRVInstructionSelector::selectIntrinsic.
  • Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/unpack_u8u16.ll

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
219 Unpack4x8 6.6 ()

SPIR-V

OpUConvert:

Description:

Convert unsigned width. This is either a truncate or a zero extend.

Result Type must be a scalar or vector of integer type,
whose Signedness operand is 0.

Unsigned Value must be a scalar or vector of integer
type
. It must have the same number of components as Result
Type
. The component width must not equal the component width in Result
Type
.

Results are computed per component.

Word Count Opcode Results Operands

4

113

<id>
Result Type

Result <id>

<id>
Unsigned Value

Test Case(s)

Example 1

//dxc unpack_u8u16_test.hlsl -T lib_6_8 -enable-16bit-types -O0

export uint16_t4 fn(uint8_t4_packed p1) {
    return unpack_u8u16(p1);
}

HLSL:

Syntax

uint16_t<4> unpack_u8u16(p32u8 pk);

Type Description

Name Template Type Component Type Size
ret vector uint16_t 4
pk scalar uint8_t4_packed 1

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 6.6 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
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: No status
Development

No branches or pull requests

1 participant