[libclc] libclc: increase fp16 support (PR #98149)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 9 05:33:13 PDT 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r 402eca265f7162e26b8b74d18297fd76c9f100de...4524f49360c28c6c024a9d13664773024ae053ad libclc/generic/lib/gen_convert.py
``````````
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- gen_convert.py 2024-07-09 12:22:26.000000 +0000
+++ gen_convert.py 2024-07-09 12:32:47.459439 +0000
@@ -529,11 +529,11 @@
# short is 16 bits signed, so the maximum value rounded to zero is 0x1.ffcp+14 (0x1p+15 == 32768 > 0x7fff == 32767)
if src == "short":
dst_max = "0x1.ffcp+14"
print(
" return clamp(sel, ({DST}{N}){DST_MIN}, ({DST}{N}){DST_MAX});".format(
- DST=dst, N=size, DST_MIN=limit_min[dst], DST_MAX=dst_max
+ DST=dst, N=size, DST_MIN=limit_min[dst], DST_MAX=dst_max
)
)
else:
print(" return sel;")
if mode == "_rtp":
@@ -541,11 +541,15 @@
" {DST}{N} sel = select(r, nextafter(r, ({DST}{N})INFINITY), convert_{BOOL}{N}(y < x));".format(
DST=dst, N=size, BOOL=bool_type[dst]
)
)
if dst == "half" and src in int_types and sizeof_type[src] >= 2:
- print(" return max(sel, ({DST}{N}){DST_MIN});".format(DST=dst, N=size, DST_MIN=limit_min[dst]))
+ print(
+ " return max(sel, ({DST}{N}){DST_MIN});".format(
+ DST=dst, N=size, DST_MIN=limit_min[dst]
+ )
+ )
else:
print(" return sel;")
if mode == "_rtn":
if clspv:
print(
@@ -573,11 +577,15 @@
if dst == "half" and src in int_types and sizeof_type[src] >= 2:
dst_max = limit_max[dst]
# short is 16 bits signed, so the maximum value rounded to negative infinity is 0x1.ffcp+14 (0x1p+15 == 32768 > 0x7fff == 32767)
if src == "short":
dst_max = "0x1.ffcp+14"
- print(" return min(sel, ({DST}{N}){DST_MAX});".format(DST=dst, N=size, DST_MAX=dst_max))
+ print(
+ " return min(sel, ({DST}{N}){DST_MAX});".format(
+ DST=dst, N=size, DST_MAX=dst_max
+ )
+ )
else:
print(" return sel;")
# Footer
print("}")
``````````
</details>
https://github.com/llvm/llvm-project/pull/98149
More information about the cfe-commits
mailing list