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

[HLSL] Add DirectXTargetCodeGenInfo and the code paths to convert HLSL types to DirectX target types #95952

Closed
Tracked by #101557
bogner opened this issue Jun 18, 2024 · 3 comments · Fixed by #110327
Closed
Tracked by #101557
Assignees
Labels
clang:codegen clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support

Comments

@bogner
Copy link
Contributor

bogner commented Jun 18, 2024

Introduce CGHLSLRuntime::convertHLSLSpecificType and TargetInfo::getHLSLType interfaces and implement these in DirectXTargetCodeGenInfo to lower the HLSLResource built in type to DirectX-specific TargetExtTypes.

The interfaces should be similar to the OpenCL interfaces of the same names.

AC:

  • The HLSLResource built in type used in HLSL's RWBuffer is converted to a target("dx.TypedBuffer") during clang codegen when targeting DXIL
  • It's obvious where and how to add logic for other HLSL buffer and DXIL target types
@bogner bogner added the HLSL HLSL Language Support label Jun 18, 2024
@bogner bogner self-assigned this Jun 18, 2024
@bogner bogner removed their assignment Jun 18, 2024
hekota added a commit to hekota/llvm-project that referenced this issue Jun 21, 2024
Modify all places where HLSLResource needs to be added to use the def file.

Future intangible types will be added just to HLSLIntangibleTypes.def and everything else should just work.

Add getHLSLType virtual method to TargetCodeGenInfo to be overridden in future DirectXTargetCodeGenInfo class (llvm#95952).
@bogner bogner self-assigned this Jul 15, 2024
@bogner bogner moved this to Ready in HLSL Support Jul 15, 2024
@damyanp damyanp assigned hekota and unassigned bogner Jul 31, 2024
hekota added a commit to hekota/llvm-project that referenced this issue Aug 19, 2024
Adds TargetCodeGenInfo class for DirectX. Currently in only translates `target("dx.TypedBuffer", i32, 1, 0, 1)` for now (`RWBuffer<int>`). More work us needed to determine the actual target exp type and its parameters based on attributes on the handle type (not yet implemented).

Part 1/2 of llvm#95952
@hekota
Copy link
Member

hekota commented Aug 20, 2024

Blocked by #104861

hekota added a commit that referenced this issue Sep 10, 2024
Adds target codegen info class for DirectX. For now it always translates
`__hlsl_resource_t` handle to `target("dx.TypedBuffer", i32, 1, 0, 1)`
(`RWBuffer<int>`). More work is needed to determine the actual target
exp type and parameters based on the resource handle attributes.

Part 1/2 of #95952
@pow2clk pow2clk moved this from Ready to Active in HLSL Support Sep 23, 2024
@damyanp damyanp moved this from Active to Reviewing in HLSL Support Oct 10, 2024
hekota added a commit that referenced this issue Oct 15, 2024
…o convert HLSL types to DirectX target types (#110327)

Translates `RWBuffer` and `StructuredBuffer` resources buffer types to
DirectX target types `dx.TypedBuffer` and `dx.RawBuffer`.

Includes a change of `HLSLAttributesResourceType` from 'sugar' type to
full canonical type. This is required for codegen and other clang
infrastructure to work property on HLSL resource types.

Fixes #95952 (part 2/2)
@EugeneZelenko EugeneZelenko added clang:frontend Language frontend issues, e.g. anything involving "Sema" clang:codegen labels Oct 15, 2024
@llvmbot
Copy link
Member

llvmbot commented Oct 15, 2024

@llvm/issue-subscribers-clang-codegen

Author: Justin Bogner (bogner)

Introduce `CGHLSLRuntime::convertHLSLSpecificType` and `TargetInfo::getHLSLType` interfaces and implement these in DirectXTargetCodeGenInfo to lower the HLSLResource built in type to DirectX-specific TargetExtTypes.

The interfaces should be similar to the OpenCL interfaces of the same names.

AC:

  • The HLSLResource built in type used in HLSL's RWBuffer is converted to a target("dx.TypedBuffer") during clang codegen when targeting DXIL
  • It's obvious where and how to add logic for other HLSL buffer and DXIL target types

@llvmbot
Copy link
Member

llvmbot commented Oct 15, 2024

@llvm/issue-subscribers-clang-frontend

Author: Justin Bogner (bogner)

Introduce `CGHLSLRuntime::convertHLSLSpecificType` and `TargetInfo::getHLSLType` interfaces and implement these in DirectXTargetCodeGenInfo to lower the HLSLResource built in type to DirectX-specific TargetExtTypes.

The interfaces should be similar to the OpenCL interfaces of the same names.

AC:

  • The HLSLResource built in type used in HLSL's RWBuffer is converted to a target("dx.TypedBuffer") during clang codegen when targeting DXIL
  • It's obvious where and how to add logic for other HLSL buffer and DXIL target types

DanielCChen pushed a commit to DanielCChen/llvm-project that referenced this issue Oct 16, 2024
…o convert HLSL types to DirectX target types (llvm#110327)

Translates `RWBuffer` and `StructuredBuffer` resources buffer types to
DirectX target types `dx.TypedBuffer` and `dx.RawBuffer`.

Includes a change of `HLSLAttributesResourceType` from 'sugar' type to
full canonical type. This is required for codegen and other clang
infrastructure to work property on HLSL resource types.

Fixes llvm#95952 (part 2/2)
@damyanp damyanp removed the status in HLSL Support Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen clang:frontend Language frontend issues, e.g. anything involving "Sema" HLSL HLSL Language Support
Projects
Status: No status
4 participants