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 Barrier HLSL Function #99234

Open
9 tasks
Tracked by #99235
farzonl opened this issue Jul 16, 2024 · 1 comment
Open
9 tasks
Tracked by #99235

Implement the Barrier HLSL Function #99234

farzonl opened this issue Jul 16, 2024 · 1 comment
Labels
backend:DirectX 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 Barrier clang builtin,
  • Link Barrier clang builtin with hlsl_intrinsics.h
  • Add sema checks for Barrier to CheckHLSLBuiltinFunctionCall in SemaChecking.cpp
  • Add codegen for Barrier to EmitHLSLBuiltinExpr in CGBuiltin.cpp
  • Add codegen tests to clang/test/CodeGenHLSL/builtins/Barrier.hlsl
  • Add sema tests to clang/test/SemaHLSL/BuiltIns/Barrier-errors.hlsl
  • Create the int_dx_Barrier intrinsic in IntrinsicsDirectX.td
  • Create the DXILOpMapping of int_dx_Barrier to 244 in DXIL.td
  • Create the Barrier.ll and Barrier_errors.ll tests in llvm/test/CodeGen/DirectX/

DirectX

DXIL Opcode DXIL OpName Shader Model Shader Stages
244 BarrierByMemoryType 6.8 ()

SPIR-V

There is no support for Barrier when targeting SPIR-V.

Test Case(s)

Example 1

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

export void fn() {
	uint p1 = 1;
	uint p2 = 1;

    return Barrier(p1, p2);
}

Example 2

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

export void fn() {
	uint p1 = 1;
	uint p2 = 1;

    return Barrier(p1, p2);
}

HLSL:

Syntax

void Barrier(uint MemoryTypeFlags, uint SemanticFlags);
void Barrier(NodeRecordOrUAV o, uint SemanticFlags);

Type Description

Name Template Type Component Type Size
ret void void 0
MemoryTypeFlags scalar uint 1
SemanticFlags scalar uint 1

Type Description

Name Template Type Component Type Size
ret void void 0
o scalar 1
SemanticFlags scalar uint 1

Minimum Shader Model

This function is supported in the following shader models.

Shader Model Supported
Shader Model 6.8 and higher shader models yes

Shader Stages

See also

@farzonl farzonl added backend:DirectX 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 Designing 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 bot:HLSL HLSL HLSL Language Support metabug Issue to collect references to a group of similar or related issues.
Projects
Status: Designing
Development

No branches or pull requests

1 participant