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

[DXIL] Add log, log2, and log10 intrinsic Lowering #86192

Closed
Tracked by #30
farzonl opened this issue Mar 21, 2024 · 0 comments · Fixed by #86569
Closed
Tracked by #30

[DXIL] Add log, log2, and log10 intrinsic Lowering #86192

farzonl opened this issue Mar 21, 2024 · 0 comments · Fixed by #86569
Assignees

Comments

@farzonl
Copy link
Member

farzonl commented Mar 21, 2024

Needs to cover the float and half case for all three: https://godbolt.org/z/64fzEq3nd

This is a perfect candidate for instruction expansion:

  • log2
    • This is the simplest case just call unary dxilop 23
  • log
    • Call log2 DXIL op (ie 23)
    • Create a ln2 const value
      • M_LN2_F 0.693147180559945309417232121458176568f
      • M_LN2_H 0.693147180559945309417232121458176568h
    • Floating point multiply the value of M_LN2 with the return value of log2
    • Reference implementation
  • log10
    • Define M_LN10
      • M_LN10_F 2.30258509299404568401799145468436421f
      • M_LN10_H 2.30258509299404568401799145468436421h
    • Call log2 DXIL op (ie 23)
    • Create a log2_10Const = M_LN2 / M_LN10 const value
  • Floating point multiply the value of log2_10Const with the return value of log2
  • Reference implementation
@farzonl farzonl self-assigned this Mar 25, 2024
farzonl added a commit to farzonl/llvm-project that referenced this issue Mar 25, 2024
Completes llvm#86192
`DXIL.td` - add log2 to dxilop lowering
`DXILIntrinsicExpansion.cpp` - add log and log10 to log2 expansions
@farzonl farzonl moved this to Active in HLSL Support Mar 25, 2024
@farzonl farzonl linked a pull request Mar 25, 2024 that will close this issue
farzonl added a commit to farzonl/llvm-project that referenced this issue Mar 26, 2024
Completes llvm#86192
`DXIL.td` - add log2 to dxilop lowering
`DXILIntrinsicExpansion.cpp` - add log and log10 to log2 expansions
farzonl added a commit that referenced this issue Mar 26, 2024
Completes #86192
`DXIL.td` - add log2 to dxilop lowering
`DXILIntrinsicExpansion.cpp` - add log and log10 to log2 expansions
@github-project-automation github-project-automation bot moved this from Active to Done in HLSL Support Mar 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant