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 CheckAccessFullyMapped HLSL Function #99204

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

Implement the CheckAccessFullyMapped HLSL Function #99204

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

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
71 CheckAccessFullyMapped 6.0 ()

SPIR-V

OpImageSparseTexelsResident:

Description:

Translates a Resident Code into a Boolean. Result is false if any
of the texels were in uncommitted texture memory, and true
otherwise.

Result Type must be a Boolean type scalar.

Resident Code is a value from an OpImageSparse…​ instruction that
results in a resident code.

Capability:
SparseResidency

Word Count Opcode Results Operands

4

316

<id>
Result Type

Result <id>

<id>
Resident Code

Test Case(s)

Example 1

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

RWBuffer<float4> g_buffer;

[numthreads(1, 1, 1)]
[shader("pixel")]
bool fn( ) : SV_Target {
	uint p1;
	float4 data = g_buffer.Load(0, p1);
	return CheckAccessFullyMapped(p1);
}

HLSL:

Determines whether all values from a Sample, Gather, or Load operation accessed mapped tiles in a tiled resource.

Syntax

bool CheckAccessFullyMapped(
  in uint_only status
);

Parameters

status [in]

Type: uint_only

The status value that is returned from a Sample, Gather, or Load operation. Because you can't access this status value directly, you need to pass it to CheckAccessFullyMapped.

Return value

Type: bool

Returns a Boolean value that indicates whether all values from a Sample, Gather, or Load operation accessed mapped tiles in a tiled resource. Returns TRUE if all values from the operation accessed mapped tiles; otherwise, returns FALSE if any values were taken from an unmapped tile.

Remarks

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 x

 

See also

Intrinsic Functions

@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
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