-
Notifications
You must be signed in to change notification settings - Fork 13k
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] implement exp intrinsic #70072
Labels
Comments
farzonl
added a commit
to farzonl/llvm-project
that referenced
this issue
Mar 4, 2024
This change implements: llvm#70072 hlsl_intrinsics.h - add the exp api DXIL.td add the llvm intrinsic to DXIL opcode lowering mapping This change reuses llvm's existing intrinsic __builtin_elementwise_exp\ int_exp
farzonl
added a commit
to farzonl/llvm-project
that referenced
this issue
Mar 4, 2024
This change implements: llvm#70072 hlsl_intrinsics.h - add the exp api DXIL.td add the llvm intrinsic to DXIL opcode lowering mapping This change reuses llvm's existing intrinsic __builtin_elementwise_exp\ int_exp
farzonl
added a commit
that referenced
this issue
Mar 5, 2024
This change implements: #70072 - `hlsl_intrinsics.h` - add the `exp` api - `DXIL.td` - add the llvm intrinsic to DXIL opcode lowering mapping. - This change reuses llvm's existing intrinsic `__builtin_elementwise_exp` \ `int_exp` & `__builtin_elementwise_exp2` \ `int_exp2` - This PR is part 1 of 2. - Part 2 requires an intrinsic to instructions lowering. Part2 will expand `int_exp` to ``` A = Builder.CreateFMul(log2eConst, val); int_exp2(A) ``` just like we do in [TranslateExp](https://github.com/microsoft/DirectXShaderCompiler/blob/main/lib/HLSL/HLOperationLower.cpp#L2220C1-L2236C2)
farzonl
added a commit
to farzonl/llvm-project
that referenced
this issue
Mar 8, 2024
This change implements lowering for llvm#70076, llvm#70100, llvm#70072, & llvm#70102 CGBuiltin.cpp - - simplify lerp intrinsic IntrinsicsDirectX.td - simplify lerp intrinsic SemaChecking.cpp - remove unnecessary check DXILIntrinsicExpansion.* - add intrinsic to instruction expansion cases DXILOpLowering.cpp - make sure DXILIntrinsicExpansion happens first DirectX.h - changes to support new pass DirectXTargetMachine.cpp - changes to support new pass
farzonl
added a commit
to farzonl/llvm-project
that referenced
this issue
Mar 12, 2024
This change implements lowering for llvm#70076, llvm#70100, llvm#70072, & llvm#70102 CGBuiltin.cpp - - simplify lerp intrinsic IntrinsicsDirectX.td - simplify lerp intrinsic SemaChecking.cpp - remove unnecessary check DXILIntrinsicExpansion.* - add intrinsic to instruction expansion cases DXILOpLowering.cpp - make sure DXILIntrinsicExpansion happens first DirectX.h - changes to support new pass DirectXTargetMachine.cpp - changes to support new pass
farzonl
added a commit
to farzonl/llvm-project
that referenced
this issue
Mar 14, 2024
This change implements lowering for llvm#70076, llvm#70100, llvm#70072, & llvm#70102 `CGBuiltin.cpp` - - simplify `lerp` intrinsic `IntrinsicsDirectX.td` - simplify `lerp` intrinsic `SemaChecking.cpp` - remove unnecessary check `DXILIntrinsicExpansion.*` - add intrinsic to instruction expansion cases `DXILOpLowering.cpp` - make sure `DXILIntrinsicExpansion` happens first `DirectX.h` - changes to support new pass `DirectXTargetMachine.cpp` - changes to support new pass Why `any`, and `lerp` as instruction expansion just for DXIL? - SPIR-V there is an [OpAny](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpAny) - SPIR-V has a GLSL lerp extension via [Fmix](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#FMix) Why `exp` instruction expansion? - We have an `exp2` opcode and `exp` reuses that opcode. So instruction expansion is a convenient way to do preprocessing. - Further SPIR-V has a GLSL exp extension via [Exp](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#Exp) and [Exp2](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#Exp2) Why `rcp` as instruction expansion? This one is a bit of the odd man out and might have to move to `cgbuiltins` when we better understand SPIRV requirements. However I included it because it seems like [fast math mode has an AllowRecip flag](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_fp_fast_math_mode) which lets you compute the reciprocal without performing the division. We don't have that in DXIL so thought to include it.
farzonl
added a commit
that referenced
this issue
Mar 15, 2024
This change implements lowering for #70076, #70100, #70072, & #70102 `CGBuiltin.cpp` - - simplify `lerp` intrinsic `IntrinsicsDirectX.td` - simplify `lerp` intrinsic `SemaChecking.cpp` - remove unnecessary check `DXILIntrinsicExpansion.*` - add intrinsic to instruction expansion cases `DXILOpLowering.cpp` - make sure `DXILIntrinsicExpansion` happens first `DirectX.h` - changes to support new pass `DirectXTargetMachine.cpp` - changes to support new pass Why `any`, and `lerp` as instruction expansion just for DXIL? - SPIR-V there is an [OpAny](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#OpAny) - SPIR-V has a GLSL lerp extension via [Fmix](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#FMix) Why `exp` instruction expansion? - We have an `exp2` opcode and `exp` reuses that opcode. So instruction expansion is a convenient way to do preprocessing. - Further SPIR-V has a GLSL exp extension via [Exp](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#Exp) and [Exp2](https://registry.khronos.org/SPIR-V/specs/1.0/GLSL.std.450.html#Exp2) Why `rcp` as instruction expansion? This one is a bit of the odd man out and might have to move to `cgbuiltins` when we better understand SPIRV requirements. However I included it because it seems like [fast math mode has an AllowRecip flag](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_fp_fast_math_mode) which lets you compute the reciprocal without performing the division. We don't have that in DXIL so thought to include it.
52 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Implement and expose the HLSL
exp
intrinsic:https://learn.microsoft.com/en-us/windows/win32/direct3dhlsl/dx-graphics-hlsl-exp
The text was updated successfully, but these errors were encountered: