From 45010f7eff79efe76e2d8e578180faa385bac2b9 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Mon, 17 Mar 2025 17:26:00 +0800 Subject: [PATCH] Revert "dont do that" This reverts commit 249141026e3fb9af21adb2e472b07098d9af525f. --- tinygrad/runtime/ops_dsp.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tinygrad/runtime/ops_dsp.py b/tinygrad/runtime/ops_dsp.py index acc70b7476..d27c50f808 100644 --- a/tinygrad/runtime/ops_dsp.py +++ b/tinygrad/runtime/ops_dsp.py @@ -27,6 +27,11 @@ dsp_pm_late = PatternMatcher([ lambda d: d.replace(src=(UOp(Ops.CUSTOMI, d.dtype, arg="__builtin_HEXAGON_V6_vd0_128B()"),)+d.src[1:])), ]) +# NOTE: this just increases readability of the generated code +dsp_string = PatternMatcher([ + (UPat(Ops.CONST, (dtypes.int8, dtypes.uint8), name="x"), lambda ctx,x: str(x.arg)), +]) + class DSPRenderer(ClangRenderer): device = "DSP" supports_float4 = True @@ -34,6 +39,7 @@ class DSPRenderer(ClangRenderer): kernel_prefix = "__attribute__((noinline)) " pre_matcher = dsp_pm extra_matcher = dsp_pm_late+ClangRenderer.extra_matcher + string_rewrite = dsp_string+ClangRenderer.string_rewrite type_map = { **ClangRenderer.type_map, dtypes.uint64: "unsigned long long", dtypes.int64: "long long" } code_for_op = {**ClangRenderer.code_for_op, Ops.SIN: lambda x,dtype: f"__builtin_sin({x})", Ops.LOG2: lambda x,dtype: f"__builtin_log2l({x})" if dtype == dtypes.float64 else f"__builtin_log2f({x})",