-
Notifications
You must be signed in to change notification settings - Fork 15.3k
[NVPTX] Cleanup and document nvvm.fabs intrinsics, adding f16 support #135644
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
Changes from 1 commit
fd11c2b
7d87fb5
e0d28ec
1bfd50d
51f32c9
391bfad
fc08be3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -309,6 +309,58 @@ space casted to this space), 1 is returned, otherwise 0 is returned. | |
| Arithmetic Intrinsics | ||
| --------------------- | ||
|
|
||
| '``llvm.nvvm.fabs.*``' Intrinsic | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Syntax: | ||
| """"""" | ||
|
|
||
| .. code-block:: llvm | ||
|
|
||
| declare float @llvm.nvvm.fabs.f32(float %a) | ||
| declare double @llvm.nvvm.fabs.f64(double %a) | ||
| declare half @llvm.nvvm.fabs.f16(half %a) | ||
| declare <2 x bfloat> @llvm.nvvm.fabs.v2bf16(<2 x bfloat> %a) | ||
|
|
||
| Overview: | ||
| """"""""" | ||
|
|
||
| The '``llvm.nvvm.fabs.*``' intrinsics return the absolute value of the operand. | ||
|
|
||
| Semantics: | ||
| """""""""" | ||
|
|
||
| Unlike, '``llvm.fabs.*``', these intrinsics do not perfectly preserve NaN | ||
| values. Instead, a NaN input yeilds an unspecified NaN output. The exception to | ||
| this rule is the double precision variant, for which NaN is preserved. | ||
|
||
|
|
||
|
|
||
| '``llvm.nvvm.fabs.ftz.*``' Intrinsic | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
| Syntax: | ||
| """"""" | ||
|
|
||
| .. code-block:: llvm | ||
|
|
||
| declare float @llvm.nvvm.fabs.ftz.f32(float %a) | ||
| declare half @llvm.nvvm.fabs.ftz.f16(half %a) | ||
| declare <2 x half> @llvm.nvvm.fabs.ftz.v2f16(<2 x half> %a) | ||
|
|
||
| Overview: | ||
| """"""""" | ||
|
|
||
| The '``llvm.nvvm.fabs.ftz.*``' intrinsics return the absolute value of the | ||
| operand, flushing subnormals to sign preserving zero. | ||
|
|
||
| Semantics: | ||
| """""""""" | ||
|
|
||
| Before the absolute value is taken, the input is flushed to sign preserving | ||
| zero if it is a subnormal. In addtion, unlike '``llvm.fabs.*``', a NaN input | ||
| yields an unspecified NaN output. | ||
|
|
||
|
|
||
| '``llvm.nvvm.idp2a.[us].[us]``' Intrinsics | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -226,14 +226,17 @@ class RegTyInfo<ValueType ty, NVPTXRegClass rc, Operand imm, SDNode imm_node, | |
| int Size = ty.Size; | ||
| } | ||
|
|
||
| def I16RT : RegTyInfo<i16, Int16Regs, i16imm, imm>; | ||
| def I32RT : RegTyInfo<i32, Int32Regs, i32imm, imm>; | ||
| def I64RT : RegTyInfo<i64, Int64Regs, i64imm, imm>; | ||
|
|
||
| def F32RT : RegTyInfo<f32, Float32Regs, f32imm, fpimm>; | ||
| def F64RT : RegTyInfo<f64, Float64Regs, f64imm, fpimm>; | ||
| def F16RT : RegTyInfo<f16, Int16Regs, f16imm, fpimm, supports_imm = 0>; | ||
| def BF16RT : RegTyInfo<bf16, Int16Regs, bf16imm, fpimm, supports_imm = 0>; | ||
| def I16RT : RegTyInfo<i16, Int16Regs, i16imm, imm>; | ||
| def I32RT : RegTyInfo<i32, Int32Regs, i32imm, imm>; | ||
| def I64RT : RegTyInfo<i64, Int64Regs, i64imm, imm>; | ||
|
|
||
| def F32RT : RegTyInfo<f32, Float32Regs, f32imm, fpimm>; | ||
| def F64RT : RegTyInfo<f64, Float64Regs, f64imm, fpimm>; | ||
| def F16RT : RegTyInfo<f16, Int16Regs, f16imm, fpimm, supports_imm = 0>; | ||
| def BF16RT : RegTyInfo<bf16, Int16Regs, bf16imm, fpimm, supports_imm = 0>; | ||
|
|
||
| def F16X2RT : RegTyInfo<v2f16, Int32Regs, ?, ?, supports_imm = 0>; | ||
| def BF16X2RT : RegTyInfo<v2bf16, Int32Regs, ?, ?, supports_imm = 0>; | ||
|
Comment on lines
+238
to
+239
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting. I never thought of passing |
||
|
|
||
|
|
||
| // Template for instructions which take three int64, int32, or int16 args. | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.