Cast int to str for render_cast (#10864)

* Add type hint for render_cast

* Revert "Add type hint for render_cast"

This reverts commit 33858eb711.

* Cast int to str for render_cast
This commit is contained in:
simone-pietro
2025-06-18 10:55:27 -04:00
committed by GitHub
parent d8cea1a279
commit 56fe5b60a9
+1 -1
View File
@@ -39,7 +39,7 @@ base_rewrite = PatternMatcher([
# consts are rendered to larger type and casted
(UPat(Ops.CONST, (dtypes.bfloat16, dtypes.half), name="x"), lambda ctx,x: f"({ctx.render_cast(x.dtype, f'{x.arg}f')})"),
(UPat(Ops.CONST, (dtypes.uint8, dtypes.uint16), name="x"), lambda ctx,x: f"({ctx.render_cast(x.dtype, f'{x.arg}u')})"),
(UPat(Ops.CONST, (dtypes.int8, dtypes.int16), name="x"), lambda ctx,x: f"({ctx.render_cast(x.dtype, x.arg)})"),
(UPat(Ops.CONST, (dtypes.int8, dtypes.int16), name="x"), lambda ctx,x: f"({ctx.render_cast(x.dtype, str(x.arg))})"),
# default const render
(UPat(Ops.CONST, name="x"), lambda ctx,x: str(x.arg)),
# new load/store