Download build/torch211-cu128-aarch64-linux/src/common/fast_math.py from MiniMaxAI/msa: direct link, hf CLI and curl.
- Browser
- Download file 545 Bytes
-
https://huggingface.co/kernels/MiniMaxAI/msa/resolve/refs%2Fpr%2F4/build/torch211-cu128-aarch64-linux/src/common/fast_math.py
- Command line
-
hf download hf://MiniMaxAI/msa@refs/pr/4/build/torch211-cu128-aarch64-linux/src/common/fast_math.py
-
curl -L -o fast_math.py https://huggingface.co/kernels/MiniMaxAI/msa/resolve/refs%2Fpr%2F4/build/torch211-cu128-aarch64-linux/src/common/fast_math.py
545 Bytes
| # SPDX-FileCopyrightText: Copyright (c) 2026 MiniMax | |
| # SPDX-License-Identifier: MIT | |
| import cutlass | |
| import cutlass.cute as cute | |
| from cutlass import Int32 | |
| def clz(x: Int32) -> Int32: | |
| # for i in cutlass.range_constexpr(32): | |
| # if (1 << (31 - i)) & x: | |
| # return Int32(i) | |
| # return Int32(32) | |
| # Early exit is not supported yet | |
| res = Int32(32) | |
| done = False | |
| for i in cutlass.range(32): | |
| if ((1 << (31 - i)) & x) and not done: | |
| res = Int32(i) | |
| done = True | |
| return res | |