llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

[SPIRV][DirectX][HLSL] Move `lerp` implementation to `hlsl_intrinsics.h`

Open farzonl opened this issue 4 months ago • 4 comments

  1. Remove Intrinsic::dx_lerp and Intrinsic::spv_lerp
  2. Remove BI__builtin_hlsl_lerp
  3. Remove BI__builtin_hlsl_lerp Sema checks from clang/lib/Sema/SemaHLSL.cpp
  4. Remove getLerpIntrinsic from clang/lib/CodeGen/CGHLSLRuntime.h
  5. Remove emitting intrinsic from clang/lib/CodeGen/CGBuiltin.cpp
  6. Remove expandLerpIntrinsic in llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp
  7. Implement lerp algorithm in hlsl_intrinsics.h via tablegen
  8. (Follow-up) add a pattern match for lerp as an InstCombine in llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp to be able to still emit the lerp GL extension.

farzonl avatar Jul 30 '26 18:07 farzonl

For any future implementer I would like the pattern matching to be a separate pr from the movement to the code from the backends to the HLSL header.

farzonl avatar Jul 30 '26 18:07 farzonl

Pattern matching will be a separate follow-up issue: https://github.com/llvm/llvm-project/issues/214884

kmpeng avatar Aug 07 '26 23:08 kmpeng

@llvm/issue-subscribers-clang-frontend

Author: Farzon Lotfi (farzonl)

1. Remove `Intrinsic::dx_lerp ` and `Intrinsic::spv_lerp` 2. Remove `BI__builtin_hlsl_lerp` 3. Remove `BI__builtin_hlsl_lerp` Sema checks from `clang/lib/Sema/SemaHLSL.cpp` 4. Remove `getLerpIntrinsic` from `clang/lib/CodeGen/CGHLSLRuntime.h` 5. Remove emitting intrinsic from `clang/lib/CodeGen/CGBuiltin.cpp` 6. Remove `expandLerpIntrinsic` in `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` 7. Implement lerp algorithm in `hlsl_intrinsics.h` via tablegen 8. (Follow-up) add a pattern match for lerp as an InstCombine in `llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp` to be able to still emit the lerp GL extension.

@llvm/issue-subscribers-clang-codegen

Author: Farzon Lotfi (farzonl)

1. Remove `Intrinsic::dx_lerp ` and `Intrinsic::spv_lerp` 2. Remove `BI__builtin_hlsl_lerp` 3. Remove `BI__builtin_hlsl_lerp` Sema checks from `clang/lib/Sema/SemaHLSL.cpp` 4. Remove `getLerpIntrinsic` from `clang/lib/CodeGen/CGHLSLRuntime.h` 5. Remove emitting intrinsic from `clang/lib/CodeGen/CGBuiltin.cpp` 6. Remove `expandLerpIntrinsic` in `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` 7. Implement lerp algorithm in `hlsl_intrinsics.h` via tablegen 8. (Follow-up) add a pattern match for lerp as an InstCombine in `llvm/lib/Target/SPIRV/SPIRVPreLegalizerCombiner.cpp` to be able to still emit the lerp GL extension.