-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Implement the atan2
HLSL Function
#70096
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
Closed
8 of 14 tasks
Labels
Comments
atan2
intrinsicatan2
HLSL Function
52 tasks
I can take this one. |
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Sep 9, 2024
Issue: llvm#70096 Changes: - Doc updates: - `clang/docs/LanguageExtensions.rst` - Document the new elementwise atan2 builtin. - `llvm/docs/LangRef.rst` - Document the atan2 intrinsic - TableGen: - `clang/include/clang/Basic/Builtins.td` - Implement the atan2 builtin. - `llvm/include/llvm/IR/Intrinsics.td` - Create the atan2 intrinsic - Sema checking: - `clang/lib/Sema/SemaChecking.cpp` - Add generic sema checks to the atan2 builtin - `clang/lib/Sema/SemaHLSL` Add HLSL specifc sema checks to the atan2 builtin - `clang/lib/CodeGen/CGBuiltin.cpp` - invoke the atan2 intrinsic on uses of the builtin - `clang/lib/Headers/hlsl/hlsl_intrinsics.h` - Associate the atan2 builtin with the equivalent hlsl apis
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Sep 10, 2024
Issue: llvm#70096 Changes: - Doc updates: - `clang/docs/LanguageExtensions.rst` - Document the new elementwise atan2 builtin. - `llvm/docs/LangRef.rst` - Document the atan2 intrinsic - TableGen: - `clang/include/clang/Basic/Builtins.td` - Implement the atan2 builtin. - `llvm/include/llvm/IR/Intrinsics.td` - Create the atan2 intrinsic - Sema checking: - `clang/lib/Sema/SemaChecking.cpp` - Add generic sema checks to the atan2 builtin - `clang/lib/Sema/SemaHLSL` Add HLSL specifc sema checks to the atan2 builtin - `clang/lib/CodeGen/CGBuiltin.cpp` - invoke the atan2 intrinsic on uses of the builtin - `clang/lib/Headers/hlsl/hlsl_intrinsics.h` - Associate the atan2 builtin with the equivalent hlsl apis
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Sep 13, 2024
Issue: llvm#70096 Changes: - `llvm/lib/Target/DirectX/DXILIntrinsicExpansion.cpp` - Expand atan2 intrinsic using atan for DXIL.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Sep 13, 2024
Issue: llvm#70096 Changes: - `llvm/docs/GlobalISel/GenericOpcode.rst` - Document the G_FATAN2 opcode - `llvm/include/llvm/Support/TargetOpcodes.def` - Create a G_FATAN2 Opcode handler - `llvm/include/llvm/Target/GenericOpcodes.td` - Define the G_FATAN2 Opcode - `llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp` Map the atan2 intrinsic to G_FATAN2 Opcode - `llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp` - Map the G_FATAN2 opcode to the GLSL 4.5 and openCL atan2 instructions. - `llvm/lib/Target/SPIRV/SPIRVLegalizerInfo.cpp` - Define G_FATAN2 as a legal spirv target opcode.
farzonl
pushed a commit
that referenced
this issue
Sep 24, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 This preliminary work adds the intrinsic to llvm and expands using atan intrinsic for DXIL backend, since DXIL has no atan2 op. Part 1 for Implement the atan2 HLSL Function #70096.
farzonl
pushed a commit
that referenced
this issue
Sep 25, 2024
#109878) This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 This preliminary work adds the intrinsic to llvm and expands using atan intrinsic for DXIL backend, since DXIL has no atan2 op. Part 1 for Implement the atan2 HLSL Function #70096. (reland #108865 reverted in #109842 due to doc build break)
bob80905
pushed a commit
that referenced
this issue
Sep 26, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - Add generic opcode for atan2 - Add SPIRV lowering for atan2 Part 2 for Implement the atan2 HLSL Function #70096.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Oct 21, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `VecFuncs.def`: define intrinsic to sleef/armpl mapping - `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic - `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions - `AArch64LegalizerInfo.cpp`: Legalize atan2. Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Oct 24, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `VecFuncs.def`: define intrinsic to sleef/armpl mapping - `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic - `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions - `AArch64LegalizerInfo.cpp`: Legalize atan2. Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d
added a commit
that referenced
this issue
Oct 25, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `VecFuncs.def`: define intrinsic to sleef/armpl mapping - `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic - `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions - `AArch64LegalizerInfo.cpp`: Legalize atan2. Part 5 for Implement the atan2 HLSL Function #70096.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Oct 25, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `Builtins.td` - Add f16 support for libm atan2 builtin - `CGBuiltin.cpp` - Emit constraint atan2 intrinsic for clang builtin Part of Implement the atan2 HLSL Function llvm#70096.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Oct 25, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 This returns true from isTriviallyVectorizable for llvm.atan2 intrinsic. It also adds llvm atan2 intrinsic equivalents to VecFuncs.def for massv. Part of: Implement the atan2 HLSL Function llvm#70096.
This was referenced Oct 25, 2024
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Oct 28, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 This returns true from isTriviallyVectorizable for llvm.atan2 intrinsic. It also adds llvm atan2 intrinsic equivalents to VecFuncs.def for massv. Part of: Implement the atan2 HLSL Function llvm#70096.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Oct 28, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `Builtins.td` - Add f16 support for libm atan2 builtin - `CGBuiltin.cpp` - Emit constraint atan2 intrinsic for clang builtin Part of Implement the atan2 HLSL Function llvm#70096.
NoumanAmir657
pushed a commit
to NoumanAmir657/llvm-project
that referenced
this issue
Nov 4, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `VecFuncs.def`: define intrinsic to sleef/armpl mapping - `LegalizerHelper.cpp`: add missing fewerElementsVector handling for the new atan2 intrinsic - `AArch64ISelLowering.cpp`: Add arch64 specializations for lowering like neon instructions - `AArch64LegalizerInfo.cpp`: Legalize atan2. Part 5 for Implement the atan2 HLSL Function llvm#70096.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Nov 7, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 This returns true from isTriviallyVectorizable for llvm.atan2 intrinsic. It also adds llvm atan2 intrinsic equivalents to VecFuncs.def for massv. Part of: Implement the atan2 HLSL Function llvm#70096.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Nov 7, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `Builtins.td` - Add f16 support for libm atan2 builtin - `CGBuiltin.cpp` - Emit constraint atan2 intrinsic for clang builtin Part of Implement the atan2 HLSL Function llvm#70096.
tex3d
added a commit
that referenced
this issue
Nov 9, 2024
…e veclibs (#113637) This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - Return true for atan2 from isTriviallyVectorizable - Add atan2 to VecFuncs.def for massv and accelerate libraries. - Add atan2 to hasOptimizedCodeGen - Add atan2 support in llvm/lib/Analysis/ValueTracking.cpp llvm::getIntrinsicForCallSite and update vectorization tests - Add atan2 name check to isLoweredToCall in llvm/include/llvm/Analysis/TargetTransformInfoImpl.h - Note: there's no test coverage for these names in isLoweredToCall, except that Transforms/TailCallElim/inf-recursion.ll is impacted by the "fabs" case Thanks to @jroelofs for the atan2 accelerate veclib and associated test additions, plus the hasOptimizedCodeGen addition. Part of: Implement the atan2 HLSL Function #70096.
tex3d
added a commit
to tex3d/llvm-project
that referenced
this issue
Nov 12, 2024
This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - `Builtins.td` - Add f16 support for libm atan2 builtin - `CGBuiltin.cpp` - Emit constraint atan2 intrinsic for clang builtin Part of Implement the atan2 HLSL Function llvm#70096.
Groverkss
pushed a commit
to iree-org/llvm-project
that referenced
this issue
Nov 15, 2024
…e veclibs (llvm#113637) This change is part of this proposal: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294 - Return true for atan2 from isTriviallyVectorizable - Add atan2 to VecFuncs.def for massv and accelerate libraries. - Add atan2 to hasOptimizedCodeGen - Add atan2 support in llvm/lib/Analysis/ValueTracking.cpp llvm::getIntrinsicForCallSite and update vectorization tests - Add atan2 name check to isLoweredToCall in llvm/include/llvm/Analysis/TargetTransformInfoImpl.h - Note: there's no test coverage for these names in isLoweredToCall, except that Transforms/TailCallElim/inf-recursion.ll is impacted by the "fabs" case Thanks to @jroelofs for the atan2 accelerate veclib and associated test additions, plus the hasOptimizedCodeGen addition. Part of: Implement the atan2 HLSL Function llvm#70096.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note atan2 has been identified as a potential generic llvm intrinsic:
Investigation: #87367
RFC: https://discourse.llvm.org/t/rfc-all-the-math-intrinsics/78294
atan2
clang builtin,atan2
clang builtin withhlsl_intrinsics.h
atan2
toCheckHLSLBuiltinFunctionCall
inSemaChecking.cpp
atan2
toEmitHLSLBuiltinExpr
inCGBuiltin.cpp
clang/test/CodeGenHLSL/builtins/atan2.hlsl
clang/test/SemaHLSL/BuiltIns/atan2-errors.hlsl
Create theint_atan2
intrinsic inIntrinsics.td
Create theint_dx_atan2
intrinsic inIntrinsicsDirectX.td
DXILOpMapping
ofint_atan2
to17
inDXIL.td
atan2.ll
andatan2_errors.ll
tests inllvm/test/CodeGen/DirectX/
Create theint_spv_atan2
intrinsic inIntrinsicsSPIRV.td
In SPIRVInstructionSelector.cpp create theatan2
lowering and map it toint_spv_atan2
inSPIRVInstructionSelector::selectIntrinsic
.SPIRVInstructionSelector::spvSelect
Addllvm/test/CodeGen/SPIRV/hlsl-intrinsics/atan2.ll
DirectX
SPIR-V
Atan2:
Description:
Atan2
Arc tangent. Result is an angle, in radians, whose tangent is y / x.
The signs of x and y are used to determine what quadrant the angle
is in. The range of result values is [-π, π] . Result is undefined if
x and y are both 0.
The operand x and y must be a scalar or vector whose component type
is 16-bit or 32-bit floating-point.
Result Type and the type of all operands must be the same type.
Results are computed per component.
25
<id>
y
<id>
x
Test Case(s)
Example 1
HLSL:
Returns the arctangent of two values (x,y).
Parameters
Return Value
The arctangent of (y,x).
Remarks
The signs of the x and y parameters are used to determine the quadrant of the return values within the range of -π to π. The atan2 HLSL intrinsic function is well-defined for every point other than the origin, even if y equals 0 and x does not equal 0.
Type Description
Minimum Shader Model
This function is supported in the following shader models.
Requirements
See also
Intrinsic Functions (DirectX HLSL)
The text was updated successfully, but these errors were encountered: