Skip to content

Implement the NonUniformResourceIndex HLSL Function #99206

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
9 tasks
Tracked by #99235
farzonl opened this issue Jul 16, 2024 · 1 comment
Open
9 tasks
Tracked by #99235

Implement the NonUniformResourceIndex HLSL Function #99206

farzonl opened this issue Jul 16, 2024 · 1 comment
Labels
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 NonUniformResourceIndex clang builtin,
  • Link NonUniformResourceIndex clang builtin with hlsl_intrinsics.h
  • Add sema checks for NonUniformResourceIndex to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for NonUniformResourceIndex to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/NonUniformResourceIndex.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/NonUniformResourceIndex-errors.hlsl
  • Create the int_spv_NonUniformResourceIndex intrinsic in IntrinsicsSPIRV.td
  • In SPIRVInstructionSelector.cpp create the NonUniformResourceIndex lowering and map it to int_spv_NonUniformResourceIndex in SPIRVInstructionSelector::selectIntrinsic.
  • Create SPIR-V backend test case in llvm/test/CodeGen/SPIRV/hlsl-intrinsics/NonUniformResourceIndex.ll

DirectX

There were no DXIL opcodes found for NonUniformResourceIndex.

SPIR-V

OpCopyObject:

Description:

Make a copy of Operand. There are no pointer dereferences involved.

Result Type must equal Operand type. Result Type can be any type
except OpTypeVoid.

Word Count Opcode Results Operands

4

83

<id>
Result Type

Result <id>

<id>
Operand

Test Case(s)

Example 1

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

export float4 fn(float4 p1) {
    return NonUniformResourceIndex(p1);
}

HLSL:

Syntax

any<> NonUniformResourceIndex(any<> index);

Type Description

Name Template Type Component Type Size
ret scalar, vector, or matrix bool, float, or int any
index scalar, vector, or matrix bool, float, or int any

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 6 and higher shader models yes

Shader Stages

See also

@farzonl farzonl added 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
@davidcook-msft davidcook-msft moved this from Planning to Designing in HLSL Support Jan 7, 2025
@damyanp
Copy link
Contributor

damyanp commented Jan 7, 2025

This needs further design work - NonUniformResourceIndex is interesting, and is only really expected to be used when accessing a resource array.

@damyanp damyanp removed the status in HLSL Support Apr 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

2 participants